Home  >  Q&A  >  body text

When the nginx user enters aaa.com/xyz, the page opened is the bbb.com/xyz page.

There is no xyz directory on my website. After entering xyz, I access the xyz directory of another website, but the domain name on the browser is still my domain name. Can it be set in nginx? Thanks

迷茫迷茫2712 days ago870

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:27:35

    server {  
        listen 80;
        server_name     aaa.com;  
        # 下面这个就是路径代理了
        location ^~ /xyz/ {  
                proxy_pass http://xxx.com;  
                proxy_redirect off;  
        }  
    
        location ^~ / {  
                root   /var/www/xxxx;  
                index  index.html;  
        }  
       } 
    

    reply
    0
  • Cancelreply