-1

I'm a developer, not a network administrator, so this is not exactly my cup of tea. Help is appreciated.

From one moment to the next, my VPS, running CentOS Linux 7.2.1511, stopped accepting http connections. A simple telnet to one of my hosted domains returns a "Connection refused". while FTP still works and I can also still SSH to the server. I have a total of 17 domains running on this server.

Apache is running (or claims to be running according to Plesk 12.5.30).

When, on the server's command line, I run

/sbin/iptables -L -n

the result is

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

When I to a trace route to one of my hosted domains, the fourteenth hop arrives on my server's IP address, but, after that, only asterisks show up, like so:

15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *

With my hosting provider's support offline from Friday night to, incredibly, Monday morning, I'm very much at a loss as to how to resolve this. Some pointers, suggestions, help, would be very much appreciated.

Update: If I understand this answer correctly, using the following command should tell me whether anything is listening on port 80, which is the default port for http connections:

 ss -tnlp | grep :80

This command returns nothing, which I understand to mean that nothing is listening on port 80.

So, does the question then become, how to get Apache to listen to port 80 again?

Update: I updated httpd.conf and added 'Listen 80', which wasn't there. This worked, somewhat, in that, now, the server was accepting http requests again. However, it was still not showing any websites, but a placeholder page instead. httpd.conf did already have a 'Listen 7080', and, lo, visiting 'http://{{oneofmywebsites}}:7080 works as expected.

So, does the question now become, how to set the server to, by default, serve http requests over port 7080?

Update: This answer mentions a vhost.conf, which I couldn't find. However, it seems that it's possible to define a VirtualHost inside httpd.conf as well. Of the 17 domains I host on this server, there's one that's the 'main' domain, which I take it, in a way, represents the server. (Keep in mind, this is not my cup of tea.)

So, I added the following to httpd.conf:

<VirtualHost *:80>
  ServerName {{mymaindomain}}
  ProxyPass / http://localhost:7080/
</VirtualHost>

After restarting Apache, browsing to http://{{mymaindomain}} now actually serves the associated website. Hurrah! But, browsing to any other domain that I host as well, also goes to the same content (http://{{mymaindomain}}).

If I add another VirtualHost section in httpd.conf, like so:

<VirtualHost *:80>
  ServerName {{someotherdomain}}
  ProxyPass / http://localhost:7080/
</VirtualHost>

Then, the result is that, when browsing to http://{{someotherdomain}}, I get presented with a 'Service Unavailable'.

So now, how do I make sure all websites redirect properly? Wouldn't this be some configuration in Plesk? How is it possible that this stopped working, from one moment to the next, for all my websites?

Update: Quite in above my head, the following applies:

<VirtualHost *:80>
    ServerName {{mymaindomain}}
    ProxyPass / http://localhost:7080/
</VirtualHost>

The above works as I would like it to: browser requests for http://{{mymaindomain}} show the associated website.

<VirtualHost *:80>
    ServerName {{myseconddomain}}
    ProxyPass / http://{{myseconddomain}}:7080/
</VirtualHost>

The above domain is using CloudFlare. Browsing to http://{{myseconddomain}} does not work; CloudFlare is not able to reach the server.

<VirtualHost *:80>
    ServerName {{mythirddomain}}
    ProxyPass / http://{{mythirddomain}}:7080/
</VirtualHost>

The above domain is not using CloudFlare. Browsing to http://{{mythirddomain}} shows the associated website.

I still don't understand what is causing all this, help is still appreciated.

Meanwhile, I could move all domains off CloudFlare, but then I need to somehow set up https, which was working fine, before.

Update: Below, @HardyRust's mentions nginx perhaps listening on port 80.

I executed:

systemctl status nginx.service

Which got me the below. The 'since...' is pretty much when my server stopped working.

● nginx.service - Startup script for nginx service
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2016-10-01 00:23:25 CEST; 1 day 1h ago

Oct 01 00:23:24 {{mymaindomain}} systemd[1]: Starting Startup script for nginx service...
Oct 01 00:23:25 {{mymaindomain}} nginx[1066]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Oct 01 00:23:25 {{mymaindomain}} nginx[1066]: nginx: [emerg] bind() to [{{my ipv6 address}}]:443 failed (99: Cannot assign requested address)
Oct 01 00:23:25 {{mymaindomain}} nginx[1066]: nginx: configuration file /etc/nginx/nginx.conf test failed
Oct 01 00:23:25 {{mymaindomain}} systemd[1]: nginx.service: control process exited, code=exited status=1
Oct 01 00:23:25 {{mymaindomain}} systemd[1]: Failed to start Startup script for nginx service.
Oct 01 00:23:25 {{mymaindomain}} systemd[1]: Unit nginx.service entered failed state.
Oct 01 00:23:25 {{mymaindomain}} systemd[1]: nginx.service failed.

So, why would it not be possible to 'assign requested address'?

Any suggestions are very welcome, and needed. I have no idea what /etc/nginx/nginx.conf is supposed to look like, but its 30 or so lines look like they belong.

MastaBaba
  • 101
  • 1
  • 6
  • can you restart apache ? – silviud Oct 01 '16 at 12:29
  • 2
    Possible duplicate of [What causes the 'Connection Refused' message?](http://serverfault.com/questions/725262/what-causes-the-connection-refused-message) – user9517 Oct 01 '16 at 12:30
  • @silviud: yes, thanks, and I've tried. I've also tried restarting the server. (Could it be Apache is not listening on port 80? I'm updating my question now.) – MastaBaba Oct 01 '16 at 13:02
  • if you can access the config file looks for 'Listen' NUMBER where NUMBER is the port. – silviud Oct 01 '16 at 13:25
  • @silviud, thanks, I updated my question. That works, somewhat. If I now browse to http://{{aurlonmyserver}}, I get to see a placeholder page. httpd.conf already had a line that said 'Listen 7080', and if I visit http://{{aurlonmyserver}}:7080, I actually get to see the website, not a placeholder page. So... how to somehow direct visitors to port 7080 by default? – MastaBaba Oct 01 '16 at 13:35
  • why don't you put your default server 80 with the DocumentRoot to your application - no need to redirect. There are a few ways to configure the server but usually if you have only a website using port 80 with no virtual host is the simplest way. – silviud Oct 01 '16 at 13:38
  • Again, thanks. I'm not sure I follow (I'm not a network admin). I have 17 domains running on this server, not just one. – MastaBaba Oct 01 '16 at 13:47
  • Why are you using a non-default port? – Michael Hampton Oct 01 '16 at 19:29
  • @MichaelHampton: I have no idea. As I said, my server stopped working from one moment to the next. When I figured out that I can find Apache settings in httpd.conf, It was there that I found it was listening on port 7080. And, as I said, if I also tell Apache to listen on port 80, my websites still don't work; I get a placeholder page instead. If I specify the port when browsing, it does work. – MastaBaba Oct 01 '16 at 23:16
  • @MichaelHampton: I just commented out Apache listening to port 7080, keeping it listening on port 80. The domains now resolve, but I get placeholder pages. – MastaBaba Oct 01 '16 at 23:25

1 Answers1

0

Seems like you had something other than apache listening on port 80. Typically that is nginx, that listens port 80, server static requests and proxies all other to apache. You can check it with command:

systemctl status nginx.service

Config should be placed in /etc/nginx/

Proxying from apache to apache is not very good idea - you'd better find, if you have nginx (or haproxy, or lighttpd), that is stopped now.

Hardy Rust
  • 162
  • 4
  • Not clear why you're getting the down vote. It was my understanding that 'ss -tnlp | grep :80' would have told me anything was listening on port 80. That command returned nothing, which I understood to mean nothing was listening. Perhaps the implication is that nginx *should* have been listening on port 80? – MastaBaba Oct 01 '16 at 23:27
  • Also, see my updated question. – MastaBaba Oct 01 '16 at 23:34
  • And, you put me on the right path. Thanks! nginx needed to be started. No idea why it had stopped, though. – MastaBaba Oct 01 '16 at 23:59
  • 1
    "Cannot assign requested address" error mean either missing IP-address in network configuration, or other application listening same port (443 is your case). If there was no actions from you in that time, it is possible, that nginx itself failed to stop correctly and process hanged, using the port and preventing new nginx process to start. That is quite rare case, but i've seen it 3 or 4 times. It may be good idea to update nginx to last mainline version from developers repo. It's stable, and I don't remember to see 1.10 version hanging like that. http://nginx.org/en/linux_packages.html – Hardy Rust Oct 02 '16 at 06:29