Maison  >  Article  >  développement back-end  >  nginx 反向代理及动静分离

nginx 反向代理及动静分离

WBOY
WBOYoriginal
2016-08-08 09:24:37993parcourir

nginx 反向代理及动静分离

http { include mime types; default_type application octet-stream; tcp_nopush on; keepalive_timeout 65;upstream test{ s

http {
    include       mime.types;
    default_type  application/octet-stream;
    #tcp_nopush     on;
    keepalive_timeout  65;
upstream test{
    server 192.168.1.203:80;
    server 192.168.1.43:80;
}

    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ \.php$ {
            proxy_pass   http://test;           后面不能加/http://test/是错误的
        }
 location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)${
         root /test/web;
         expires      3d;
    }

}    


以上就介绍了nginx 反向代理及动静分离,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn