在本地使用nginx搭建phpdish的配置文件
2018-07-31 本文已影响5人
豆瓣奶茶
server {
server_name localhost 127.0.0.1;
root /var/www/phpdish/web;
location ~ ^/app\.php(/|$) {
# linux 用户首选这个,注意sock文件位置是否准确
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
internal;
}
location / {
try_files $uri /app.php$is_args$args;
}
# set site favicon
location /favicon.ico {
root /var/www/phpdish/web;
}
error_log /var/log/nginx/symfony_error.log;
access_log /var/log/nginx/symfony_access.log;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
if (-f $request_filename) {
expires 0d;
access_log off;
}
try_files $uri @phpdish;
}
# 静态文件缓存七天
location ~ .*\.(js|css)?$ {
expires 0d;
access_log off;
}
location ~ /\.ht {
deny all;
}
location @phpdish {
rewrite ^(.*)$ /app.php/$1 last;
}
}