mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 15:46:39 +08:00
change nginx
This commit is contained in:
parent
96a5c7a0d6
commit
df5b245c22
88
chat.conf
Normal file
88
chat.conf
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 匹配以 www. 开头的请求并重定向到 HTTPS 的不带 www.
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name ~^www\.(?<domain>.+)$;
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_certificate "/root/cert.pem";
|
||||||
|
ssl_certificate_key "/root/cert.key";
|
||||||
|
ssl_session_cache shared:SSL:1m;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_ciphers PROFILE=SYSTEM;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000";
|
||||||
|
|
||||||
|
return 301 https://$domain$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 匹配任意 HTTP 重定向到 HTTPS
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
# 将 HTTP 请求重定向到 HTTPS
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2 default_server;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_certificate "/root/cert.pem";
|
||||||
|
ssl_certificate_key "/root/cert.key";
|
||||||
|
ssl_session_cache shared:SSL:1m;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_ciphers PROFILE=SYSTEM;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000";
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
|
||||||
|
#REWRITE-START
|
||||||
|
if ($host ~* ^www\.(.+)$) {
|
||||||
|
set $new_host \$1;
|
||||||
|
return 301 https://$new_host$request_uri;
|
||||||
|
}
|
||||||
|
#REWRITE-END
|
||||||
|
|
||||||
|
#PROXY-START/
|
||||||
|
|
||||||
|
location ^~ /
|
||||||
|
{
|
||||||
|
proxy_pass http://127.0.0.1:23000;
|
||||||
|
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 REMOTE-HOST $remote_addr;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
|
||||||
|
# 禁止缓存的相关设置
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_no_cache 1;
|
||||||
|
proxy_cache_bypass 1;
|
||||||
|
add_header X-Accel-Buffering "no";
|
||||||
|
# 设置代理超时
|
||||||
|
proxy_read_timeout 24h;
|
||||||
|
proxy_connect_timeout 3m;
|
||||||
|
proxy_send_timeout 24h;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#PROXY-END/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
88
nginx/chat.conf
Normal file
88
nginx/chat.conf
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 匹配以 www. 开头的请求并重定向到 HTTPS 的不带 www.
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name ~^www\.(?<domain>.+)$;
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_certificate "/root/cert.pem";
|
||||||
|
ssl_certificate_key "/root/cert.key";
|
||||||
|
ssl_session_cache shared:SSL:1m;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_ciphers PROFILE=SYSTEM;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000";
|
||||||
|
|
||||||
|
return 301 https://$domain$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 匹配任意 HTTP 重定向到 HTTPS
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
# 将 HTTP 请求重定向到 HTTPS
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2 default_server;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_certificate "/root/cert.pem";
|
||||||
|
ssl_certificate_key "/root/cert.key";
|
||||||
|
ssl_session_cache shared:SSL:1m;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_ciphers PROFILE=SYSTEM;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000";
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
|
||||||
|
#REWRITE-START
|
||||||
|
if ($host ~* ^www\.(.+)$) {
|
||||||
|
set $new_host \$1;
|
||||||
|
return 301 https://$new_host$request_uri;
|
||||||
|
}
|
||||||
|
#REWRITE-END
|
||||||
|
|
||||||
|
#PROXY-START/
|
||||||
|
|
||||||
|
location ^~ /
|
||||||
|
{
|
||||||
|
proxy_pass http://127.0.0.1:23000;
|
||||||
|
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 REMOTE-HOST $remote_addr;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
|
||||||
|
# 禁止缓存的相关设置
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_no_cache 1;
|
||||||
|
proxy_cache_bypass 1;
|
||||||
|
add_header X-Accel-Buffering "no";
|
||||||
|
# 设置代理超时
|
||||||
|
proxy_read_timeout 24h;
|
||||||
|
proxy_connect_timeout 3m;
|
||||||
|
proxy_send_timeout 24h;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#PROXY-END/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
7
start.sh
7
start.sh
@ -1,9 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
# 加速
|
# 加速
|
||||||
|
npm config set registry https://registry.npmmirror.com/
|
||||||
|
# 新版需要这样设置
|
||||||
|
yarn config set npmRegistryServer https://registry.npmmirror.com
|
||||||
yarn config set registry 'https://registry.npmmirror.com/'
|
yarn config set registry 'https://registry.npmmirror.com/'
|
||||||
yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
|
yarn config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
|
||||||
yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
|
yarn config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
|
||||||
## 官方
|
## 官方
|
||||||
##yarn config delete registry
|
##yarn config delete registry
|
||||||
##yarn config delete sharp_binary_host
|
##yarn config delete sharp_binary_host
|
||||||
|
Loading…
Reference in New Issue
Block a user