Answer the question
In order to leave comments, you need to log in
How to setup nginx ssl nodejs?
Good afternoon!
I don’t understand what’s the matter already, and I launched two servers in the node with different ports, I registered the config like this
server {
listen 80;
server_name www.test.ru test.ru;
# Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://localhost:3333;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2 ipv6only=on;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
server_name www.test.ru test.ru;
ssl_certificate /etc/letsencrypt/live/test.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/test.ru/fullchain.pem;
location / {
proxy_pass https://localhost:3334;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question