Laravel项目nginx简单配置

下面的是一个nginx配置示例:

server
    {
        listen 80;
        #listen [::]:80;
        server_name example.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /your/project/path/public;

        include rewrite/none.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include enable-php-pathinfo.conf;

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

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

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

        location ~ /\.
        {
            deny all;
        }
try_files $uri $uri/ /index.php?$query_string;
        access_log  /home/wwwlogs/example.com.log;
    }

2cf92c96-1b70-8a90-e863-4c31b4c29ef6

本作品采用 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议 (CC BY-NC-ND 4.0) 进行许可。