I configured a proxy server on nginx, but I can’t understand if it works because nothing has changed, the access.log file in / var / log / nginx is empty, I go to https://site.ru

server { # IP, который мы будем слушать listen 443 ssl; server_name site.ru; keepalive_timeout 60; ssl_certificate _address_/site.ru.crt; ssl_certificate_key _address_/site.ru.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "HIGH:!RC4:!aNULL:!MD5:!kEDH"; add_header Strict-Transport-Security 'max-age=604800'; location / { # IP и порт, на которых висит node.js proxy_pass http://127.0.0.1:3000; } } 

Do I specify proxy_pass correctly if I start node 3000 server on node.js?

Server node code:

 var http = require('http'); http.createServer(function (req, res) { console.log('Test'); res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(3000); console.log('Server running at port 3000'); 
  • You are not listening to IP 443, but port 443.a is https traffic - Senior Pomidor
  • @SeniorPomidor, yes, I need to listen to https traffic and respond with what node.js will answer - Artem
  • First you should check dns - Alexey Ten
  • Well, redeem the server and check if the site is opening - Alexey Ten

1 answer 1

  location / { proxy_pass http://127.0.0.1:3000; proxy_redirect off; 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_pass_header Set-Cookie; } 

it should be more correct

  • I did it, there is no effect, node.js is running on port 3000, but for some reason the request does not reach it - Artem
  • Added server node code - Artem