dev_app.conf 2.11 KB
server {
    listen 80;
    server_name qy.vchangyi.org;
    root /cyphp/trunk/www;
    index index.php;

    location / {
        index index.html index.htm index.php;
        # access_log /data/wwwlogs/qy.vchangyi.com-access.log combined buffer=32k;
        if ($request_uri ~ ^/([^/]+)/([^/]+)/h5) {
            rewrite ^/([^/]+)/([^/]+)/h5 /$2/h5/index.html break;
        }
        if ($request_uri ~ ^/admincp) {
            rewrite ^/admincp /admincp/index.html break;
        }
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
            break;
        }
    }

    location ~ [^/]\.php(/|$) {
        # comment try_files $uri =404; to enable pathinfo
        try_files $uri =404;
        fastcgi_pass  php:8000;
        fastcgi_index index.php;
        include fastcgi.conf;
        #include pathinfo.conf;

        #设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量
        set $path_info "";
        set $real_script_name $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {
                set $real_script_name $1;
        }

        access_log /dev/null;
        expires 10d;
    }

    location /nginx_status {
        stub_status on;
        access_log off;
    }

#    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|thumb|xml|swf|txt|woff|ttf|eot|svg|otf|htm|html|apk|map)$ {
#            # 微信前端 h5
#            if ($request_uri ~ ^/([^/]+)/([^/]+)/h5/index.html) {
#                rewrite ^/([^/]+)/([^/]+)/h5 /$2/h5/index.html break;
#            }
#            if ($request_uri ~ ^/([^/]+)/([^/]+)/h5/index-dev.html) {
#                rewrite ^/([^/]+)/([^/]+)/h5 /$2/h5/index-dev.html break;
#            }
#            if ($request_uri ~ ^/([^/]+)/([^/]+)/h5/(.*)(jpg|jpeg|gif|css|png|js|ico|thumb|xml|swf|txt|woff|ttf|eot|svg|otf|apk)) {
#                rewrite ^/([^/]+)/([^/]+)/h5/(.*) /$2/h5/$3 break;
#            }
#            access_log /dev/null;
#            expires 10d;
#    }

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

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

}