Skip to content

Instantly share code, notes, and snippets.

@chrismeller
Last active December 12, 2015 08:59
Show Gist options
  • Save chrismeller/4748208 to your computer and use it in GitHub Desktop.
Save chrismeller/4748208 to your computer and use it in GitHub Desktop.
https vhost
server {
# the same as for non-ssl, except we indicate that when listening on port
# 443, it should use ssl
listen [::]:443 ssl;
server_name blog.chrismeller.com new.chrismeller.com;
# specify the certificate (chain) and key file to be used for this vhost
ssl_certificate ssl/chrismeller.com.2012.pem;
ssl_certificate_key ssl/chrismeller.com.2012.key;
# i use a different directory as a mater of practice, and just
# create a symlink to the normal non-ssl "public" directory when they are the same
root /media/www/public_html/blog.chrismeller.com/ssl;
# note the different logs for ssl and non-ssl. no real reason, it's just convenient for me
access_log /media/www/public_html/blog.chrismeller.com/logs/ssl.access.log;
error_log /media/www/public_html/blog.chrismeller.com/logs/ssl.error.log;
include fastcgi_params;
location / {
# the only other difference is that i'm not redirecting admin
# and login pages - we're already on ssl
try_files $uri $uri/ /index.php$is_args$args;
}
location /status {
fastcgi_pass php;
}
location /ping {
fastcgi_pass php;
}
location ~ \.php$ {
fastcgi_pass php;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment