Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@classmember
Last active May 3, 2019 02:11
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 classmember/e696464a8f8ba5e8229011d173036e4a to your computer and use it in GitHub Desktop.
Save classmember/e696464a8f8ba5e8229011d173036e4a to your computer and use it in GitHub Desktop.
upstream php {
server unix:/var/run/php/php7.2-fpm.sock;
server 127.0.0.1:9000;
}
server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443;
listen [::]:443;
server_name sitename.com www.sitename.com;
# redirects
rewrite "(?i)/from\-place.?$" /to-place permanent;
rewrite "(?i)/from\-here.?$" /to-here permanent;
include rewrites.conf;
root /home/sitename/public_html;
index index.php;
access_log /var/log/nginx/sitename.com.access.log;
error_log /var/log/nginx/sitename.com.error.log;
ssl on;
ssl_certificate /home/sitename/ssl.cert;
ssl_certificate_key /home/sitename/myserver.key;
# do not use SSLv3 due to the POODLE exploit
# https://en.wikipedia.org/wiki/POODLE
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
client_max_body_size 32m;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
location /home/sitename/public_html {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi.conf;
include snippets/fastcgi-php.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php;
fastcgi_intercept_errors on;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location ~/\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment