Reputation: 61
Yes i have configured the inbout / outbound policy for port 8090
NGINX IP :- 51.122.71.253 (sample IP)
EC2 INSTANCE 1 IP :- 5x.18x.8x.24x
The Problem:
I am unable to get http://51.122.71.253/socket.io/socket.io.js from my local machine via NGINX.
But i can access the file from EC2 instance 1 directly http://5x.18x.8x.24x:8090/socket.io/socket.io.js
Same setup with same NGINX.conf is working in our local LAN. Is there any special trick with the EC2 for port 80?
Configuration File
http
{
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
map $http_upgrade $connection_upgrade
{
default upgrade;
'' close;
}
upstream node_server
{
ip_hash;
server 5x.18x.8x.24x:8090;
}
server
{
listen 80;
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_redirect off;
proxy_read_timeout 3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://node_server;
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 400M;
sendfile on;
send_timeout 300s;
}
}
What we are trying to achieve:-
Actually on our client Side Network all the ports Except 80 is blocked , so we are trying NGINX as proxy to redirect socket connection from port 80 to our port 8090.
(Client Machine) -> (NGINX PROXY) -> (EC2 INSTANCE NODEJS SERVER RUNINNG @ 8090)
Upvotes: 1
Views: 709
Reputation: 61
I have solved the problem. You have to change the port from 80 to any other port in the /etc/nginx/conf.d/default.conf.
I have changed the port to 81.
server {
listen 81;
server_name localhost;
Then please restart the NGINX and it will work.
Upvotes: 1