Navigation

    喵了个咪乎

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    【已解决】设置Nginx反代后显示连接中断,网站反应慢

    常规讨论区
    1
    2
    9
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • satan1a
      satan1a last edited by satan1a

      如题,还在解决。

      1 Reply Last reply Reply Quote 0
      • satan1a
        satan1a last edited by satan1a

        解决方案

        注意以下几个步骤

        1. 编辑 nginx.conf 文件(配置Nginx)

        server {
            listen 80;
        
            server_name example.com;
        
            location / {
                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 Host $http_host;
                proxy_set_header X-NginX-Proxy true;
        
                proxy_pass http://127.0.0.1:4567/;
                proxy_redirect off;
        
                # Socket.IO Support
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
            }
        }
        

        注意,example.com换成你自己的域名,127.0.0.1 换成你主机的IP。

        2. 修改网站文件夹nodebb/中的 config.json文件

        修改 "url": 选项,改为反代后的域名。如本站就是 "url": http://mlgmh.cc/。

        3. 重新生成和部署

        在网站文件夹nodebb/中使用命令 ./nodebb setup重新生成和部署网站。

        1 Reply Last reply Reply Quote 0
        • First post
          Last post