-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
36 lines (32 loc) · 1.08 KB
/
nginx.conf
File metadata and controls
36 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Configuração Nginx para Express PHP
server {
listen 8000;
server_name localhost;
root /home/cfernandes/projetos-php/express-php/examples;
index app.php;
# Remove extensão .php e adiciona PATH_INFO
location ~ ^/app(/.*)?$ {
try_files $uri $uri/ /app.php$1?$query_string;
fastcgi_split_path_info ^(/app\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000; # ou unix:/var/run/php/php8.x-fpm.sock
fastcgi_index app.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Para outros arquivos PHP sem extensão
location / {
try_files $uri $uri/ @php;
}
location @php {
rewrite ^(.*)$ $1.php last;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}