Testing subfolder installation


  • suggests that your nginx server is < 1.3.13... maybe?

    @julian

    Yes, Nginx is 1.2.6, but I'm not too worried about that because the production server is running the latest and greatest.

    In my Nginx config I already have a location / { that does something else, so another one of those will throw a duplicate error. FWIW, location ^~ /forum { works for me. The only real issues are specific to NodeBB. Forever, in the ACP's Settings page, clicking on the tabs does not always load the correct tab.

  • GNU/Linux Admin

    For the life of me, @planner, still am not seeing the problems you're encountering! 😄

    However, I did notice that I had to change the proxy_pass line in my config:

    proxy_pass http://127.0.0.1:4567/forum/;
    

    This, in addition to location ^~ /forum/ {, and ensuring that relative_path is set to /forum, and now my NodeBB loads properly:

    Selection_010.png


  • @julian

    Well, mine loads properly too, even with proxy_pass setting:

    proxy_pass http://127.0.0.1:4567;
    

    And adding /forum at the end seems to make no difference.

    The real issue I'm seeing is this: On the Settings page in the ACP, I'm not able to navigate between the tabs. No matter which one I click on, the General tab is still in focus. Can you verify this?

    To illustrate, try matching the URL in this page with the page in focus.

    NodeBBfolder.png

  • GNU/Linux Admin

    No, actually, I haven't been able to reproduce that specific bug 😞


  • @julian

    Well, that's good news. I'll just attribute it to running the wrong version of Nginx (1.2.6) and assume that when I configure the production server to run from a subfolder, that all will be fine. but that won't happen until 0.4.0 is released.


  • @julian,

    I've been posting to a site that's supposed to be the production site once 0.4.0 is released. So I've been running it without the aid of Nginx, just off the built-in server that comes with NodeBB (I think that's Express) and accessing the site from http://linuxbsdos.com:4567

    After testing the subfolder installation in a local installation, I decided to upgrade the soon-to-be production site to the latest code and configure Nginx to proxy serve it from a subfolder. Unfortunately, it's not working like the local installation. I'm getting a 520 Bad Gateway error.

    My Nginx config and json.config are really no different from the ones I used in the local installation. But to make it easier for others to help me troubleshoot, here are the complete settings:

    Nginx config. Note: I've tried proxy_pass http://linuxbsdos.com:4567/forum, but it still didn't work.

    ##
    server {
    
        server_name linuxbsdos.com www.linuxbsdos.com;
        
        ## Your only path reference.
        root /public_html/;
        listen 8080;
    
        index index.html index.htm index.php;
    
        include conf.d/drop;
    
            location / {
                    # This is cool because no php is touched for static content
                            try_files $uri $uri/ /index.php?q=$uri&$args;
            }
    
            location ~ \.php$ {
                fastcgi_buffers 8 256k;
                fastcgi_buffer_size 128k;
                fastcgi_intercept_errors on;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
    
    
            }
    
            location ~* \.(css|js|png|jpg|jpeg|gif|ico)$ {
                    expires 1d;
            }
    
    ## Settings for proxying NodeBB forum installation. Added March 14 2014.
    
            location ^~ /forum {
    
            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";
    
        }
    
    }
    

    And config.json

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

    From the error logs, I'm getting entries like:

    2014/03/14 22:13:15 [error] 9689#0: *339 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: linuxbsdos.com, request: "GET /forum/forum-43.html HTTP/1.1", upstream: "http://172.143.217.163:4567/forum/forum-43.html", host: "linuxbsdos.com"
    

    I don't know where to look now, but I'm thinking that all the entries in the database have different URLs than what I'm trying to connect with. Is that a factor or should I be looking at other things?

    Should the client IP shown in the error log be 127.0.0.1?

    Hey, @julian, I've updated the settings a lit, basically, tried a little bit of everything, but this is not working in production. Any ideas, clues?

    Btw, I'm running Nginx 1.4.6.


  • Hello,

    I am trying to make this work on nginx 1.6.0 but I keep getting gateway timeout 504,

    I have the nodebb related config here:

        location ^~ /forum {
    
                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://172.0.0.1:4567/forum;
                proxy_redirect off;
    
                # Socket.IO Support
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
    
            }
    

    and for the config.json looks like :

       {
            "base_url": "http://127.0.0.1/forum",
            "port": "4567",
            "secret": "86f2b377-a251-4e4a-8fbf-fce284473f3b",
           "bind_address": "0.0.0.0",
           "database": "redis",
           "redis": {
                 "host": "127.0.0.1",
                 "port": "6379",
                 "password": "password",
                "database": "0"
       },
           "bcrypt_rounds": 12,
           "upload_path": "/public/uploads",
           "use_port": false,
           "relative_path": "/forum"
      }
    

    however if I run curl http://127.0.0.1:4567/forum/ the site shows correctly.
    Anyone can give me a hint?

    Thanks in advance


  • @Peter-Zoltan-Keresztes

    Your proxy pass says 172.0.0.1:4567/forum, it should be 127.0.0.1:4567/forum


  • @a_5mith

    Yea, that was a typo I did not see, I've changed it and now it works correct. Thanks to pointing that out.



Suggested Topics

| |