咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
1.nginx/conf目录中创建文件proxy.conf以方便在建立站点的时候引用
proxy_connect_timeout 300s;
proxy_send_timeout 900;
proxy_read_timeout 500;
proxy_buffer_size 32k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_redirect off;
proxy_hide_header Vary;
proxy_set_header Accept-Encoding '';
proxy_set_header host $host;
proxy_set_header Referer $http_referer;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
expires 10d;
2.建立站点
server{
listen 80;
#listen [::]:80;
server_name www.landui.com website.com;
index index.html index.htm index.php default.html default.htm default.php index.asp default.asp;
location / {
#ModSecurityEnabled off;
#ModSecurityConfig modsecurity.conf;
}
location ~ .*.(php)(.*){
proxy_pass http://www.landui.com;
include /etc/nginx/proxy.d/proxy.conf;
}
location ~ .*.(asp)(.*){
proxy_pass http://www.landui.com;
include /etc/nginx/proxy.d/proxy.conf;
}
location ~ .*.(gif|jpg|png|htm|html|css|js|flv|ico|swf)(.*) {
#include cache.conf;
proxy_pass http://www.landui.com ;
include /etc/nginx/proxy.d/proxy.conf;
}
}
注:代理只是一个中介服务,归根揭底还是要被代理的服务能正常访问还要代理的服务配置正确