server { listen 80 default_server; listen [::]:80 default_server; server_name _; # Add index.php to setup Nginx, PHP & PHP-FPM config index index.php index.html index.htm index.nginx-debian.html; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /var/www/html; # pass PHP scripts on Nginx to FastCGI (PHP-FPM) server location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; # Nginx php-fpm config: 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; } client_max_body_size 15M; server_tokens off; # Hide PHP headers fastcgi_hide_header X-Powered-By; fastcgi_hide_header X-CF-Powered-By; fastcgi_hide_header X-Runtime; location / { try_files $uri $uri/ /index.php?$query_string; gzip_static on; } # deny access to Apache .htaccess on Nginx with PHP, # if Apache and Nginx document roots concur location ~ /\.ht {deny all;} location ~ /\.svn/ {deny all;} location ~ /\.git/ {deny all;} location ~ /\.hg/ {deny all;} location ~ /\.bzr/ {deny all;} }