代码拉取完成,页面将自动刷新
#运行用户
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.112.77:8011 weight=2 max_fails=2 fail_timeout=30s;
}
#站点:商家平台
upstream shop{
server 192.168.112.77:8017 weight=2 max_fails=2 fail_timeout=30s;
}
#站点:点餐平台
upstream dc{
server 192.168.112.77: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;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。