@liruiyi962464
2024-09-18T23:33:16.000000Z
字数 8548
阅读 62
代码
user root;
worker_processes 1;
#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;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
server_tokens off;
#gzip on;
upstream jeecg-boot_server{
server 202.207.122.52:8080;
}
server {
listen 13000;
server_name localhost;
client_max_body_size 20m;
#添加头部信息
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-real-ip $remote_addr;
location ~* /.+jmreport.+ {
# 使用if指令和=403来拒绝访问
if ($request_uri ~* "jmreport") {
return 403;
}
}
location /yunwei/ {
rewrite ^/(.*)/yunwei/yunwei(.*)$ /$1/yunwei$2 last;
proxy_set_header Host $Host;
proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://jeecg-boot_server;
}
location / {
rewrite ^/(.*)/yunwei/yunwei(.*)$ /$1/yunwei$2 last;
root /home/web/deploy/yunwei;
index index.html index.htm;
}
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
#user nobody;
worker_processes 1;
#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 {
# ...
# 设置连接超时时间为30秒
fastcgi_connect_timeout 600s;
# 设置请求超时时间为60秒
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
client_body_timeout 600s;
client_header_timeout 600s;
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
server {
listen 3031;
server_name localhost;
#添加头部信息
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-real-ip $remote_addr;
client_max_body_size 500m;
#添加拦截路径和代理地址
location /api/ {
proxy_pass http://192.168.10.26:8899/; #注意:使用代理地址时末尾记得加上斜杠"/"。
}
location /jeecg-boot-file {
#proxy_set_header Host $Host;
#proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://127.0.0.1:8899;
}
location /jeecg-boot {
proxy_set_header Host $Host;
proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://127.0.0.1:8899;
}
location / {
root E:\\shuohuang_nginx\\shuohuang_nginx-1.20.2\\html\\dist;
index index.html index.htm;
}
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
#user nobody;
worker_processes 1;
#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 {
# ...
# 设置连接超时时间为30秒
fastcgi_connect_timeout 600s;
# 设置请求超时时间为60秒
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
client_body_timeout 600s;
client_header_timeout 600s;
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 65;
#gzip on;
server {
listen 3030;
server_name localhost;
#添加头部信息
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-real-ip $remote_addr;
#charset koi8-r;
#access_log logs/host.access.log main;
client_max_body_size 500m;
#添加拦截路径和代理地址
location /api/ {
proxy_pass http://127.0.0.1:8090/; #注意:使用代理地址时末尾记得加上斜杠"/"。
}
location /jeecg-boot-file {
#proxy_set_header Host $Host;
#proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://127.0.0.1:8090;
}
location /jeecg-boot {
proxy_set_header Host $Host;
proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://127.0.0.1:8090;
}
location / {
root ./html/dist_sp;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
#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;
}
}
server{
listen 3031;
server_name localhost;
#添加头部信息
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-real-ip $remote_addr;
#charset koi8-r;
#access_log logs/host.access.log main;
client_max_body_size 500m;
#添加拦截路径和代理地址
location /api/ {
proxy_pass http://127.0.0.1:8091/; #注意:使用代理地址时末尾记得加上斜杠"/"。
}
location /jeecg-boot-file {
#proxy_set_header Host $Host;
#proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://127.0.0.1:8091;
}
location /jeecg-boot {
proxy_set_header Host $Host;
proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://127.0.0.1:8091;
}
location / {
root ./html/dist_lte;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
#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;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.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;
# }
#}
}
#user nobody;
worker_processes 1;
#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 {
# ...
# 设置连接超时时间为30秒
fastcgi_connect_timeout 600s;
# 设置请求超时时间为60秒
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
client_body_timeout 600s;
client_header_timeout 600s;
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#定义变量,兼容HTTP和websocket两种请求协议
map $http_upgrade $connection_upgrade {
default keep-alive; #默认 keep-alive,表示HTTP协议。
'websocket' upgrade;#若是 websocket 请求,则升级协议 upgrade。
}
#物流港大屏1
server {
listen 3000;
server_name localhost;
#添加头部信息
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-real-ip $remote_addr;
client_max_body_size 500m;
#添加拦截路径和代理地址
location /api/ {
proxy_pass http://localhost:8080/; #注意:使用代理地址时末尾记得加上斜杠"/"。
}
location /jeecg-boot-file {
#proxy_set_header Host $Host;
#proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://localhost:8080;
}
location /jeecg-boot {
proxy_set_header Host $Host;
proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://localhost:8080;
}
#websocket的代理规则
location /jeecg-boot/websocket {
proxy_pass http://localhost:8080; #转发到后端接口
proxy_read_timeout 60s; #设置超时时间,默认是60
proxy_http_version 1.1;
proxy_set_header Host $host;#这个配置不要漏了,必须要
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location / {
root C:\\wuliugang1\\nginx-1.20.2\\html\\dist1;
index index.html index.htm;
}
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# 物流港大屏2
server {
listen 3001;
server_name localhost;
#添加头部信息
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-real-ip $remote_addr;
client_max_body_size 500m;
#添加拦截路径和代理地址
location /api/ {
proxy_pass http://localhost:8099/; #注意:使用代理地址时末尾记得加上斜杠"/"。
}
location /jeecg-boot-file {
#proxy_set_header Host $Host;
#proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://localhost:8099;
}
location /jeecg-boot {
proxy_set_header Host $Host;
proxy_set_header X-Forward-For $remote_addr;
proxy_pass http://localhost:8099;
}
location / {
root C:\\wuliugang1\\nginx-1.20.2\\html\\dist2;
index index.html index.htm;
}
#websocket的代理规则
location /jeecg-boot/websocket {
proxy_pass http://localhost:8099; #转发到后端接口
proxy_read_timeout 60s; #设置超时时间,默认是60
proxy_http_version 1.1;
proxy_set_header Host $host;#这个配置不要漏了,必须要
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
#定时任务项目
server {
listen 3033;
server_name localhost;
charset utf-8;
location / {
root C:\\task\\task_ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:9080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}