Cấu hình cho web HTML tĩnh
server {
listen ;
listen [::]:;
server_name ;
root ;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Cấu hình với ProxyPass
server {
listen ;
listen [::]:;
server_name ;
location / {
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header host $host;
proxy_pass ;
proxy_http_version 1.1;
proxy_set_header upgrade $http_upgrade;
proxy_set_header connection "upgrade";
proxy_cache_bypass $http_upgrade;
}
}
Cấu hình cho PHP/Laravel
server {
listen ;
listen [::]:;
server_name ;
root ;
index index.php index.htm index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:;
fastcgi_index index.php;
fastcgi_param script_filename $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}