Skip to content

Instantly share code, notes, and snippets.

@mattpatterson94
Last active February 4, 2018 23:56
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 mattpatterson94/d6c82eacdef980eef87316a5369b6b22 to your computer and use it in GitHub Desktop.
Save mattpatterson94/d6c82eacdef980eef87316a5369b6b22 to your computer and use it in GitHub Desktop.
NGINX Config with SSL Template
# NGINX CONFIG W/ SSL TEMPLATE
#dev/wordpress #dev/snippets #dev/server
```
server {
listen 80;
listen [::]:80;
server_name www.example.com;
return 301 https://$host$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name staging.example.com example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
client_max_body_size 20M;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name www.example.com;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
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