From 542f97605612312330a8c307a76836be34b9a831 Mon Sep 17 00:00:00 2001 From: yangweijie <917647288@qq.com> Date: Mon, 2 Sep 2024 18:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20nginx=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/02-install/02-server.md | 30 ++++++++++++------- .../current/02-install/02-server.md | 30 ++++++++++++------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/docs/02-install/02-server.md b/docs/02-install/02-server.md index 9a1a765..b84dcf4 100644 --- a/docs/02-install/02-server.md +++ b/docs/02-install/02-server.md @@ -78,18 +78,28 @@ php think p:server {action} {--daemon} ### Nginx参考 ```nginx -location / { - try_files $uri $uri/ @backend; +upstream backend{ + server 127.0.0.1:8008; + keepalive 10240; } -location @backend { - proxy_pass http://127.0.0.1:8008; - 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-Proto $scheme; - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Port $server_port; +server{ + listen 80; + server_name tp.xxx.cn; + root /xp/www/tp/public; + access_log off; + + location / { + proxy_pass http://backend; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header REMOTE-HOST $remote_addr; + 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-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; } ``` diff --git a/i18n/en/docusaurus-plugin-content-docs/current/02-install/02-server.md b/i18n/en/docusaurus-plugin-content-docs/current/02-install/02-server.md index 001ea67..df81caf 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/02-install/02-server.md +++ b/i18n/en/docusaurus-plugin-content-docs/current/02-install/02-server.md @@ -82,18 +82,28 @@ php think p:server {action} {--daemon} ### Nginx Reference ```nginx -location/{ - try_files $uri $uri/ @backend; +upstream backend{ + server 127.0.0.1:8008; + keepalive 10240; } -location @backend { - proxy_pass http://127.0.0.1:8008; - 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-Proto $scheme; - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Port $server_port; +server{ + listen 80; + server_name tp.xxx.cn; + root /xp/www/tp/public; + access_log off; + + location / { + proxy_pass http://backend; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header REMOTE-HOST $remote_addr; + 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-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; } ```