Skip to content

Instantly share code, notes, and snippets.

@luissquall
Last active June 12, 2020 23:56
Show Gist options
  • Save luissquall/8b5be0f0e081c9edd0aa683859b3e345 to your computer and use it in GitHub Desktop.
Save luissquall/8b5be0f0e081c9edd0aa683859b3e345 to your computer and use it in GitHub Desktop.
server {
listen 80;
listen [::]:80;
server_name {{ domain }};
client_max_body_size 10M;
root {{ webroot }};
index index.php index.html index.htm;
access_log /var/log/nginx/{{ domain }}.access.log;
error_log /var/log/nginx/{{ domain }}.error.log;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include snippets/fastcgi-php.conf;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php/php{{ php_version }}-fpm.sock;
#The following parameter can be also included in fastcgi_params file
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment