Skip to content

Instantly share code, notes, and snippets.

@jbradach
Last active August 29, 2015 14:09
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 jbradach/e0da911b02cd2c3fbd8b to your computer and use it in GitHub Desktop.
Save jbradach/e0da911b02cd2c3fbd8b to your computer and use it in GitHub Desktop.
Nginx server block config for WordPress over SSL
# https://gist.github.com/jbradach/e0da911b02cd2c3fbd8b
server {
listen [::]:80;
listen 80;
server_name rudeotter.foo www.rudeotter.foo;
return 301 https://rudeotter.foo$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name www.rudeotter.foo;
ssl_certificate /srv/ssl/rudeotter.crt;
ssl_certificate_key /srv/ssl/rudeotter.key;
include h5bp/directive-only/ssl.conf;
include h5bp/directive-only/ssl-stapling.conf;
include h5bp/directive-only/spdy.conf;
return 301 https://rudeotter.foo$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name rudeotter.foo;
ssl_certificate /srv/ssl/rudeotter.crt;
ssl_certificate_key /srv/ssl/rudeotter.key;
include h5bp/directive-only/ssl.conf;
include h5bp/directive-only/ssl-stapling.conf;
include h5bp/directive-only/spdy.conf;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
include h5bp/basic.conf;
include conf.d/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment