From 385f9c602a110ecc7c1793be5eda8d76d78a18e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=8E=E9=9A=BC=E4=B8=B6=E6=AD=A2=E6=88=88?= <1649991905@qq.com> Date: Tue, 14 Mar 2023 10:14:00 +0800 Subject: [PATCH] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 Nginx 配置文件 --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b18b7b..3f3e89e 100644 --- a/README.md +++ b/README.md @@ -50,13 +50,13 @@ This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-opti ## Docker -docker: +### docker ```bash docker run -itd --name=metaweblog-api -p 6333:3000 -e TZ=Asia/Shanghai --restart=unless-stopped nn200433/metaweblog-api:latest ``` -docker-compose: +### docker-compose ```yaml version: '3' @@ -71,6 +71,62 @@ services: - TZ=Asia/Shanghai ``` +## Nginx + +### Installation + +The nginx docker installation can be done using: + +1. [nginxWebUI](https://www.nginxwebui.cn/product.html) +2. [Nginx Proxy Manager](https://nginxproxymanager.com/guide/#quick-setup) + +### Configuration + +```nginx +server { + # modify + server_name ; + + listen 443 ssl http2; + + # modify + ssl_certificate ; + ssl_certificate_key ; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + listen 80; + if ($scheme = http) { + return 301 https://$host:443$request_uri; + } + + underscores_in_headers on; + + # blog + location / { + proxy_pass http://127.0.0.1:8080; + proxy_set_header Host $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-Host $http_host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect http:// https://; + } + + # metaweblog-api + location /api { + proxy_pass http://127.0.0.1:6333; + proxy_set_header Host $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-Host $http_host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect http:// https://; + } +} +``` + ## Learn More To learn more about Next.js, take a look at the following resources: