0

I'm trying to get my website running with ssl. With my current settings I am able to access the regular domain, but not with https.

I followed these posts and links to no success.

http://wiki.nginx.org/HttpSslModule

http://blog.argteam.com/coding/hardening-node-js-for-production-part-2-using-nginx-to-avoid-node-js-load/

Node.js + Nginx - What now?

I have created and self signed the certificate. What am I doing wrong?

upstream myapp {
    server 127.0.0.1:3000;
}

server {

ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;

listen 80;
listen 443 ssl;

    server_name poplive.co;

location / {
proxy_set_header X-FORWARDED-PROTO https;
    proxy_pass http://myapp/;

    }
 }
Community
  • 1
  • 1
1ManStartup
  • 3,716
  • 4
  • 21
  • 26

1 Answers1

1

If you want to use the nginx.conf instead of adding a vhost file, you must put your configuration in http context. This configuration bellow should work for your case:

events { worker_connections 1024; }
http {
    upstream myapp {
        server 127.0.0.1:3000;
    }

    server {
        ssl_certificate /etc/nginx/ssl/server.cert;
        ssl_certificate_key /etc/nginx/ssl/server.key;

        listen 80;
        listen 443 ssl;

        server_name poplive.co;

        location / {
            proxy_set_header X-FORWARDED-PROTO https;
            proxy_pass http://myapp/;
        }
    } 
}
damphat
  • 18,246
  • 8
  • 45
  • 59