上传文件至 /
This commit is contained in:
parent
c924658eb4
commit
676e09b69f
@ -277,6 +277,14 @@ server {
|
||||
root /var/www/${domain}/html;
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
# 增加错误页面,防止直接访问产生错误
|
||||
error_page 404 /404.html;
|
||||
|
||||
# 增加WebSocket超时设置
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ =404;
|
||||
}
|
||||
@ -293,8 +301,34 @@ server {
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
|
||||
# 增加WebSocket专用配置
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_buffer_size 64k;
|
||||
proxy_buffers 4 64k;
|
||||
proxy_busy_buffers_size 64k;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# 创建404错误页面
|
||||
cat > /var/www/${domain}/html/404.html << EOF
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>404 Not Found</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; }
|
||||
h1 { font-size: 36px; color: #333; }
|
||||
p { font-size: 18px; color: #666; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 Not Found</h1>
|
||||
<p>The page you are looking for does not exist.</p>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
|
||||
# 调整nginx.conf
|
||||
@ -421,6 +455,15 @@ EOF
|
||||
echo -e "${YELLOW}4. 是否启用了TLS${PLAIN}"
|
||||
echo -e "${YELLOW}5. 防火墙是否允许443端口通信${PLAIN}"
|
||||
|
||||
# WebSocket连接问题解决方案
|
||||
echo -e "${BLUE}如果出现WebSocket连接关闭错误,可尝试以下解决方案:${PLAIN}"
|
||||
echo -e "${YELLOW}1. 重启Nginx和V2Ray:${PLAIN}"
|
||||
echo -e "${YELLOW} systemctl restart nginx v2ray${PLAIN}"
|
||||
echo -e "${YELLOW}2. 检查Nginx错误日志:${PLAIN}"
|
||||
echo -e "${YELLOW} tail -n 30 /var/log/nginx/error.log${PLAIN}"
|
||||
echo -e "${YELLOW}3. 确认SSL证书有效:${PLAIN}"
|
||||
echo -e "${YELLOW} openssl x509 -text -in /etc/ssl/cert.pem${PLAIN}"
|
||||
|
||||
echo -e "${GREEN}安装完成!${PLAIN}"
|
||||
else
|
||||
echo -e "${RED}安装失败,请检查错误信息${PLAIN}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user