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     >>   ngnix proxy Ip     >>   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 ##
upstream httpweb  {
      server; # cPanel server

## Start ##
server {

    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;

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


This makes no sense:     >>   ngnix proxy Ip     >>   ngin proxy ip

What are you trying to do? Please explain from start to end, without any configurations, just in words.