- 论坛徽章:
- 0
|
user www www;
worker_processes 2;
error_log /usr/local/www/logs/nginx_error.log crit;
pid /usr/local/www/logs/nginx.pid;
worker_rlimit_nofile 51200;
events {
use kqueue;
worker_connections 51200;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
client_max_body_size 2m;
large_client_header_buffers 4 32k;
sendfile on;
tcp_nopush on;
keepalive_timeout 3;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
upstream varnishd {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name xxx.com;
location / {
index index.html index.htm index.php;
root /usr/local/www/xxx.com;
}
location ~ \.(png|jpg|gif|bmp|swf)$ {
proxy_pass http://varnishd;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_hander X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 60;
proxy_buffer_size 16k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/xxx.com$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/NginxStatus/ {
stub_status on;
access_log off;
}
location ~ /\.ht {
deny all;
}
}
}
|
上面就是添加了varnishd, 运行在127.0.0.1:8080
还有一个问题就是设置下面时,图片也不会显示,其他什么都能正常显示就是图片不显示
location ~ \.(png|gif|jpg)$ {
access_log off;
} |
|