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;
}
}

原文地址:https://www.cnblogs.com/myJuly/p/10008471.html