We built a web server (Port: 9000) with node.js in Ubuntu with EC2 of AWS.
Elastic IP is domain connected to route 53 solution. http://XXX.XXX.XXX.XXX -> Access the node.js web application.
And to build a proxy server,
After installing nginx on Ubuntu
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:9000/;
proxy_redirect off;
}
log_not_found off;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length 1000;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
}
Created nginx.conf file.
If you restart nginx and node.js and try to connect to example.com, the index page in nginx is output. So when I went to example.com:9000, I saw the node.js web application page.
I don't think the nginx.conf setting is a problem or it doesn't work.
ubuntu proxy nginx node.js
Try removing the server_name
entry from the settings below.
The server {}
block applies only to requests that have entered the domain with that setting.
Try removing /
after port 9000.
listen 80;
# # server_name example.com www.example.com;
proxy_pass http://127.0.0.1:9000;
© 2024 OneMinuteCode. All rights reserved.