[Laravel] Linux下nginx配置

浏览: 171 发布日期: 2016-12-02 分类: nginx
#file location: /etc/nginx/sites-enabled
#PHP7
server {
    listen 80;

    root /var/www/laravel/public;
    index index.php index.html index.htm;

    server_name laravel *.laravel;
    charset   utf-8;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
        #try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        #try_files \$uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)\$;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }

}

sudo service nginx reload

返回顶部