Testing subfolder installation
-
Continuing from this topic, I tested subfolder installation on a server running in a virtual environment.
The site mostly works, but I'm getting an error when first loading the front page. It will not load completely and just show a blank page. Eventually after much prodding, it will load.
On Firefox, the console error says:
Firefox can't establish a connection to the server at ws://192.168.1.10/forum/socket.io/1/websocket/iGeXqL_AHEkKWOaKkQRF.
And on Chromium, the error shown in the console:
WebSocket connection to 'ws://192.168.1.10/forum/socket.io/1/websocket/n4YHWE2OK7OPguiNkQQ-' failed: Error during WebSocket handshake: 'Connection' header value is not 'Upgrade' http://192.168.1.10/forum/
When it fails to load the front page, the console error is:
Failed to load resource: the server responded with a status of 504 (Gateway Time-out) http://192.168.1.10/forum/socket.io/1/xhr-polling/Ntkjy5eI8TikAr5akQRQ?t=1394536265747
Here's the part of the Nginx config relevant to this topic:
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; #rewrite ^/forum/(.*)$ /$1 break; proxy_pass http://192.168.1.10:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
@julian, @psychobunny and @baris, what do you make of this?
Edit: Note that even though the front page does not load, clicking on the menu links work.
-
Still more on this:
On the ACP, when I click on the Events button, the page fails to load. Instead, I get the notification shown in this screenshot.
But when I look under /var/www/forum, which is the root of the NodeBB installation, the events.log does not exist.
I think this events.log-related issue only exists in the Edge code, because I do not see it on my site running 0.3.2.
-
/forum and that is the only reason why it worked. Without it, trying to access the site at http://192.168.1.10/forum always redirected to http://192.168.1.10/404.
-
@planner The file is created when something is logged to it -- otherwise it is not created.
In unrelated news, latest commits have subfolder installs working again.
Notes
- My proxy config's "location" is actually
/
, not/forum/
- Git hash: 313c51cfb1fc1df2d44e5a2b5420fe87dd43968c
- There are still some oddities, but it should be 90% there.
- My proxy config's "location" is actually
-
I used a relative_path of
/forum
as intended, but in my nginx config, the line readslocation / {
, notlocation ^~ /forum {
Perhaps that might get you closer?
Also, this error:
Failed to load resource: the server responded with a status of 504 (Gateway Time-out) http://192.168.1.10/forum/socket.io/1/xhr-polling/Ntkjy5eI8TikAr5akQRQ?t=1394536265747
suggests that your nginx server is < 1.3.13... maybe? -
suggests that your nginx server is < 1.3.13... maybe?
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. -
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 thatrelative_path
is set to/forum
, and now my NodeBB loads properly: -
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.
-
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.
-
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.