Skip to content

Instantly share code, notes, and snippets.

@suhaboncukcu
Created April 14, 2017 10:55
Show Gist options
  • Save suhaboncukcu/1b198e450b6772a3207d2e19605c2f6f to your computer and use it in GitHub Desktop.
Save suhaboncukcu/1b198e450b6772a3207d2e19605c2f6f to your computer and use it in GitHub Desktop.
Nginx SSL Certificate Basic Installation.
# this is usually under cd /etc/nginx-sp/vhosts.d
# file paths are for serverpilot.io but the settings should be the same for every nginx.
# certificate_file.crt is usually a chain bundle that you can create with a simple cat.
# thanks to regan: https://www.digitalocean.com/community/questions/install-ssl-certificate-manually-on-serverpilot-2?answer=23780
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name
www.DOMAIN.com
DOMAIN.com
;
ssl on;
ssl_certificate /home/certs/domain_name/certificate_file.crt;
ssl_certificate_key /home/certs/domain_name/privatekey_file.key;
root /srv/users/serverpilot/apps/APP_NAME/public;
access_log /srv/users/serverpilot/log/APP_NAME/APP_NAME_nginx.access.log main;
error_log /srv/users/serverpilot/log/APP_NAME/APP_NAME_nginx.error.log;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-SSL on;
proxy_set_header X-Forwarded-Proto $scheme;
include /etc/nginx-sp/vhosts.d/APP_NAME.d/*.nonssl_conf;
include /etc/nginx-sp/vhosts.d/APP_NAME.d/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment