jmalcloud/frontend/nginx/nginx.conf.template
chenpei 8591ad3233 🎨 集成前端代码到后端仓库
✨ 新增功能:
- 将完整的前端Vue项目集成到后端仓库
- 创建 frontend/ 目录存放前端代码
- 排除了 .git、node_modules 等不必要文件

🎯 集成优势:
- 一个仓库包含完整前后端代码
- 简化部署和维护流程
- 方便版本同步和管理
- 减少仓库管理复杂度

📁 项目结构:
- backend/: Java Spring Boot 后端
- frontend/: Vue.js 前端项目
- docker/: 容器配置
- docs/: 各种部署文档

🚀 现在只需克隆一个仓库就能获得:
- JmalCloud 公共空间版后端
- 配套的前端界面
- 完整的Docker部署配置
- 详细的部署文档
2025-08-24 12:10:33 +08:00

200 lines
7.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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;
include /etc/nginx/conf/proxy_params_file.conf;
}
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/*;
include conf.d/*.conf;
}