美文网首页
Nginx相关配置

Nginx相关配置

作者: Playbob | 来源:发表于2018-07-13 11:23 被阅读7次
整理了Nginx的一些相关配置,有需要配置的时候可以方便查看一下
1、使用同一个端口配置多个站点
server {
   listen 8080;
   server_name localhost;

   location / {
       root html;
       index index.html index.htm;
   }

  #加下面的配置 
   location /baidu{
       proxy_pass http://localhost:8081/bob/;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       client_max_body_size 100m;
       root html;
       index index.html index.htm;
   }

   location /taobao{
       proxy_pass http://localhost:8082/;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       client_max_body_size 100m;
       root html;
       index index.html index.htm;
   }
 }

相关文章

网友评论

      本文标题:Nginx相关配置

      本文链接:https://www.haomeiwen.com/subject/ycdjpftx.html