Monday, 13 March 2017

How to run nodejs server over 443 ensuring nginx doesnt stop working

My Nginx default file looks like this:

server {
       listen  80;
       server_name humanfox.com www.humanfox.com;
       rewrite  ^/(.*)$ https://www.humanfox.com$1 permanent;
}


server {
        listen 443 ssl spdy;
        server_name humanfox.com www.humanfox.com;
        ssl on;
        ssl_certificate /root/ca3/www.humanfox.com.crt;
        ssl_certificate_key /root/ca3/humanfox.com.key;
        access_log  /var/log/nginx/humanfox.com.access.log;
        error_log   /var/log/nginx/humanfox.com.error.log;
        rewrite     ^/(.*)$ https://www.humanfox.com$1 permanent;
}

Now, Nginx is running properly but when I try to run my nodejs server on port 443(https) it says EADDR already in use. When I kill the port to use my nodejs server instead, it also kills Nginx and Nginx stops working.

How do I run my nodejs server on 443 ensuring nginx doesn't close.



via Ishan Sharma

No comments:

Post a Comment