爱编程的欧巴

让我们成长吧~
  博客园  :: 首页  :: 新随笔  :: 订阅 订阅  :: 管理

nginx 一般网站部署常用参数设置

Posted on 2016-12-15 18:35  爱编程的欧巴  阅读(216)  评论(0编辑  收藏  举报


#user nobody;
worker_processes 2;

#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;
sendfile on;
keepalive_timeout 65;
client_max_body_size 300m;
fastcgi_buffers 8 128k;
send_timeout 3600;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css

application/xml;
gzip_vary on;
upstream server_tomcat81{
server ip:81;
}
upstream server_tomcat82{
server ip:82;
}
upstream server_tomcat83{
server ip:83;
}
server {
large_client_header_buffers 4 160k;
client_max_body_size 30m;
client_body_buffer_size 128k;
proxy_connect_timeout 30000;
proxy_read_timeout 3000;
proxy_send_timeout 3000;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
listen 80;
server_name 域名;
location / {
proxy_pass http://server_tomcat81;
index login.jsp;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}
server {
large_client_header_buffers 4 160k;
client_max_body_size 30m;
client_body_buffer_size 128k;
proxy_connect_timeout 3000;
proxy_read_timeout 3000;
proxy_send_timeout 3000;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
listen 80;
server_name 域名;
location / {
proxy_pass http://server_tomcat82;
index index.html index.htm login.jsp;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}
server {
listen 80;
large_client_header_buffers 4 160k;
client_max_body_size 30m;
client_body_buffer_size 128k;
proxy_connect_timeout 3000;
proxy_read_timeout 3000;
proxy_send_timeout 3000;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
server_name 域名;
location / {
proxy_pass http://server_tomcat83;
index index.html index.htm login.jsp;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}


}