lzf79 发表于 2016-12-24 11:03:01

nginx与node结合配置

#usernobody;
#工作的子进程数量(通常等于CPU数量或者2倍于CPU)
worker_processes2;

pid      logs/nginx.pid;

events {
worker_connections1024;
}

http {
include       mime.types;
default_typeapplication/octet-stream;
#定义日志格式
#log_formatmain'$remote_addr - $remote_user [$time_local] $request '
#                  '"$status" $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';
#access_logoff;
access_loglogs/access.log;
client_header_timeout3m;
client_body_timeout    3m;
send_timeout         3m;
client_header_buffer_size    1k;
large_client_header_buffers4 4k;
sendfile      on;
tcp_nopush      on;
tcp_nodelay   on;
#keepalive_timeout75 20;

server {
listen       80;
server_namelocalhost;
#静态文件根目录所在路径
root E:/xxx/webroot;
index index;
location / {
proxy_connect_timeout   3;
proxy_send_timeout      30;
proxy_read_timeout      30;
#动态请求则转给http://127.0.0.1:3000/处理
proxy_pass http://127.0.0.1:3000/;
}
location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ico|rar|zip|txt|flv|mid|doc|docx|ppt|pdf|xls|xlsx|mp3|wma)$ {   #设置静态网页直接由nginx进行处理
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1h;
}
}

}
页: [1]
查看完整版本: nginx与node结合配置