Last active
August 29, 2015 14:09
-
-
Save jbradach/e0da911b02cd2c3fbd8b to your computer and use it in GitHub Desktop.
Nginx server block config for WordPress over SSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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