lnmp一键包的thinkphp5 nginx配置分享

浏览:2958 发布日期:2017/06/22 分类:ThinkPHP5专区 关键字: nginx lnmp
分享一下自己的配置再基础上稍微加了点代码server
    {
        listen 80 default_server;
        #listen [::]:80 default_server ipv6only=on;
        server_name _;
        index index.html index.htm index.php;
        root  /home/wwwroot/default;

        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
        
        location /
        {
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            if (!-d $request_filename){
                set $rule_0 1$rule_0;
            }
            if (!-f $request_filename){
                set $rule_0 2$rule_0;
            }
            if ($rule_0 = "21"){
                rewrite ^/(.*)$ /index.php/$1 last;
            }
            include pathinfo.conf;
        }
        
        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }

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

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

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/access.log;
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>