0

我正在尝试在xxx.xxx.xxx.xxx/nodebb. 我对 Nginx 和 NodeBB 有以下设置:

/etc/nginx/conf.d/nodebb.conf

server {
    listen 80;

    server_name localhost;

    location /nodebb/ {
        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";
    }
}

/usr/share/nginx/nodebb/config.json

{
    "base_url": "http://`xxx.xxx.xxx.xxx",
    "port": "4567",
    "secret": "xxxxxx-xxxxxxxxxxx-xxxxxx-xxxxx",
    "bind_address": "0.0.0.0",
    "database": "mongo",
    "mongo": {
        "host": "127.0.0.1",
        "port": "27017",
        "username": "xxxxxxxx",
        "password": "xxxxxxxxxxx",
        "database": "xxxxxxx"
    },
    "bcrypt_rounds": 12,
    "upload_path": "/public/uploads",
    "use_port": false,
    "relative_path": "/nodebb"
}

当我导航到时,我会通过浏览器错误消息xxx.xxx.xxx.xxx/nodebb重定向到。任何想法我做错了什么?xxx.xxx.xxx.xxx/nodebb/404This web page has a redirect loop

编辑:只是说如果我导航到http://xxx.xxx.xxx.xxx:4567/nodebb/- 它工作正常

4

2 回答 2

0

设置server_nameyourdomain.com/etc/nginx/conf.d/nodebb.conf 和/usr/share/nginx/nodebb/config.json 中base_urlhttp://127.0.0.1

如果这样做,您将无法在 http://yourdomain.com:4567 上打开 nodebb 站点而是在http://yourdomain.comhttp://yourdomain.com:80(这是默认端口)。

于 2014-11-20T09:36:38.223 回答
0

将您的服务器名称设置为与您的 base_url 相同,而不是 localhost。

于 2014-10-27T23:13:29.407 回答