1 Star 0 Fork 0

estherzxx/restkeeper-super

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
nginx.conf 6.69 KB
一键复制 编辑 原始数据 按行查看 历史
nianqiang-it 提交于 2021-08-09 14:53 . 切换为测试环境
#运行用户
user root;
#启动进程,通常设置成和cpu的数量相等(但是又时候也不光与cpu有关)
worker_processes 8;
#系统在单个进程中打开文件的个数
worker_rlimit_nofile 30000;
#全局错误日志及PID文件
pid logs/nginx.pid;
#工作模式及连接数上限
events {
use epoll; #epoll是多路复用IO(I/O Multiplexing)中的一种方式,但是仅用于linux2.6以上内核,可以大大提高nginx的性能
worker_connections 5000;#单个后台worker process进程的最大并发链接数
#multi_accept on;
}
#设定http服务器,利用它的反向代理功能提供负载均衡支持
http {
include mime.types;
#反向代理配置,可以打开proxy.conf看看
include proxy.conf;
#设定mime类型,类型由mime.type文件定义
#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"';
#sendfile 指令指定 nginx 是否调用 sendfile 函数(zero copy 方式)来输出文件,对于普通应用,
#必须设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为 off,以平衡磁盘与网络I/O处理速度,降低系统的uptime.
sendfile on;
#连接超时时间
keepalive_timeout 120;
tcp_nodelay on;
tcp_nopush on;
#开启gzip压缩
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_disable "MSIE [1-6]\.";
gzip_comp_level 3;
gzip_vary on;
#站点:运营平台
upstream operator{
server 192.168.200.129:8011 weight=2 max_fails=2 fail_timeout=30s;
}
#站点:商家平台
upstream shop{
server 192.168.200.129:8017 weight=2 max_fails=2 fail_timeout=30s;
}
#站点:点餐平台
upstream dc{
server 192.168.200.129:8017 weight=2 max_fails=2 fail_timeout=30s;
}
server {
#侦听80端口
listen 80;
#定义使用www.xx.com访问
server_name www.eehp.cn;
#访问日志
access_log logs/operator_project.log main;
#错误日志
error_log logs/operator_error_project.log;
#定义错误提示页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
internal;
}
location / {
root /home/operator;
try_files $uri $uri/ /index.html;
index index.html;
}
location /security {
root /;
proxy_pass http://operator;
}
location /basic {
root /;
proxy_pass http://operator;
}
location /operator {
root /;
proxy_pass http://operator;
}
location /doc {
root /;
proxy_pass http://operator;
}
location /webjars {
root /;
proxy_pass http://operator;
}
location /swagger-resources {
root /;
proxy_pass http://operator;
}
#设定查看Nginx状态的地址
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file conf/htpasswd;
}
}
server {
#侦听80端口
listen 80;
#定义使用*.eehp.cn访问
server_name *.shop.eehp.cn ;
#访问日志
access_log logs/shop_access_project.log main;
#错误日志
error_log logs/shop_error_project.log;
#定义错误提示页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
internal;
}
location / {
root /home/shop;
try_files $uri $uri/ /index.html;
index index.html;
}
location /trading {
root /;
proxy_pass http://shop;
}
location /shop {
root /;
proxy_pass http://shop;
}
location /security {
root /;
proxy_pass http://shop;
}
location /basic {
root /;
proxy_pass http://shop;
}
location /operator {
root /;
proxy_pass http://shop;
}
location /doc {
root /;
proxy_pass http://shop;
}
location /webjars {
root /;
proxy_pass http://shop;
}
location /swagger-resources {
root /;
proxy_pass http://shop;
}
#设定查看Nginx状态的地址
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file conf/htpasswd;
}
}
server {
#侦听80端口
listen 80;
#定义使用*.eehp.cn访问
server_name *.dc.eehp.cn ;
#访问日志
access_log logs/shop_access_project.log main;
#错误日志
error_log logs/shop_error_project.log;
#定义错误提示页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
internal;
}
location / {
root /home/dc;
try_files $uri $uri/ /index.html;
index index.html;
}
location /trading {
root /;
proxy_pass http://dc;
}
location /shop {
root /;
proxy_pass http://dc;
}
location /security {
root /;
proxy_pass http://dc;
}
location /basic {
root /;
proxy_pass http://dc;
}
location /operator {
root /;
proxy_pass http://dc;
}
location /doc {
root /;
proxy_pass http://dc;
}
location /webjars {
root /;
proxy_pass http://dc;
}
location /swagger-resources {
root /;
proxy_pass http://dc;
}
#设定查看Nginx状态的地址
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file conf/htpasswd;
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/estherzxx/restkeeper-super.git
git@gitee.com:estherzxx/restkeeper-super.git
estherzxx
restkeeper-super
restkeeper-super
master

搜索帮助