Skip to content

Instantly share code, notes, and snippets.

@luxwarp
Last active August 18, 2019 11:01
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 luxwarp/390ad035ff8bb96e6510226e24d21ce6 to your computer and use it in GitHub Desktop.
Save luxwarp/390ad035ff8bb96e6510226e24d21ce6 to your computer and use it in GitHub Desktop.
Example server block config for Nginx + PHP7.3-fpm.
# Example server block config for Nginx + PHP7.3-fpm.
# Author: Mikael Luxwarp Carlsson luxwarp@codeiolo.org https://codeiolo.org
# License: ISC
# Created: 2019-08-17
server {
# What ports should be listened to.
listen 80;
listen [::]:80;
# the path to site web root (eg /var/www/html).
root /path/to/web/root/folder;
# name of index files that can be used inside web root.
index index.html index.htm index.php;
# The urls this config should listen to.
server_name example.com www.example.com;
# Location block for url
location / {
try_files $uri $uri/ =404;
}
# PHP configuration.
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
# deny visitors to access .ht files ex .htaccess (apache)
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment