Nginx Alias 无法解析PHP的解决办法

Nginx Alias 无法解析PHP的解决办法:

server {
        listen       80;
        server_name  xxxx.com.cn;


        error_log  /tmp/eror.log;
        set $www_root /home/web/yqbb/bgskk;


        location / {
            root   $www_root;
            index  index.html index.php;
        }


        location /feedback {
            index  index.php;
            alias /home/web/yqbb/bgskk/app/htdocs;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


        location ~ ^/feedback/.+\.php$ {
                root /home/web/yqbb/bgskk/app/htdocs;
                rewrite /feedback/(.*\.php?) /$1 break;
                include fastcgi.conf;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param SCRIPT_FILENAME /home/web/yqbb/bgskk/app/htdocs/$fastcgi_script_name;
        }


        location ~ .*\.(php|php5)?$ {
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
        }


    }


 

 

        location /public/  #设定要重写的目录名
        {
                alias /var/www/public/; #重定向目的目录。

#start


        location ~ ^/public/.+\.php$
        {
                root /var/www/html/web/news/public;
                rewrite /public/(.*\.php?) /$1 break;
                include fastcgi.conf;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
        }

#end


        location ~ .*\.(php|php5)?$
        {
            #fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            #include fcgi.conf;
            include fastcgi.conf;
            rewrite  ^/([a-zA-Z]+)\/([a-zA-Z]+)$ /$2.shtml last;
        }

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

        location ~ .*\.(js|css)?$
        {
            expires      1h; #缓存1个小时
        }

        access_log  /var/log/linuxidc.log  access;  #定义日志文件
        ssi on;
        ssi_silent_errors on;
        ssi_types text/shtml;
    }

相关推荐