美文网首页
nginx开启反向代理的例子

nginx开启反向代理的例子

作者: softfc | 来源:发表于2018-10-29 15:23 被阅读16次

nginx 启动php示例

server {
        listen       80;
        server_name  xxx.localhost;
        root /usr/local/var/www/xxxx;

        location / {
                autoindex on;
                index  index.html index.htm index.php;
        }


        location ~ \.php$ {
#root           html;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;
                include        fastcgi_params;
                fastcgi_intercept_errors on;

        }

        if ( !-e $request_filename ){
                rewrite ^/(.*)$ /index.php?s=/$1 last;
        }

}


nginx开启反向代理的例子


server {
        listen       80;
        server_name  xxx.localhost;
        root /usr/local/var/www/xxxx;

        location / {
                autoindex on;
                index  index.html index.htm;
        }

        location /api {
                rewrite  /api/?(.*)$ /$1 break;
                include  uwsgi_params;
                proxy_pass   http://xxxx.com;
       }

    #if ( !-e $request_filename ){
    #        rewrite ^/(.*)$ /index.php?s=/$1 last;
    #}

}

相关文章

网友评论

      本文标题:nginx开启反向代理的例子

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