ng配置301及反向代理示例

server {
    listen 80;
    server_name fpb.com;
    return 301  http://www.fpb.com$request_uri;
}

 
server
    {
        listen 80;
        #listen [::]:80;
        server_name www.fpb.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/www.fpb.com;

        include dedecms.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.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 off;
    }

server {
        listen       80;
        server_name  m.fpb.com;
        
        location / {
               root  ../a;
            proxy_pass   http://www.fpb.com/m/;
        }
        #error_page   500 502 503 504  /50x.html;
    }


server {
        listen       80;
        server_name  zg.fpb.com;
        
        location /templets/{
            proxy_pass   http://www.fpb.com/templets/;
        }

        location /a/{
            proxy_pass   http://www.fpb.com/a/;
        }

        location /uploads/{
            proxy_pass   http://www.fpb.com/uploads/;
        }
        location / {
            proxy_pass   http://www.fpb.com/a/;
        }
        #error_page   500 502 503 504  /50x.html;
    }
 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章