在安装nodejs, 架设nodejs http服务时,发现这个以下问题。
多次尝试安全组策略后发生,端口高于3000的http服务无法通过安全组策略,即使在安全组策略中打开所有端口也不行。
通过内网可以正常访问3000端口,但外网无法访问。
可通过ngnix代理3000端口解决。
sever{# pass the request to the node.js server with the correct headers# and much more can be added, see nginx config optionslocation /nodejs {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 http://app_timesheet/;proxy_redirect off;}}# the IP(s) on which your node server is running. I chose port 3001.upstream app_timesheet {server 127.0.0.1:3001;keepalive 8;}
发表回复