Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using nginx as proxy to NodeJS server running on localhost #26

Open
niloy opened this issue Aug 19, 2015 · 0 comments
Open

Using nginx as proxy to NodeJS server running on localhost #26

niloy opened this issue Aug 19, 2015 · 0 comments

Comments

@niloy
Copy link
Owner

niloy commented Aug 19, 2015

Redirects all traffic coming to example.com to localhost:5555. Also redirects all http to https. Below is the nginx conf file.

server {
    listen 80;
    listen 443 ssl;

    server_name example.com;

    ssl_certificate /etc/ssl/ssl.crt;
    ssl_certificate_key /etc/ssl/ssl.key;
    ssl_session_timeout 5m;
    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://localhost:5555;
    }

    if ($ssl_protocol = "") {
        return 301 https://example.com$request_uri;
    }
}

If SSL is not required, the conf is even simpler, given below. Remove server_name if its the default server.

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://localhost:5555;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant