nginx 基本配置

server {
listen 80;
server_name 域名;
#access_log /var/log/nginx/admin.log;
index index.html index.htm index.php;
root 项目路径;
if ( $query_string ~* ".*[\;'\<\>].*" ){
return 404;
}

location / {
try_files $uri $uri/ /index.php;
}

location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

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

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

posted @ 2018-11-23 16:45  Kris-Q  阅读(122)  评论(0编辑  收藏  举报