deploy: update example reverse_proxy config

This commit is contained in:
undefined committed 2025-05-12 16:09:12 +08:00
1 parent dcaff6cfb5
commit 526b2768fa
2 files changed
+75 -5

No files matched your search

+27 -1
View File
@@ -1,3 +1,29 @@
# 其他需求清参照 https://caddyserver.com/docs/ 说明进行设置。
# For more information, refer to caddy v2 documentation.
hydro.ac {
reverse_proxy http://localhost:8888
encode zstd gzip
log {
output file /data/access.log {
roll_size 1gb
roll_keep_for 72h
}
format json
}
# Handle static files directly, for better performance.
root * /root/.hydro/static
@static {
file {
try_files {path}
}
}
handle @static {
file_server
}
handle {
reverse_proxy http://127.0.0.1:8888
}
}
www.hydro.ac {
redir * https://hydro.ac{uri}
}
+48 -4
View File
@@ -1,7 +1,32 @@
server {
listen 8080;
server_name localhost;
root /tmp/hydro/public;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name hydro.ac;
root /root/.hydro/static;
access_log /data/access.log combined buffer=512k flush=1m;
error_log /data/error.log warn;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
# If you have brotli module installed
# brotli on;
# brotli_comp_level 6;
# brotli_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
# ssl_certificate /path/to/hydro.ac/fullchain.pem;
# ssl_certificate_key /path/to/hydro.ac/privkey.pem;
# ssl_trusted_certificate /path/to/hydro.ac/chain.pem;
# You may want to enable this if nginx reports '[emerg] unknown "connection_upgrade" variable'
# ref: https://blog.tsinbei.com/en/archives/677/
# map $http_upgrade $connection_upgrade {
# default upgrade;
# '' close;
# }
location / {
try_files $uri @proxy_to_app;
@@ -16,4 +41,23 @@ server {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.hydro.ac;
# ssl_certificate /path/to/www.hydro.ac/fullchain.pem;
# ssl_certificate_key /path/to/www.hydro.ac/privkey.pem;
# ssl_trusted_certificate /path/to/www.hydro.ac/chain.pem;
return 301 https://hydro.ac$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name .hydro.ac;
return 301 https://hydro.ac$request_uri;
}