微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Nginx静态文件指令问题

如何解决Nginx静态文件指令问题

您好!stackoverflow社区

我在使用静态文件运行Nginx时遇到问题

有些文件可以工作,有些则不能工作,说实话我会丢失的:)

Text

这是我的Nginx虚拟主机

server {
    listen       xx.xx.xx.xx:80;
    charset      utf-8;

    index index.PHP index.html index.htm;
    set  $root_path /home/blog/public_html;
    root $root_path;

    try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite !\.(js|ico|gif|jpg|png|css|swf)$ /index.PHP;
        rewrite \.compressed\.(js|css)$ /index.PHP?process=compress;

        rewrite ^/(.*)$ /index.PHP?$args;
    }

    location ~ \.PHP {
        fastcgi_pass unix:/var/run/PHP5-fpm.sock;

        fastcgi_index /index.PHP;

        include fastcgi_params;

        fastcgi_split_path_info       ^(.+\.PHP)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ ^/(css|img|images|js|gif|flv|swf|download)/(.+)$ {
        root $root_path;
    }

    location ~*"/(ajax|_www)/[a-zA-Z0-9_]{0,30}\.PHP$" {
    }

    location ~ /\.ht {
        deny all;
    }

    client_max_body_size 9M;

    include common/tunning;
    include common/suppress_logs;
}

能帮我解决这些指令吗? 非常感谢你

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。