nginx基础配置
nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
client_max_body_size 20m;
#gzip on;
server {
listen 80;
server_name localhost;
location / {
root D:\xxx\public;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root D:\xxx\public;
expires 30d;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root D:\xxx\public;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
include web-other.conf;
}