Error when starting NodeBB (Error parsing your configuration file)
-
Hey everyone,
First time setting up NodeBB on a subdomain, and ran into an error upon attempting to start it:
Starting NodeBB "./nodebb stop" to stop the NodeBB server "./nodebb log" to view server output "./nodebb restart" to restart NodeBB /home/mark/mynodebb/node_modules/nconf/lib/nconf/stores/file.js:153 throw new Error("Error parsing your configuration file: [" + this.file + ' ^ Error: Error parsing your configuration file: [/home/mark/mynodebb/config.json]: Unexpected token / at File.loadSync (/home/mark/mynodebb/node_modules/nconf/lib/nconf/stores/file.js:153:11) at Provider.add (/home/mark/mynodebb/node_modules/nconf/lib/nconf/provider.js:137:23) at Provider.file (/home/mark/mynodebb/node_modules/nconf/lib/nconf/provider.js:63:15) at Object.<anonymous> (/home/mark/mynodebb/loader.js:14:20) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16)
Here's the output of the config.json file:
{ "url": "http://community.domain.com", "secret": "***", "database": "redis", "port":"4567", "bind_address":"0.0.0.0", //new "redis": { "host": "127.0.0.1", "port": "6379", "username": "***", "password": "***", "database": "0" }, "use_port":"false", //don't forget this setting }
When I test NGINX and run
nginx -t
, I get this:nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Contents of nginx.conf:
user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # Uncomment it if you installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; upstream nodebb { #update with your serve ip address with port server 192.241.242.65; } } #mail { # # See sample authentication script at: # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # # # auth_http localhost/auth.php; # # pop3_capabilities "TOP" "USER"; # # imap_capabilities "IMAP4rev1" "UIDPLUS"; # # server { # listen localhost:110; # protocol pop3; # proxy on; # } # # server { # listen localhost:143; # protocol imap; # proxy on; # } #}
Contents of nodebb.conf I created in /etc/nginx/sites-enabled:
server { listen 80; server_name community.domain.com; 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://domain.com:4567/; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
I initially tried to create a symlink between nodebb.conf in /sites-enabled and /sites-available, but this didn't seem to resolve the issue so I removed the symlink (I don't have any experience with creating symlinks prior to this project, so I thought I'd remove it in case I didn't execute the direction of the initial link correctly).
Some background on my setup:
- Ubuntu 14.04.3 x64 on a Digital Ocean droplet
- Redis
- NGINX
I've been scouring these forums and elsewhere for tutorials throughout this installation, but I've followed this tutorial in particular all the way through: http://fengshuo.co/2015/03/07/setup-nodebb-with-do/
My current domain shows the NGINX welcome message:
("Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.")And my current subdomain (community.domain.com) shows a 502 Bad Gateway nginx/1.4.6 (Ubuntu) error message.
Any help at all is appreciated. In the couple of days I've been hanging around these forums, I've already received a tremendous amount of help, so thank you! It's been fun (and quite daunting at times) learning multiple new things (NGINX, NodeBB, Redis) at once. Hoping to get this resolved soon.
-
@MarximusMG remove these from your config.json
//new
//don't forget this setting
-
@pichalite thanks for the response. I had wondered about that, but assumed they were ok to leave in there as comments since the tutorial didn't mentioned removing them.
Just removed them, saved config.json, restarted nginx and rebooted the droplet, then tried running NodeBB but got the same error.
I feel as if the lack of the symlink between /sites-enabled and /sites-available is relevant, but as I mentioned before, I'm not confident that I know how to execute that correctly (if it's needed in this case).
-
@MarximusMG Nginx has nothing to do with it... Nginx is just for proxying requests so you don't need to use the port in the URL.
don't think you need this and not sure what that even does
"use_port":"false",
if you remove this line... remove the
,
at the end of the redis info too -
@MarximusMG said:
{
"url": "http://community.domain.com",
"secret": "",
"database": "redis",
"port":"4567",
"bind_address":"0.0.0.0", //new
"redis": {
"host": "127.0.0.1",
"port": "6379",
"username": "",
"password": "***",
"database": "0"
},"use_port":"false", //don't forget this setting
}
try
{ "url": "http://community.domain.com", "secret": "***", "database": "redis", "port":"4567", "bind_address":"0.0.0.0", "redis": { "host": "127.0.0.1", "port": "6379", "username": "***", "password": "***", "database": "0" } }
As Pichalite also mentioned. then repost log.
-
@Joykiller @pichalite That did the trick! Thank you both so much for your help. Don't know why those lines were included in the tutorial I was using.
-
@MarximusMG which tutorial were you using? Can you post the link to it?
-
-
@julian does NodeBB use this option at all?
"use_port": "false"