'I want to set proxy pass on ec2 centos nginx server
I need to configure nginx proxy pass on of localhost:4000 to domain/front and and localhost:3000 want to pass on domain/dev.
I have added the IP on godaddy and domain is working fine.
server {
listen 80;
#listen [::]:80;
server_name domain.com;
# server_name _;
root /usr/share/nginx/html;
include /etc/nginx/default.d/*.conf;
location / {
#proxy_pass http://localhost:4000;
proxy_pass domain.com:4000/api;
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;
}
location /api/ {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000/;
}
# Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /404.html {
}
}
I have tried with multiple things with proxy_set_header, with ec2 IP only but not working.
Can someone help me in that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
