nginx 配置参数详解


[root@WEBServer10414 ~]# cat /etc/nginx/nginx.conf

#user nobody;#定义nginx运行的用户和用户组
user root;
worker_processes 8;#nginx进程数,建议设置为等于CPU总核心数

#error_log logs/error.log;#错误日志路径
#error_log logs/error.log notice;#错误日志类型,如[debug | info | notice | warn | error | crit ]
#error_log logs/error.log info;错误日志类型

#pid logs/nginx.pid;#进程文件

worker_rlimit_nofile 51200;#一个nginx进程打开的最多文件描述符数目,理论值应该是最多打开文件数(系统的值ulimit)

events {#工作模式与连接数上限
use epoll;#参考事件模型[ kqueue | rtsig | epoll | /dev/poll | select | poll ];
worker_connections 51200;#单个进程最大连接数
}

http {#设定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”‘;

#access_log logs/access.log main;

sendfile on;#开启高效文件传输模式
#tcp_nopush on;#防止网络阻塞

#keepalive_timeout 0;
keepalive_timeout 120;#长连接超时时间,单位是秒

upstream backend {#upstream的负载均衡,
ip_hash;#使用ip_hash的算法
server 50.50.50.16:8020;#realserver的IP和端口号
server 50.50.50.13:8020;#realserver的IP和端口号
}

#gzip on;#开启gzip压缩输出

server { #虚拟主机的配置
listen 8080; #虚拟主机监听的端口号
server_name WEBServer10414; #虚拟主机的域名或主机名
if ( $host ~* “d+.d+.d+.d+” ) {
return 400;
}

charset utf-8;默认编码

#access_log logs/host.access.log main;#定义本虚拟主机的访问日志

location / {#对“/”启用反向代理
# root html;
index index.jsp index.html index.htm; #可以识别的索引文件的类型
proxy_set_header Host $host:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Port $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;#后端的Web服务器可以通过X-Forwarded-For获取用户真实IP
proxy_pass http://backend;

proxy_buffer_size 64k;#设置代理服务器(nginx)保存用户头信息的缓冲区大小
proxy_buffers 64 128k;#proxy_buffers缓冲区
proxy_busy_buffers_size 256k;#高负荷下缓冲大小(proxy_buffers * 2)
proxy_temp_file_write_size 256k;#设定缓存文件夹大小,将从upstream服务器传
}

location /nstatus {#设定查看nginx状态的地址
check_status;
access_log off;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache’s document root
# concurs with nginx’s one
#
#location ~ /.ht {
# deny all;
#}
}

upstream backend1 {
ip_hash;
server 50.50.50.16:8030;
server 50.50.50.13:8030;
}
server {
listen 8090;
server_name WEBServer10414;

charset utf-8;
location /stsadmin-cm/ {
index index.jsp index.htm index.html;
proxy_pass http://backend1/stsadmin-cm/;
proxy_redirect default;
proxy_buffer_size 16k;
proxy_buffers 16 128k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias anoth开发云主机域名er.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}

# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

相关推荐: Skype for Business Client 2016 受限的外部呼叫

这几天客户的Skype for Business Client 2016 客户端右下角出现了受限制的外开发云主机域名部呼叫,任务栏中的Skype 图标出现红叹号,点开出现如下错误:造成此问题的可能原因:解决方法:问题解决。相关推荐: Active Direct…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 03/30 14:38
下一篇 03/30 14:38