# # This assumes you already have the html { block configured # server { listen 80; # highly recommend to use 443 and ssl, look into using certbot server_name dyndns.example.com; root /var/www/dnydns.example.com; # if you are using a dedicated site remove everythin except update.php # update.php; update.php index index.html index.htm index.nginx-debian.html index.php; # deny all access to any file containing "env", "log" or "json" # returns 404 as if file did not exist location ~* (env|log|json) { deny all; return 404; } # deny access to any file .ht* like .htaccess or .htpasswd location ~ /\.ht { deny all; } # pass PHP scripts to FastCGI server location ~ \.php$ { # FastCGI config, might be in another file that is included # regex to split $uri to $fastcgi_script_name and $fastcgi_path fastcgi_split_path_info ^(.+?\.php)(/.*)$; # Check that the PHP script exists before passing it try_files $fastcgi_script_name =404; # Bypass the fact that try_files resets $fastcgi_path_info # see: http://trac.nginx.org/nginx/ticket/321 set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; fastcgi_index index.php; include fastcgi.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/run/php/php-fpm.sock; # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; } }