Skip to content

Instantly share code, notes, and snippets.

@JaniKibichi
Created January 5, 2017 15:07
Show Gist options
  • Save JaniKibichi/8ad54743997ca08fd7b43d99e2d7bc2f to your computer and use it in GitHub Desktop.
Save JaniKibichi/8ad54743997ca08fd7b43d99e2d7bc2f to your computer and use it in GitHub Desktop.
https for var/www sites
#Start of server blocks
# HTTP - redirect all requests to HTTPS:
server {
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name hey.another.com;
return 301 https://$server_name$request_uri;
}
# HTTPS - proxy requests on to local Node.js app:
server {
listen 443;
server_name hey.another.com;
ssl on;
# Use certificate and key provided by Let's Encrypt:
ssl_certificate /etc/letsencrypt/live/hey.another.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hey.another.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-fpm:
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment