Skip to content

Instantly share code, notes, and snippets.

@jamesonquinn
Created July 27, 2014 15:32
Show Gist options
  • Save jamesonquinn/d1c164de8d4b29e3dc77 to your computer and use it in GitHub Desktop.
Save jamesonquinn/d1c164de8d4b29e3dc77 to your computer and use it in GitHub Desktop.
non-working nginx conf for proxying ssl to meteor
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen 4431;
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;
}
ssl on;
ssl_certificate /home/ubuntu/nginx/bundle.crt;
ssl_certificate_key /home/ubuntu/nginx/myserver.key;
ssl_verify_depth 3;
}
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
@yauh
Copy link

yauh commented Jul 27, 2014

Let's try this for starters:

server {
    server_name bettercount.us default;
    listen   4431;
    access_log /var/log/nginx/meteorapp.access.log;
    error_log /var/log/nginx/meteorapp.error.log;

     location / {
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
               proxy_set_header Host $http_host;
               proxy_redirect off;
               proxy_pass http://$server_addr:3000;
               proxy_http_version 1.1;
               proxy_set_header Upgrade $http_upgrade;
               proxy_set_header Connection "upgrade";
 }

 #       ssl on;
 #       ssl_certificate /home/ubuntu/nginx/bundle.crt;
 #       ssl_certificate_key /home/ubuntu/nginx/myserver.key;
 #       ssl_verify_depth 3;
}

@yauh
Copy link

yauh commented Jul 27, 2014

server {
server_name bettercount.local;
listen 8080;
access_log /var/log/nginx/meteorapp.access.log;
error_log /var/log/nginx/meteorapp.error.log;

 location / {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header Host $http_host;
           proxy_redirect off;
           proxy_pass http://bettercount.us:3000;
           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade";

}

ssl on;

ssl_certificate /home/ubuntu/nginx/bundle.crt;

ssl_certificate_key /home/ubuntu/nginx/myserver.key;

ssl_verify_depth 3;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment