Oh good, another nginx topic.
-
First of all, considering you're using the sites-available / sites-enabled structure, the config (or a symlink to it) needs to actually be in sites-enabled for it to be parsed.
Second, considering you appear to be running NodeBB on port 6379, you might want to try changing the port you used in proxy_pass accordingly -
@a_5mith said:
@Xiph 6379 is the default Redis port. The symlink is the sites-available folder which is inside sites-enabled. Wasn't sure if the symlink should just be the default file or the folder to it.
Oops, my bad. Looks like I misread that, sorry.
As for the symlink, I don't know your setup but generally the sites-available folder is in the same folder as the sites-enabled folder and they aren't inside of eachother.
Could you post your nginx.conf, or did you use a script like Centminmod (in which case I can just look up the defaults)? -
No scripts used. I added the server info above into default of sites-available. Then went into sites-enabled and ran
ln -s ../sites-available
as per @julian's post in one of the other threads, rebooted server/nginx/nodebb.Interestingly, within nginx.conf is the following line
include /etc/nginx/mime.types;
Which doesn't exist.
I've made no changes to nginx.conf or conf.d from the default when you install it.
I may attempt creating two new files instead of using default as people seem to be having more luck with that than I am with this.
-
@a_5mith Does your nginx.conf contain a line that looks like include
/etc/nginx/sites-enabled/*;
? If not, the config might not be parsed, because the only files parsed are nginx.conf and any configuration files specified ininclude
statements.EDIT: I'm not sure about your missing mime.types. You can just extract the default one from the zip, though. (it's in
nginx-x.x.x/conf/
) -
@Xiph
##
# Virtual Host Configs
##include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*;
It does indeed. I will look into including the mine.types that way. If anyone else has any other suggestions while I'm doing that, I'm all ears.
-
@a_5mith So, I'm not entirely sure about this, but as far as I remember wildcards only include the files in the specified directory and not in it's subdirectories.
However, the way you've currently got it setup is that inside of thesites-enabled
folder there's a symlink to thesites-available
folder, which contains the actual config. What happens if you go to thesites-enabled
folder and doln -s /etc/nginx/sites-available/WhatEverYouNamedYourConfig.conf
? (AKA: the direct path to your config file) -
@a_5mith said:
@Xiph The symlink has now changed to default, rather than sites-available, which seems like what I was after, however no change to the actual issue, still can't access without using the port, even though it's off.
Does it give you a 502 Bad Gateway (or other 5xx) error when trying to access the site on the default port, or does it just not load at all?
BTW:listen 80;
will do, no need to include the 0.0.0.0 Sorry for the OCD.
EDIT: Also, just assuming here you posted theserver_name
assite.info
here for privacy reasons. 'cause if that's actually what you're using, that might explain something -
Firefox can't establish a connection to the server at site.info.
The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Waterfox is permitted to access the Web.
Don't even get the default nginx page. Just won't connect.
Have changed the listen 80, saw that someone managed to get it working by adding it, as you can tell, it made no difference to me.
-
@a_5mith said:
Firefox can't establish a connection to the server at site.info.
The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Waterfox is permitted to access the Web.
Don't even get the default nginx page. Just won't connect.
Have changed the listen 80, saw that someone managed to get it working by adding it, as you can tell, it made no difference to me.
Alright, so right now, the main problem appear to be that visitors don't connect to Nginx, at all. If it was just the connection to NodeBB that failed, you would've just gotten a gateway error. The connection between Nginx and NodeBB might be perfectly fine (or not, we don't know yet), but it looks like first we've got to fix Nginx itself.
-
@a_5mith said:
@Xiph I'm inclined to agree. Question: Should I have a conf folder as well as a conf.d, because I don't...
Well, the location for the missing mime.types your configuration specified was not inside a conf folder, so maybe not, but you can't be sure what other stuff might be missing.
Some stuff to maybe check:
server_name
is the same as the domain you're connecting to (duh)- You're only listening on IPv4 right now, so if your machine supports IPv6 and you've got an AAAA record set, or you're running on localhost which might be defined as the IPv6 loopback ::1 instead of the IPv4 loopback 127.0.0.1, TL;DR: if you're accessing the site over IPv6, it probably won't work, because Nginx is currently only listening on IPv4.
- Nginx generally only uses the last version of the configuration that had no errors. If you've changed stuff and Nginx is still complaining when restarting, try fixing it and seeing if it uses the new configuration.
-
Tried both domain & IP, no dice.
Copied mime.types from that conf folder into nginx and now get
nginx: [emerg] "worker_processes" directive is not allowed here in /etc/nginx/mime.types:2
line 2 had
worker_processes 1
This is so much fun. :sarcasm:
-
@a_5mith Your nginx seems to be down because you have a syntax error in your configs:
nginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:26
nginx: configuration file /etc/nginx/nginx.conf
Nginx could not open mime.types . What changes are required?
I use the following to run Nginx : sudo /usr/local/Cellar/nginx/1.2.8/bin/nginx -c /usr/local/Cellar/nginx/1.2.8/nginx.conf It shoots out a error : nginx: [emerg] open() "/usr/local/Cellar/nginx...
Stack Overflow (stackoverflow.com)
Was the directory overwritten?
And earlier I may have made a typo.
sites-available
andsites-enabled
should have the same file structure, and they both should be contained in the same directory. One is not nested inside the other:sites-available \- default # These two files are real files \- mynodebb sites-enabled \- default # These two files are symlinks \- mynodebb
When I said
cd ../sites-enabled && ln -s ../sites-available
, I meant to say:cd ../sites-enabled && ln -s ../sites-available/mynodebb
, which would create a symlink to themynodebb
file insites-available
, insites-enabled
.English
-
Right, I gave up with nginx, so to save my sanity, I went with apache instead. Getting an internal server error when I add the contents of the guide.
Noticed my bind address is 0.0.0.0, so I changed 127.0.0.1 to 0.0.0.0, but it didn't make a difference.
EDIT: Sorted it, now running without port. Followed Digital Oceans own guide on setting this up and it worked first time.
How To Use Apache HTTP Server As Reverse-Proxy Using mod_proxy Extension | DigitalOcean
In this DigitalOcean article, we are going to see set up Apache on Ubuntu 13 and use it as a reverse-proxy to welcome incoming connections and redirect them …
(www.digitalocean.com)