nodebb使用nginx反向代理


  • ADMIN

    nodebb默认使用IP + 端口访问,显然这样不便于记忆和推广,可以在前端加上nginx反向代理,摘抄了官方的配置,供参考:

    server {
        listen 80;
    
        server_name forum.example.org;
    
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            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";
        }
    }
    

    参考了:配置 nginx 为代理


登录后回复
 

Powered by NodeBB | Contributors

与 技术交流区 的连接断开,我们正在尝试重连,请耐心等待