Answer the question
In order to leave comments, you need to log in
NodeJS, Nginx and SSL. Do I need to establish an ssl connection between the backend on node and nginx?
There is a backend on port 3000, the port is closed from outside. It is proxied by nginx on port 80.
An https connection is established between the client and nginx.
upstream backend {
server 127.0.0.1:3000;
keepalive 8;
}
server {
# SSL configuration
#
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/ssl/ssl-bundle.crt;
ssl_certificate_key /etc/ssl/r_ru.key;
add_header Strict-Transport-Security "max-age=31536000";
#
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass backend;
proxy_redirect off;
}
}
server {
...
proxy_ssl_certificate /etc/ssl/certs/backend.crt;
proxy_ssl_certificate_key /etc/ssl/certs/backend.key;
proxy_pass backend;
proxy_ssl on;
}
Answer the question
In order to leave comments, you need to log in
On one server - it is better to use a socket
On several - it is worth using encryption, even on self-signed certificates
If everything is on the same server, then there is no point in this.
No, it's not necessary.
But if you really want to, then you can, of course, but the meaning escapes when you walk through the localhost
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question