负载均衡+重定向

upstream orderhelper.lanhaitools.com{ 

     server 222.222.45.138:8001; 

     server 222.222.45.138:8002; 

 } 

 server {

 listen 80 ; 

 root /data/website/orderhelper.lanhaitools.com/wwwroot; 

 index index.php; 

 server_name orderhelper.lanhaitools.com; 

 location / { 

 #try_files $uri $uri/ =404;

 try_files $uri $uri/ /index.php; 

 proxy_pass http://orderhelper.lanhaitools.com;

 } 

#有负载均衡时  下边这注释 否则会直接访问主机

 #location ~ \.php$ { 

 # include snippets/fastcgi-php.conf; 

 # fastcgi_pass unix:/run/php/php7.0-fpm.sock; 

 #} 

#重定向配置

 # location / { 

 # proxy_set_header Host $host;

 # proxy_set_header X-Real-Ip $remote_addr; 

 # proxy_set_header X-Forwarded-For $remote_addr;

 # proxy_pass http://222.222.45.138:8001/; 

 # }

 }

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容