# 最大客户端连接数由worker_processes和worker_connections决定,
# 即Max_clients=worker_processes*worker_connections,
# 在作为反向代理时,Max_clients变为:Max_clients = worker_processes * worker_connections/4。
# 进程的最大连接数受Linux系统进程的最大打开文件数限制,在执行操作系统命令“ulimit -n 65536”后worker_connections的设置才能生效。
#原文链接:https://blog.csdn.net/qq_35448976/article/details/79512746
# 工作进程数: 默认1,最大(双核4线程,可以设置为4)
worker_processes 1;
# https://blog.csdn.net/qq_35448976/article/details/79512746
# events模块来用指定nginx的工作模式和工作模式及连接数上限
events {
# worker_connections用于定义Nginx每个进程的最大连接数,即接收前端的最大请求数,默认是1024。
// https://blog.csdn.net/zhuyu19911016520/article/details/90714429
worker_connections 1024;
}
# 配置http代理
http {
# 设置浏览器处理服务器传给浏览器的文件的方式;(default_type application/octet-stream; 默认方式为下载)
include mime.types;
# 比如Nginx默认的配置中default_type application/octet-stream;
# 这个就是默认为下载,浏览器访问到未定义的扩展名的时候,就默认为下载该文件;
# 如果将这个设置改成default_type text/html;那就是告诉浏览器默认的打开方式是把所有未设置的扩展名当HTML文件打开,
# 虽然可能这样设置会很多打不开。
default_type application/octet-stream;
# 设置 http 接收和发送文件 开
sendfile on;
# 设置 http 连接超时时间 65s
keepalive_timeout 65;
server {
# 代理前端的端口号
listen 9991;
# 代理的服务器名称
server_name localhost;
# 正向代理"/"路径和相关配置
location / {
# 当指定/时, 指向/data/qes-app/portal/build 目录;
root /data/qes-app/portal/build;
# 具体入口文件
# try_files $uri $uri/ /index.html # 用于配置代理所有url,不管输入什么url,都现到index.html文件;
index index.html index.htm;
# header 配置、缓存控制
add_header Cache-Control no-store;
}
# 反向代理(http://10.97.8.228:8111) 到"/mqm/"路径和相关配置
location /mqm/ {
# 当指定/mqm/时,连接到指定pass,(http://10.97.8.228:8111);
proxy_pass http://10.97.8.228:8111;
}
# 反向代理"/sqm-web/"路径和相关配置
location /sqm-web/ {
proxy_pass http://10.97.8.228:8088/;
}
# 50x页面放到本地单独目录下,进行显示
error_page 500 502 503 504 /50x.html;
# = 表示完全一致
# 精确location:匹配到文件名的,如 /first/second/file.html
location = /50x.html {
root html;
}
}
}
nginx 配置
最新推荐文章于 2024-02-04 14:14:05 发布