Skip to content

Instantly share code, notes, and snippets.

@iCaspar
Created November 28, 2018 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iCaspar/457a2285ca1890e5ba23c7c69fa113e2 to your computer and use it in GitHub Desktop.
Save iCaspar/457a2285ca1890e5ba23c7c69fa113e2 to your computer and use it in GitHub Desktop.
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