nginx alias 示例配置

来源:互联网 发布:淘宝上微信解封 编辑:程序博客网 时间:2024/05/21 00:52

此配置是在lnmp 一键安装包运行:

server

    {
        listen 80;
        #listen [::]:80 default_server ipv6only=on;
        server_name test.com;
        root  /opt/weixing;


        #error_page   404   /404.html;


        location /
        {
            index index.html index.htm index.php;
            include enable-php.conf;
            location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      -1;
                break;
            }
            location ~ .*\.(js|css)?$
            {
                expires      -1;
                break;
            }
            if (-f $request_filename) {
                expires max;
                break;
            }
            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?$1  last;
                break;
            }
        }


        location /bugfree
        {
            index index.html index.htm index.php;
            alias /opt/zentaopms/www/;
            include enable-php2.conf;
            location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      -1;
                break;
            }
            location ~ .*\.(js|css)?$
            {
                expires      -1;
                break;
            }
        }
        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }




        location ~ /\.
        {
            deny all;
        }