Question
How to send request to proxy pass url based on server name in nginx
i configure ngnix proxy with ip and use it ip . its working perfect
but when i try to use in name server then its not working
after lot of searching i am finding something but same issue
Problem is i want to use like it
ns1.domainname.com >> ngnix proxy Ip
ns2.domainname.com >> ngin proxy ip
here is my configure which i use to set ip.. Please give me configure which i use and set name servers
## Basic reverse proxy server ##
## HTTP backend for www.example.com ##
upstream httpweb {
server 5.135.175.213:80; # cPanel server
}
## Start www.example.com ##
server {
listen 185.144.31.177:80;
server_name www.example.com;
access_log /var/log/nginx/log/www.example.access.log main;
error_log /var/log/nginx/log/www.example.error.log;
root /usr/share/nginx/html;
index index.html index.htm;
## send request back to apache1 ##
location / {
proxy_pass http://httpweb;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×