Nginx转发配置

Nginx转发配置

# upstream web1{
#                server 172.18.54.3:9201 weight=9;
#                #tp需要重写路由,本机项目另外起个服务
#                server 127.0.0.1:9201    weight=1;
#}
server
    {
        listen 80;
        #listen [::]:80;
        server_name lapuapi.ilapu.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/20201114lapu/lapu;
     deny 120.239.72.233;
    #转发红包模块and用户详情
    location ~* .php/Api/(GiftApi|UserApi)/(give_gift_p|click_gift_v1|gift_is_finished|send_gift_exclusive|get_exclusive_gift){
                # proxy_pass http://127.0.0.1:9501;
                # proxy_pass http://127.0.0.1:9201;
                proxy_pass http://test.up;
                client_max_body_size 1000m;

        }
    #转发红包模块and用户详情
    location ~* ^/Api/(GiftApi|UserApi)/(give_gift_p|click_gift_v1|gift_is_finished|send_gift_exclusive|get_exclusive_gift|test){
               #proxy_pass http://127.0.0.1:9501;
               #proxy_pass http://127.0.0.1:9201;
               proxy_pass http://test.up;
               client_max_body_size 1000m;

        }
    #支付模块接口暂时保留到本机
    #location ~* .php/Api/(NcountPay|UserVerifyApi)/{
    #    proxy_pass http://127.0.0.1:9201;
    #    client_max_body_size 1000m;
    #}
    #location ~* ^/Api/(NcountPay|UserVerifyApi)/{
    #    proxy_pass http://127.0.0.1:9201;
        #        client_max_body_size 1000m;
    #}
    #回调
    #location ~* .php/Core/{
    #    proxy_pass http://127.0.0.1:9201;
        #        client_max_body_size 1000m;
    #}
    #location ~* ^/Core/{
        #        proxy_pass http://127.0.0.1:9201;
        #        client_max_body_size 1000m;
        #} 
    #绑卡|提现
    #location ~* .php/Api/UserApi/(BindingCard|BindingCardConfirm|withdrawCash){
    #    proxy_pass http://127.0.0.1:9201;
        #        client_max_body_size 1000m;
    
    #}
    #location ~* ^/Api/UserApi/(BindingCard|BindingCardConfirm|withdrawCash){
    #    proxy_pass http://127.0.0.1:9201;
        #        client_max_body_size 1000m;
    #}
    #转发文件目录
    #实现负载均衡
    #location ~* .php/Api/{
    #    proxy_next_upstream error timeout http_404;
    #    proxy_pass http://web1;
    #}
    #location ~* ^/Api/{
    #    proxy_next_upstream error timeout http_404;
        #         proxy_pass http://web1;
    #}

    #注意,因把服务转发到9201,所以不采用tp的重写路由跳转
        include rewrite/thinkphp.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*.php$ { deny all; }




        include enable-php-pathinfo.conf;
    


    


        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires     30d;
        }

        location ~ .*.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }
    
        location ~ /.
        {
            deny all;
        }

        access_log  /home/wwwlogs/giftapi.ilapu.com.log;
    }
#  root  /home/wwwroot/lapuTP5/public;

server
    {
        listen 80;
        #listen [::]:80;
        server_name test.up;
        index index.html index.htm index.php default.html default.htm default.php;
        #root   /home/wwwroot/lapuTP5;
        root   /home/wwwroot/laputp5/public;
        #root   /home/wwwroot/20201114lapu/lapu;

	    #注意,因把服务转发到9201,所以不采用tp的重写路由跳转
        include rewrite/thinkphp.conf;
        #include rewrite/codeigniter.conf;

        include enable-php-pathinfo.conf;
	

        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires     30d;
        }

        location ~ .*.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }
	
        location ~ /.
        {
            deny all;
        }

        access_log  /home/wwwlogs/test.up.log;
    }
::1    localhost    localhost.localdomain    localhost6    localhost6.localdomain6
127.0.0.1    localhost    localhost.localdomain    localhost4    localhost4.localdomain4

172.18.54.2    iZwz9fahlffrq9zl6amcjsZ    iZwz9fahlffrq9zl6amcjsZ
127.0.0.1       gqodbynudtp.ilapu.com
127.0.0.1       test.up
原文地址:https://www.cnblogs.com/ccw869476711/p/14100622.html