Skip to content

Instantly share code, notes, and snippets.

@digilord
Created December 10, 2013 16:20
Show Gist options
  • Save digilord/7893351 to your computer and use it in GitHub Desktop.
Save digilord/7893351 to your computer and use it in GitHub Desktop.
Meteor & Munin Nginx Configuration with SSL
server {
listen 80;
server_name www.YOURDOMAIN.com;
# $scheme will get the http protocol
# and 301 is best practice for tablet, phone, desktop and seo
# return 301 $scheme://YOURDOMAIN.com$request_uri;
# We want to redirect people to the https site when they come to the http site.
return 301 https://YOURDOMAIN.com$request_uri;
}
server {
listen 80;
server_name YOURDOMAIN.com;
# $scheme will get the http protocol
# and 301 is best practice for tablet, phone, desktop and seo
# return 301 $scheme://YOURDOMAIN.com$request_uri;
# We want to redirect people to the https site when they come to the http site.
return 301 https://YOURDOMAIN.com$request_uri;
}
server {
listen 443;
server_name YOURDOMAIN.com;
access_log /var/log/nginx/meteorapp.access.log;
error_log /var/log/nginx/meteorapp.error.log;
location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
ssl on;
ssl_certificate /etc/nginx/ssl/star.YOURDOMAIN.com.pem;
ssl_certificate_key /etc/nginx/ssl/wildYOURDOMAIN.key;
ssl_verify_depth 3;
}
server {
listen 80;
server_name munin.YOURDOMAIN.com;
return 301 https://munin.YOURDOMAIN.com$request_uri;
}
server {
listen 443;
server_name munin.YOURDOMAIN.com;
access_log /var/log/nginx/munin.access.log;
error_log /var/log/nginx/munin.error.log;
location / {
rewrite ^/$ munin/ redirect; break;
}
location /munin/static/ {
alias /etc/munin/static/;
expires modified +1w;
}
location /munin/ {
auth_basic "Restricted";
# Create the htpasswd file with the htpasswd tool.
auth_basic_user_file /etc/nginx/htpasswd;
alias /var/cache/munin/www/;
expires modified +310s;
}
ssl on;
ssl_certificate /etc/nginx/ssl/star.YOURDOMAIN.com.pem;
ssl_certificate_key /etc/nginx/ssl/wildYOURDOMAIN.key;
ssl_verify_depth 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment