nginx as proxy with wordpress



  • I'm having trouble getting started with nodebb and wordpress.

    How can I get both running using one digitalocean droplet? I tried to follow this doc but it's unclear https://docs.nodebb.org/en/latest/configuring/proxies/nginx.html

    nodebb is using all default settings but when I go to http://localhost/ I get an error message but when I go to http://localhost:4567/ it works. According to the doc, I need to set use_port to false but didn't need to since it was there when I nano the file.


  • GNU/Linux Admin

    What is the URL for wordpress? You can't have both Wordpress and NodeBB answering to localhost/... well you can, but there may be side effects.



  • @julian I'll try a new droplet and give it another go. Could be I was rushing through it. nodebb looks to be something I want to use after trying so many different ones out there.



  • @peter said:

    @julian I'll try a new droplet and give it another go. Could be I was rushing through it. nodebb looks to be something I want to use after trying so many different ones out there.

    I doubt there's a need to start again, it's probably just an issue with your nginx config.



  • Any known issues using nodebb on subdomain or subfolder?



  • @a_5mith @julian

    I decided to try subfolder http://localhost/forum but still can't figure out how to remove the port after following the doc

    my config looks like this

    {
    "base_url": "http://localhost",
    "port": "4567",
    "secret": "xxx",
    "bind_address": "0.0.0.0",
    "database": "redis",
    "redis": {
    "host": "127.0.0.1",
    "port": "6379",
    "password": "xxx",
    "database": "0"
    },
    "bcrypt_rounds": 12,
    "upload_path": "/public/uploads",
    "use_port": false,
    "relative_path": "/forum"
    }

    Here is my nginx block

    server {
    listen 80;
    root /usr/share/nginx/html;
    index index.html index.htm;
    server_name localhost;

        location / {
                try_files $uri $uri/ =404;
        	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;
    
        	proxy_http_version 1.1;
        	proxy_set_header Upgrade $http_upgrade;
        	proxy_set_header Connection "upgrade";
        }
    

    }



  • I would advise using a subdomain, it's just easier. How are you hosting this? On your own PC?

    Set your base_url in config.json to the same as what you enter under server_name - In the example below: subdomain.domain.com

    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";
    }
    }
    

    Make sure you create a valid symlink between sites-available & sites-enabled. And restart or reload nginx and make sure you get an [OK] message when you do so.



  • @a_5mith I have it setup on a new DO droplet using the server IP (no domain yet) for both server_name and the base_url - basically replacing localhost referenced in my previous post. Hope that makes sense.

    for example:
    "base_url": "http://xxx.xxx.xxx.xxx",
    server_name xxx.xxx.xxx.xxx;

    working url via http://xxx.xxx.xxx.xxx:4567/forum
    404 not found for http://xxx.xxx.xxx.xxx/forum

    Appreciate all you help.


Log in to reply
 

Suggested Topics

| |