Skip to content

Instantly share code, notes, and snippets.

@cheynewallace
Last active June 28, 2018 11:51
Show Gist options
  • Save cheynewallace/730edd91754934c0a076 to your computer and use it in GitHub Desktop.
Save cheynewallace/730edd91754934c0a076 to your computer and use it in GitHub Desktop.
Nginx Site Running WordPress SSL Config Using LetsEncrypt Cert
server {
listen 80;
server_name yoursite.com www.yoursite.com;
return 301 https://www.yoursite.com$request_uri;
}
# HTTPS server
server {
listen 443;
server_name www.yoursite.com yoursite.com;
root /usr/share/nginx/yoursite;
index index.php index.html index.htm;
access_log /var/log/nginx/yoursite.access.log;
error_log /var/log/nginx/yoursite.error error;
ssl on;
ssl_certificate /etc/letsencrypt/live/yoursite.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yoursite.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment