Я настроил nginx в качестве обратного прокси-сервера и балансировщика нагрузки на сервере, а на другом сервере запущено веб-приложение. Когда я получаю доступ к publi c URL-адресу nginx, он отображает страницу по умолчанию RHEL вместо домашней страницы приложения на удаленном сервере. Кроме того, когда я добавляю путь в IP-адрес nginx, он перенаправляет меня на IP-адрес сервера приложений в браузере, а не на тот же сервер nginx. Я хочу, чтобы IP-адрес был таким же, как у nginx сервера.
Пример:
Nginx IP : 52.2.2.2
Remote Ip : 52.2.2.3
Browser
http://52.2.2.2/admin_portal
IP changes in Broswer
http://52.2.2.3/admin_portal
Ниже приведены мои настройки: /etc/nginx/conf.d/load_balancer.conf
upstream backend {
server 10.128.0.2;
}
# This server accepts all traffic to port 80 and passes it to the upstream.
# Notice that the upstream name and the proxy_pass need to match.
server {
listen 80;
listen [::]:80;
location / {
proxy_pass http://backend;
}
}
Мой Nginx файл конфигурации /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
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;
}
Может кто-нибудь, пожалуйста, помогите мне