Merge pull request #430 from jamebal/dev
refactor/nginx: 重构 Nginx 配置文件并添加代理参数配置
This commit is contained in:
commit
a0e67ddbe9
@ -1,7 +1,10 @@
|
||||
FROM jmal/nginx-drawio:latest
|
||||
|
||||
COPY nginx.conf.no_office.template /etc/nginx/nginx.conf.no_office.template
|
||||
COPY nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
COPY nginx/nginx.conf.no_office.template /etc/nginx/nginx.conf.no_office.template
|
||||
COPY nginx/nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
|
||||
COPY nginx/proxy_params.conf /etc/nginx/conf/proxy_params.conf
|
||||
COPY nginx/proxy_params_file.conf /etc/nginx/conf/proxy_params_file.conf
|
||||
|
||||
COPY dist /var/www/public
|
||||
|
||||
|
||||
291
nginx.conf
291
nginx.conf
@ -1,291 +0,0 @@
|
||||
# nginx : /usr/local/Cellar/nginx/nginx-1.17.8/objs/nginx
|
||||
# nginx.conf : /usr/local/nginx/conf/nginx.conf
|
||||
#user nobody;
|
||||
worker_processes auto; # 自动根据 CPU 核心数设置
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
multi_accept on; # 提高并发连接效率
|
||||
}
|
||||
|
||||
#设定http服务器,利用它的反向代理功能提供负载均衡支持
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# 全局性能优化
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on; # 动态内容传输优化
|
||||
keepalive_timeout 65s;
|
||||
keepalive_requests 100; # 单连接最大请求数
|
||||
|
||||
# 默认启用 gzip
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/javascript application/json text/xml;
|
||||
gzip_min_length 1000;
|
||||
gzip_vary on; # 添加 Vary: Accept-Encoding 头
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
map $http_host $this_host {
|
||||
"" $host;
|
||||
default $http_host;
|
||||
}
|
||||
map $http_x_forwarded_proto $the_scheme {
|
||||
default $http_x_forwarded_proto;
|
||||
"" $scheme;
|
||||
}
|
||||
map $http_x_forwarded_host $the_host {
|
||||
default $http_x_forwarded_host;
|
||||
"" $this_host;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8089;
|
||||
server_name localhost;
|
||||
|
||||
location = / {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://jmalcloud:8088;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /articles/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###jmal-cloud-vie vue.js 前端配置
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/public;
|
||||
client_max_body_size 1024m;
|
||||
client_body_buffer_size 512k;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location = /blog {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location = /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
send_timeout 600s; # 延长超时
|
||||
keepalive_timeout 600s; # 延长保持连接时间
|
||||
output_buffers 1 512k; # 增大输出缓冲区
|
||||
gzip off; # 禁用压缩,避免大文件开销
|
||||
}
|
||||
|
||||
location /webDAV/ {
|
||||
proxy_pass http://jmalcloud:8088/webDAV/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
send_timeout 600s; # 延长超时
|
||||
keepalive_timeout 600s; # 延长保持连接时间
|
||||
output_buffers 1 512k; # 增大输出缓冲区
|
||||
gzip off; # 禁用压缩,避免大文件开销
|
||||
}
|
||||
|
||||
location /file/ {
|
||||
proxy_pass http://jmalcloud:8088/file/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
send_timeout 600s; # 延长超时
|
||||
keepalive_timeout 600s; # 延长保持连接时间
|
||||
output_buffers 1 512k; # 增大输出缓冲区
|
||||
gzip off; # 禁用压缩,避免大文件开销
|
||||
}
|
||||
|
||||
location /mq {
|
||||
proxy_pass http://jmalcloud:8088/mq/;
|
||||
#websocket额外配置开始
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源
|
||||
proxy_read_timeout 500s;#读超时时间
|
||||
proxy_send_timeout 500s;#写超时时间
|
||||
#websocket额外配置结束
|
||||
}
|
||||
|
||||
location /office {
|
||||
proxy_pass http://office/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/office;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /drawio/webapp/ {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//drawio/webapp;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /pdf.js/ {
|
||||
proxy_pass http://localhost:8081/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//pdf.js;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /excalidraw/app/ {
|
||||
proxy_pass http://localhost:8082/excalidraw/app/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//excalidraw/app;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
include servers/*;
|
||||
}
|
||||
@ -1,253 +0,0 @@
|
||||
# nginx : /usr/local/Cellar/nginx/nginx-1.17.8/objs/nginx
|
||||
# nginx.conf : /usr/local/nginx/conf/nginx.conf
|
||||
#user nobody;
|
||||
worker_processes 2;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
#设定http服务器,利用它的反向代理功能提供负载均衡支持
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
#设定mime类型,类型由mime.type文件定义
|
||||
include mime.types;
|
||||
#设置文件使用的默认的MIME-type
|
||||
default_type application/octet-stream;
|
||||
#sendfile指令指定 nginx 是否调用sendfile 函数(zero copy 方式)来输出文件,对于普通应用,必须设为on。如果用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络IO处理速度,降低系统uptime
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
#keepalive超时时间。
|
||||
keepalive_timeout 65;
|
||||
#gzip on;
|
||||
|
||||
# 日志
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
map $http_host $this_host {
|
||||
"" $host;
|
||||
default $http_host;
|
||||
}
|
||||
map $http_x_forwarded_proto $the_scheme {
|
||||
default $http_x_forwarded_proto;
|
||||
"" $scheme;
|
||||
}
|
||||
map $http_x_forwarded_host $the_host {
|
||||
default $http_x_forwarded_host;
|
||||
"" $this_host;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8089;
|
||||
server_name localhost;
|
||||
|
||||
location = / {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://jmalcloud:8088;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /articles/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###jmal-cloud-vie vue.js 前端配置
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/public;
|
||||
client_max_body_size 50m;
|
||||
client_body_buffer_size 512k;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location = /blog {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location = /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /webDAV/ {
|
||||
proxy_pass http://jmalcloud:8088/webDAV/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
}
|
||||
|
||||
location /file/ {
|
||||
proxy_pass http://jmalcloud:8088/file/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /mq {
|
||||
proxy_pass http://jmalcloud:8088/mq/;
|
||||
#websocket额外配置开始
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源
|
||||
proxy_read_timeout 500s;#读超时时间
|
||||
proxy_send_timeout 500s;#写超时时间
|
||||
#websocket额外配置结束
|
||||
}
|
||||
|
||||
location /drawio/webapp/ {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//drawio/webapp;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /pdf.js/ {
|
||||
proxy_pass http://localhost:8081/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//pdf.js;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /excalidraw/app/ {
|
||||
proxy_pass http://localhost:8082/excalidraw/app/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//excalidraw/app;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
include servers/*;
|
||||
}
|
||||
@ -1,295 +0,0 @@
|
||||
# nginx : /usr/local/Cellar/nginx/nginx-1.17.8/objs/nginx
|
||||
# nginx.conf : /usr/local/nginx/conf/nginx.conf
|
||||
#user nobody;
|
||||
worker_processes auto; # 自动根据 CPU 核心数设置
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
multi_accept on; # 提高并发连接效率
|
||||
}
|
||||
|
||||
#设定http服务器,利用它的反向代理功能提供负载均衡支持
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# 日志
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
# 全局性能优化
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on; # 动态内容传输优化
|
||||
keepalive_timeout 65s;
|
||||
keepalive_requests 100; # 单连接最大请求数
|
||||
|
||||
# 默认启用 gzip
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/javascript application/json text/xml;
|
||||
gzip_min_length 1000;
|
||||
gzip_vary on; # 添加 Vary: Accept-Encoding 头
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
map $http_host $this_host {
|
||||
"" $host;
|
||||
default $http_host;
|
||||
}
|
||||
map $http_x_forwarded_proto $the_scheme {
|
||||
default $http_x_forwarded_proto;
|
||||
"" $scheme;
|
||||
}
|
||||
map $http_x_forwarded_host $the_host {
|
||||
default $http_x_forwarded_host;
|
||||
"" $this_host;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8089;
|
||||
server_name localhost;
|
||||
|
||||
location = / {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://jmalcloud:8088;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /articles/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###jmal-cloud-vie vue.js 前端配置
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/public;
|
||||
client_max_body_size 1024m;
|
||||
client_body_buffer_size 512k;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location = /blog {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location = /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
send_timeout 600s; # 延长超时
|
||||
keepalive_timeout 600s; # 延长保持连接时间
|
||||
output_buffers 1 512k; # 增大输出缓冲区
|
||||
gzip off; # 禁用压缩,避免大文件开销
|
||||
}
|
||||
|
||||
location /webDAV/ {
|
||||
proxy_pass http://jmalcloud:8088/webDAV/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
send_timeout 600s; # 延长超时
|
||||
keepalive_timeout 600s; # 延长保持连接时间
|
||||
output_buffers 1 512k; # 增大输出缓冲区
|
||||
gzip off; # 禁用压缩,避免大文件开销
|
||||
}
|
||||
|
||||
location /file/ {
|
||||
proxy_pass http://jmalcloud:8088/file/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
send_timeout 600s; # 延长超时
|
||||
keepalive_timeout 600s; # 延长保持连接时间
|
||||
output_buffers 1 512k; # 增大输出缓冲区
|
||||
gzip off; # 禁用压缩,避免大文件开销
|
||||
}
|
||||
|
||||
location /mq {
|
||||
proxy_pass http://jmalcloud:8088/mq/;
|
||||
#websocket额外配置开始
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源
|
||||
proxy_read_timeout 500s;#读超时时间
|
||||
proxy_send_timeout 500s;#写超时时间
|
||||
#websocket额外配置结束
|
||||
}
|
||||
|
||||
location /office {
|
||||
proxy_pass http://office/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host/office;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /drawio/webapp/ {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//drawio/webapp;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /pdf.js/ {
|
||||
proxy_pass http://localhost:8081/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//pdf.js;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /excalidraw/app/ {
|
||||
proxy_pass http://localhost:8082/excalidraw/app/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-Host $the_host//excalidraw/app;
|
||||
proxy_set_header X-Forwarded-Proto $the_scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
include servers/*;
|
||||
}
|
||||
191
nginx/nginx.conf.no_office.template
Normal file
191
nginx/nginx.conf.no_office.template
Normal file
@ -0,0 +1,191 @@
|
||||
# nginx.conf : /etc/nginx/nginx.conf
|
||||
#user nobody;
|
||||
worker_processes auto; # 自动根据 CPU 核心数设置
|
||||
|
||||
events {
|
||||
worker_connections 2048;
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
#设定http服务器,利用它的反向代理功能提供负载均衡支持
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# 日志
|
||||
#access_log /var/log/nginx/access.log main buffer=32k flush=5s;
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
# 全局性能优化
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
server_names_hash_bucket_size 512;
|
||||
keepalive_timeout 65;
|
||||
keepalive_requests 1000;
|
||||
|
||||
# 全局上传/头部限制
|
||||
client_header_buffer_size 32k;
|
||||
client_max_body_size 50m; # 全局默认值
|
||||
|
||||
# 全局默认代理缓冲 (用于普通API)
|
||||
proxy_buffer_size 16k;
|
||||
proxy_buffers 4 32k;
|
||||
proxy_busy_buffers_size 64k;
|
||||
|
||||
# 默认启用 gzip
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/json;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
map $http_host $this_host {
|
||||
"" $host;
|
||||
default $http_host;
|
||||
}
|
||||
map $http_x_forwarded_proto $the_scheme {
|
||||
default $http_x_forwarded_proto;
|
||||
"" $scheme;
|
||||
}
|
||||
map $http_x_forwarded_host $the_host {
|
||||
default $http_x_forwarded_host;
|
||||
"" $this_host;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8089;
|
||||
server_name localhost;
|
||||
|
||||
location = / {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://jmalcloud:8088;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /articles/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###jmal-cloud-vie vue.js 前端配置
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/public;
|
||||
client_max_body_size 1024m;
|
||||
client_body_buffer_size 512k;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location = /blog {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location = /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /blog/api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /blog/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
include /etc/nginx/conf/proxy_params_file.conf;
|
||||
}
|
||||
|
||||
location /webDAV/ {
|
||||
proxy_pass http://jmalcloud:8088/webDAV/;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
include /etc/nginx/conf/proxy_params_file.conf;
|
||||
}
|
||||
|
||||
location /file/ {
|
||||
proxy_pass http://jmalcloud:8088/file/;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
include /etc/nginx/conf/proxy_params_file.conf;
|
||||
}
|
||||
|
||||
location /mq {
|
||||
proxy_pass http://jmalcloud:8088/mq/;
|
||||
#websocket额外配置开始
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源
|
||||
proxy_read_timeout 500s;#读超时时间
|
||||
proxy_send_timeout 500s;#写超时时间
|
||||
#websocket额外配置结束
|
||||
}
|
||||
|
||||
location /drawio/webapp/ {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_set_header X-Forwarded-Host $the_host/drawio/webapp;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /pdf.js/ {
|
||||
proxy_pass http://localhost:8081/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
proxy_set_header X-Forwarded-Host $the_host//pdf.js;
|
||||
}
|
||||
|
||||
location /excalidraw/app/ {
|
||||
proxy_pass http://localhost:8082/excalidraw/app/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
proxy_set_header X-Forwarded-Host $the_host//excalidraw/app;
|
||||
}
|
||||
}
|
||||
|
||||
include servers/*;
|
||||
}
|
||||
197
nginx/nginx.conf.template
Normal file
197
nginx/nginx.conf.template
Normal file
@ -0,0 +1,197 @@
|
||||
# nginx.conf : /etc/nginx/nginx.conf
|
||||
#user nobody;
|
||||
worker_processes auto; # 自动根据 CPU 核心数设置
|
||||
|
||||
events {
|
||||
worker_connections 2048;
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
#设定http服务器,利用它的反向代理功能提供负载均衡支持
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# 日志
|
||||
#access_log /var/log/nginx/access.log main buffer=32k flush=5s;
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
# 全局性能优化
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
server_names_hash_bucket_size 512;
|
||||
keepalive_timeout 65;
|
||||
keepalive_requests 1000;
|
||||
|
||||
# 全局上传/头部限制
|
||||
client_header_buffer_size 32k;
|
||||
client_max_body_size 50m; # 全局默认值
|
||||
|
||||
# 全局默认代理缓冲 (用于普通API)
|
||||
proxy_buffer_size 16k;
|
||||
proxy_buffers 4 32k;
|
||||
proxy_busy_buffers_size 64k;
|
||||
|
||||
# 默认启用 gzip
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/json;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
map $http_host $this_host {
|
||||
"" $host;
|
||||
default $http_host;
|
||||
}
|
||||
map $http_x_forwarded_proto $the_scheme {
|
||||
default $http_x_forwarded_proto;
|
||||
"" $scheme;
|
||||
}
|
||||
map $http_x_forwarded_host $the_host {
|
||||
default $http_x_forwarded_host;
|
||||
"" $this_host;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8089;
|
||||
server_name localhost;
|
||||
|
||||
location = / {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://jmalcloud:8088;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /articles/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /articles {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###jmal-cloud-vie vue.js 前端配置
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/public;
|
||||
client_max_body_size 1024m;
|
||||
client_body_buffer_size 512k;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location = /blog {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location = /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /blog/api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /blog/articles {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /blog/ {
|
||||
proxy_pass http://jmalcloud:8088/articles/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://jmalcloud:8088/;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
include /etc/nginx/conf/proxy_params_file.conf;
|
||||
}
|
||||
|
||||
location /webDAV/ {
|
||||
proxy_pass http://jmalcloud:8088/webDAV/;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
include /etc/nginx/conf/proxy_params_file.conf;
|
||||
}
|
||||
|
||||
location /file/ {
|
||||
proxy_pass http://jmalcloud:8088/file/;
|
||||
proxy_set_header X-Forwarded-Host $the_host/file;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
include /etc/nginx/conf/proxy_params_file.conf;
|
||||
}
|
||||
|
||||
location /mq {
|
||||
proxy_pass http://jmalcloud:8088/mq/;
|
||||
#websocket额外配置开始
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源
|
||||
proxy_read_timeout 500s;#读超时时间
|
||||
proxy_send_timeout 500s;#写超时时间
|
||||
#websocket额外配置结束
|
||||
}
|
||||
|
||||
location /office {
|
||||
proxy_pass http://office/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
proxy_set_header X-Forwarded-Host $the_host/office;
|
||||
}
|
||||
|
||||
location /drawio/webapp/ {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_set_header X-Forwarded-Host $the_host//drawio/webapp;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
}
|
||||
|
||||
location /pdf.js/ {
|
||||
proxy_pass http://localhost:8081/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
proxy_set_header X-Forwarded-Host $the_host//pdf.js;
|
||||
}
|
||||
|
||||
location /excalidraw/app/ {
|
||||
proxy_pass http://localhost:8082/excalidraw/app/;
|
||||
include /etc/nginx/conf/proxy_params.conf;
|
||||
proxy_set_header X-Forwarded-Host $the_host//excalidraw/app;
|
||||
}
|
||||
}
|
||||
|
||||
include servers/*;
|
||||
}
|
||||
10
nginx/proxy_params.conf
Normal file
10
nginx/proxy_params.conf
Normal file
@ -0,0 +1,10 @@
|
||||
# /etc/nginx/conf/proxy_params.conf
|
||||
# 通用代理头设置
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
9
nginx/proxy_params_file.conf
Normal file
9
nginx/proxy_params_file.conf
Normal file
@ -0,0 +1,9 @@
|
||||
# /etc/nginx/conf/proxy_params_file.conf
|
||||
# 文件服务通用代理头设置
|
||||
|
||||
# 延长超时时间以支持慢速网络下的大文件下载 (这个依然有用且重要)
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
gzip off; # 禁用压缩,避免大文件开销
|
||||
proxy_buffering off;
|
||||
proxy_buffer_size 128k;
|
||||
@ -2,7 +2,7 @@ export async function copyText(text) {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
this.$message.success('复制成功');
|
||||
Vue.prototype.$message.success('复制成功');
|
||||
} catch (err) {
|
||||
fallbackCopyText(text);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user