Instantly share code, notes, and snippets.

Embed
What would you like to do?
A default nginx config for php apps.
server {
listen 80 default_server;
root /var/www/html;
index index.html index.htm index.php;
server_name localhost;
charset utf-8;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass php:9000;
}
location ~ /\.ht {
deny all;
}
error_page 404 /index.html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment