worker_processes 8;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 655355;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
send_timeout 10000;
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 0;
# keepalive_timeout 300;
server_names_hash_bucket_size 128;
client_header_buffer_size 212k;
large_client_header_buffers 8 64k;
client_max_body_size 10m;
fastcgi_connect_timeout 1000;
fastcgi_send_timeout 500;
fastcgi_read_timeout 500;
fastcgi_buffer_size 64k;
fastcgi_buffers 16 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
#gzip on;
gzip on;
gzip_min_length 1k;
gzip_buffers 8 32k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
include vhosts/*.conf;
}
# server {
listen 80;
server_name ;
index index.php index.html;
root /opt/b2c/web/com/domain/;
access_log /opt/b2c/logs/nginx/domain.access;
error_log /opt/b2c/logs/nginx/domain.errors;
include /opt/b2c/web/com/domain/rewrite.conf;
location ~* .(jpg|gif|png|js|css)$ {
if (-f $request_filename) {
expires 24h;
break;
}
}
location /webmaster/ {
alias /opt/b2c/web/webmaster/;
}
location ~ ^/webmaster/.+\.php$ {
root /opt/b2c/web/webmaster;
rewrite /webmaster/(.*\.php)$ /$1 break;
include fcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /opt/b2c/web/webmaster/$fastcgi_script_name;
}
location /status {
stub_status on;
}
#location /blog {
# try_files $uri $uri/ /blog/index.php?q=$uri&$args;
#}
location ~* .(php|php5)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
}
代理设置
server {
listen 80;
server_name domain;
index index.php index.html;
root /opt/b2c/web/com/domain/;
access_log /opt/b2c/logs/nginx/domain.access;
error_log /opt/b2c/logs/nginx/domain.errors;
include /opt/b2c/web/com/domain/rewrite.conf;
location ~* .(jpg|gif|png|js|css)$ {
if (-f $request_filename) {
expires 24h;
break;
}
}
location ~* .(php|php5)$ {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffer_size 100k;
proxy_buffers 4 100k;
proxy_pass ;
}
}
阅读(560) | 评论(0) | 转发(0) |