248 lines
8.2 KiB
Plaintext
248 lines
8.2 KiB
Plaintext
|
|
server {
|
|||
|
|
listen 3000;
|
|||
|
|
server_name _;
|
|||
|
|
client_max_body_size 500M;
|
|||
|
|
|
|||
|
|
# 前端 Vite dev server (3001)
|
|||
|
|
location /metalinfo {
|
|||
|
|
proxy_pass http://127.0.0.1:3001;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Upgrade $http_upgrade;
|
|||
|
|
proxy_set_header Connection "upgrade";
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Java 后端
|
|||
|
|
location /chat_web_backend {
|
|||
|
|
proxy_pass http://127.0.0.1:8099;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== Stirling PDF (相对路径,直接代理) =====
|
|||
|
|
location /tool/pdf/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18080/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_buffering off;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== Excalidraw (/assets/ 绝对路径,需要 sub_filter) =====
|
|||
|
|
location /tool/draw/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18081/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html application/javascript;
|
|||
|
|
sub_filter 'href="/' 'href="/tool/draw/';
|
|||
|
|
sub_filter 'src="/' 'src="/tool/draw/';
|
|||
|
|
sub_filter '"/assets/' '"/tool/draw/assets/';
|
|||
|
|
}
|
|||
|
|
# Excalidraw 资源回落
|
|||
|
|
location /assets/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18081/assets/;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== TrWebOCR (SPA打包,无外部资源) =====
|
|||
|
|
location /tool/ocr/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18083/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
# TrWebOCR API
|
|||
|
|
location /tool/ocr/api/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18083/api/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== LibreTranslate (/static/ 绝对路径) =====
|
|||
|
|
location /tool/translate/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18084/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html;
|
|||
|
|
sub_filter 'href="/static/' 'href="/tool/translate/static/';
|
|||
|
|
sub_filter 'src="/static/' 'src="/tool/translate/static/';
|
|||
|
|
sub_filter 'action="/' 'action="/tool/translate/';
|
|||
|
|
sub_filter 'url: "/' 'url: "/tool/translate/';
|
|||
|
|
}
|
|||
|
|
location /tool/translate/static/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18084/static/;
|
|||
|
|
}
|
|||
|
|
location /tool/translate/translate {
|
|||
|
|
proxy_pass http://127.0.0.1:18084/translate;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
location /tool/translate/detect {
|
|||
|
|
proxy_pass http://127.0.0.1:18084/detect;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
location /tool/translate/languages {
|
|||
|
|
proxy_pass http://127.0.0.1:18084/languages;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
location /tool/translate/frontend/settings {
|
|||
|
|
proxy_pass http://127.0.0.1:18084/frontend/settings;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== PPTist (相对路径,直接代理) =====
|
|||
|
|
location /tool/ppt/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18085/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_buffering off;
|
|||
|
|
}
|
|||
|
|
# PPTist AI 后端 (容器内nginx已配 /pptapi/ -> 18086)
|
|||
|
|
location /tool/ppt/pptapi/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18086/;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Connection "";
|
|||
|
|
proxy_buffering off;
|
|||
|
|
proxy_cache off;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== imgcompress (/_next/ 绝对路径) =====
|
|||
|
|
location /tool/imgcompress/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18087/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html;
|
|||
|
|
sub_filter 'href="/_next/' 'href="/tool/imgcompress/_next/';
|
|||
|
|
sub_filter 'src="/_next/' 'src="/tool/imgcompress/_next/';
|
|||
|
|
sub_filter 'href="/favicon' 'href="/tool/imgcompress/favicon';
|
|||
|
|
}
|
|||
|
|
location /tool/imgcompress/_next/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18087/_next/;
|
|||
|
|
}
|
|||
|
|
location /tool/imgcompress/favicon.ico {
|
|||
|
|
proxy_pass http://127.0.0.1:18087/favicon.ico;
|
|||
|
|
}
|
|||
|
|
location /tool/imgcompress/api/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18087/api/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_buffering off;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== Lama Cleaner (/static/ 绝对路径) =====
|
|||
|
|
location /tool/lama/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18088/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html;
|
|||
|
|
sub_filter 'src="/static/' 'src="/tool/lama/static/';
|
|||
|
|
sub_filter 'href="/static/' 'href="/tool/lama/static/';
|
|||
|
|
proxy_buffering off;
|
|||
|
|
}
|
|||
|
|
location /tool/lama/static/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18088/static/;
|
|||
|
|
}
|
|||
|
|
location /tool/lama/api/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18088/api/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_buffering off;
|
|||
|
|
}
|
|||
|
|
location /tool/lama/inpaint {
|
|||
|
|
proxy_pass http://127.0.0.1:18088/inpaint;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_buffering off;
|
|||
|
|
proxy_read_timeout 300s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== webp2jpg (相对路径为主) =====
|
|||
|
|
location /tool/webp2jpg/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18089/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
# webp2jpg 的 cdn 资源
|
|||
|
|
location /cdn/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18089/cdn/;
|
|||
|
|
}
|
|||
|
|
location /version/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18089/version/;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== Overleaf (复杂路径) =====
|
|||
|
|
location /tool/overleaf/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Upgrade $http_upgrade;
|
|||
|
|
proxy_set_header Connection "upgrade";
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
proxy_buffering off;
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html application/javascript;
|
|||
|
|
sub_filter 'href="/' 'href="/tool/overleaf/';
|
|||
|
|
sub_filter 'src="/' 'src="/tool/overleaf/';
|
|||
|
|
sub_filter 'action="/' 'action="/tool/overleaf/';
|
|||
|
|
sub_filter '"/login' '"/tool/overleaf/login';
|
|||
|
|
sub_filter '"/register' '"/tool/overleaf/register';
|
|||
|
|
sub_filter '"/project' '"/tool/overleaf/project';
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/stylesheets/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/stylesheets/;
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/js/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/js/;
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/img/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/img/;
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/fonts/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/fonts/;
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/login {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/login;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html;
|
|||
|
|
sub_filter 'href="/' 'href="/tool/overleaf/';
|
|||
|
|
sub_filter 'src="/' 'src="/tool/overleaf/';
|
|||
|
|
sub_filter 'action="/' 'action="/tool/overleaf/';
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/register {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/register;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/project {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/project;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html;
|
|||
|
|
sub_filter 'href="/' 'href="/tool/overleaf/';
|
|||
|
|
sub_filter 'src="/' 'src="/tool/overleaf/';
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/socket.io/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/socket.io/;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Upgrade $http_upgrade;
|
|||
|
|
proxy_set_header Connection "upgrade";
|
|||
|
|
}
|
|||
|
|
location /tool/overleaf/launchpad {
|
|||
|
|
proxy_pass http://127.0.0.1:18090/launchpad;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header Accept-Encoding "";
|
|||
|
|
sub_filter_once off;
|
|||
|
|
sub_filter_types text/html;
|
|||
|
|
sub_filter 'href="/' 'href="/tool/overleaf/';
|
|||
|
|
sub_filter 'src="/' 'src="/tool/overleaf/';
|
|||
|
|
sub_filter 'action="/' 'action="/tool/overleaf/';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ===== LaTeX 公式编辑器 (CDN外链,无问题) =====
|
|||
|
|
location /tool/latex/ {
|
|||
|
|
proxy_pass http://127.0.0.1:18091/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 默认跳转前端
|
|||
|
|
location / {
|
|||
|
|
return 302 /metalinfo;
|
|||
|
|
}
|
|||
|
|
}
|