Compare commits
2
Commits
cc310283e4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b73027ed9d | ||
|
|
9490a1ce54 |
@@ -1,6 +1,7 @@
|
||||
# Application
|
||||
APP_ENV=production
|
||||
APP_PORT=
|
||||
APP_HOST=0.0.0.0
|
||||
APP_BASE_URL=
|
||||
APP_SECRET_KEY=
|
||||
APP_ADMIN_TOKEN=
|
||||
|
||||
@@ -46,6 +46,8 @@ ssh -N -L 15432:127.0.0.1:5432 <ssh-user>@<server-ip>
|
||||
|
||||
Linux 云服务器上推荐使用 `docker-compose.host-network.yml`:SSH 隧道监听宿主机 `127.0.0.1:15432`,网页容器使用宿主机网络,`.env` 中填写 `PGHOST=127.0.0.1`、`PGPORT=15432`。这样不会把数据库隧道端口暴露到公网。模板见 `deploy/daily-news-db-tunnel.service.example`。
|
||||
|
||||
网页服务可由 Nginx 代理到宿主机本地端口。使用 `docker-compose.host-network.yml` 时,覆盖配置会让网页只监听 `127.0.0.1:3100`;不要直接把 3100 暴露给公网。
|
||||
|
||||
## 配置
|
||||
|
||||
复制 `.env.example` 为 `.env`,再在服务器上填写实际值。仓库中不提交 `.env`、密码、SMTP 授权码或 SSH 私钥。
|
||||
|
||||
@@ -4,3 +4,5 @@ services:
|
||||
web:
|
||||
network_mode: host
|
||||
ports: []
|
||||
environment:
|
||||
APP_HOST: 127.0.0.1
|
||||
|
||||
+1
-1
@@ -5,6 +5,6 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "3100:3100"
|
||||
- "127.0.0.1:3100:3100"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
+5
-4
@@ -2,13 +2,14 @@
|
||||
# Do not change this value after n8n has stored credentials.
|
||||
N8N_ENCRYPTION_KEY=
|
||||
|
||||
# Initial access is through an SSH tunnel, so keep n8n on localhost.
|
||||
N8N_HOST=127.0.0.1
|
||||
# Nginx terminates HTTPS; n8n itself listens on local HTTP only.
|
||||
N8N_HOST=n8n.example.com
|
||||
N8N_PORT=5678
|
||||
N8N_LISTEN_ADDRESS=127.0.0.1
|
||||
N8N_PROTOCOL=http
|
||||
N8N_EDITOR_BASE_URL=http://127.0.0.1:5678
|
||||
N8N_SECURE_COOKIE=false
|
||||
N8N_EDITOR_BASE_URL=https://n8n.example.com
|
||||
WEBHOOK_URL=https://n8n.example.com/
|
||||
N8N_SECURE_COOKIE=true
|
||||
|
||||
TZ=Asia/Shanghai
|
||||
GENERIC_TIMEZONE=Asia/Shanghai
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ const { URL } = require('url');
|
||||
const { Pool } = require('pg');
|
||||
|
||||
const PORT = Number(process.env.APP_PORT || 3000);
|
||||
const HOST = process.env.APP_HOST || '0.0.0.0';
|
||||
const PUBLIC_DIR = path.join(__dirname, 'public');
|
||||
const ADMIN_TOKEN = process.env.APP_ADMIN_TOKEN || '';
|
||||
|
||||
@@ -306,7 +307,7 @@ const server = http.createServer(async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(PORT, '0.0.0.0', () => {
|
||||
server.listen(PORT, HOST, () => {
|
||||
console.log(`Daily news digest web listening on ${PORT}`);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user