I guess I’m somewhat confused then since It appears in the top portion of the above configuration file you still have the local IP address as 0.0.0.0
, and this is incorrect. Here is why:
According to Wikipedia,
In the Internet Protocol Version 4, the address 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown or non-applicable target. This address is assigned specific meanings in a number of contexts, such as on clients or on servers.
Which directly states that the IP address in question is non-routable.
If you don’t know what a non-routable IP address is, Nexor Cybersecurity provides a nice explanation:
The term non-routable just means exactly that; that IP packets cannot be directed from one network to another.
This states that a non-routable IP address cannot direct any packets to any location on any network, be that internal, public, private, virtualized, etc, and as such, effectively states that 0.0.0.0
is a dead-end or “black hole” of sorts for internet information and network data transfer.
You may be thinking “I should google this, this is speaking in networking terms not related to being on a server.” Don’t worry, the following covers specifically using the IP address 0.0.0.0
on servers!
ThreatBrief provides a great explanation in detail of the use of 0.0.0.0 in server networking, however here I include a small paraphrase of the general information, to get the point across:
0.0.0.0 – you may have noticed this IP address several times during your online sojourns. Many users think this IP address belongs to some hackers while others think nothing of it. Tech geeks know that it’s a ‘no particular address’ placeholder’.
While it is true, 0.0.0.0 actually specifies all IP addresses on all interfaces on the systems. It’s a non-routable meta-address that’s used to define an unknown or invalid target. If we talk about servers, 0.0.0.0 means all IPv4 addresses on the local machine. In the case of a route entry, it means the default route.
Your PC will pop up a 0.0.0.0 address when it is not connected to any TCP/IP network because it has to resolve the IP address. By default, if you see a 0.0.0.0 IP address, your PC/laptop is offline. Similarly, if the host PC is unable to resolve IP failure, it may be automatically assigned by DHCP. Once your DHCP is assigned 0.0.0.0, it can’t communicate with any other device over IP. In simple language, it means no internet or intranet access.
So in other terms, even if somehow this was able to be used as a network-connected address, which would require sophisticated reconfiguration of your entire IP tables setup, and could likely severely impact your DHCP and or even static network connections to the public internet, the standard system processing of the 0.0.0.0
IP address is that it is a placeholder and non-routable address. A further note to add is that in the event that it was being detected and parsed as a wildcard, the full range of IP addresses in the IP block 127.0.0.1/32
would all be being searched for a connection to a webserver at the same time which would also result in errors, if not total failure.
That all being said, your Nginx configuration file is functioning as a reverse proxy, which means that it is taking the IP address found in the upstream backend
and listening to that IP address on your local machine and then taking the information and data that it receives from the internal IP address, and porting it to the desired external port. (IE the port you are connecting to from your website, the standard 80, 443, or a custom port. The external port is what is exposed to the world and connected to.)
This is where the issue is.
In the configuration file which you have posted above, the upstream backend
IP address is shown as 0.0.0.0
which is effectively a data black hole. (See below for the snippet of code from your configuration file posted above that shows this)
cat /etc/nginx/conf.d/mattermost
upstream backend {
server 0.0.0.0:4431;
keepalive 32;
}
Instead of being set to 0.0.0.0
this should be a localhost internal IP address, which is most commonly (and by default) 127.0.0.1
or just plainly localhost
. Setting the IP address to either of the two, and ensuring that the Mattermost config.json
file reflects the same listening address (Example of the referenced portion of config.json
shown below is from my personal Mattermost installation)
{
"ServiceSettings": {
"SiteURL": "https://XXXXXXXXXREDACTEDXXXXXXXX",
"WebsocketURL": "",
"LicenseFileLocation": "",
"ListenAddress": ":8065",
"ConnectionSecurity": "",
"TLSCertFile": "",
"TLSKeyFile": "",
"TLSMinVer": "1.2",
"TLSStrictTransport": false,
"TLSStrictTransportMaxAge": 63072000,
"TLSOverwriteCiphers": [],
"UseLetsEncrypt": false,
"LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache",
"Forward80To443": false,
"TrustedProxyIPHeader": [
"X-Forwarded-For",
"X-Real-IP"
],
Seeing that the local port used in your upstream backend
is port 4431, I would suggest just verifying that the port declared in "ListenAddress":
is set as "ListenAddress": ":4431",
As something to note, you may notice that in the mattermost configuration files, there are no options to set the listening IP address. This is more secure because it forces the user to reverse proxy the server’s instance to the public internet, which in principle is a much safer way to do it, not to even mention that there are many other reasons why it’s just better.
I hope this helps, If your still experiencing troubles or I am somehow misunderstanding the issue, I’ll get back to you as soon as I can!