windows本地配置域名和nginx代理


1. 配置本機的DNS

C:\Windows\System32\drivers\etc\hosts 末行添加

127.0.0.1 jay.localhost.com

可以直接訪問 http://jay.localhost.com:8080/相當於直接訪問 http://localhost:8080/

 

2. 可以nginx去代理端口號

upstream jay.localhost.com{

       server 127.0.0.1:8080;
    }

   server {

     listen 80;

     server_name jay.localhost.com;

     location / {

        proxy_pass http://jay.localhost.com;

        proxy_set_header X-forwarded-for $proxy_add_x_forwarded_for;

     }

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM