Ask Your Question
2

What could be preventing me from connecting to a local webserver?

asked 2015-03-07 20:20:46 -0600

markito3 gravatar image

The server is running, I see several instances of httpd running under user apache. When I try to point my browser to "localhost", I get:

Firefox can't establish a connection to the server at localhost.

I get the same result for 127.0.0.1 of course.

I do know that I have a firewall running, but I am not sure if that is the problem or not.

edit retag flag offensive close merge delete

Comments

1

You should check systemctl status httpd, journalctl -u httpd, /var/log/httpd/access_log and /var/log/httpd/error_log. Update your answer with the relevant bits (not an overwhelming amount, please :) and we'll help interpret them. The firewall doesn't restrict localhost access, unless you've made a special effort.

randomuser gravatar imagerandomuser ( 2015-03-07 23:07:44 -0600 )edit
> systemctl status httpd
* httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: active (running) since Sat 2015-03-07 21:36:07 EST; 21h ago
  Process: 4890 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 1002 (httpd)
   Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec"
   CGroup: /system.slice/httpd.service
           |-1002 /usr/sbin/httpd -DFOREGROUND
           |-4903 /usr/sbin/httpd -DFOREGROUND
           |-4904 /usr/sbin/httpd -DFOREGROUND
           |-4905 /usr/sbin/httpd -DFOREGROUND
           |-4906 /usr/sbin/httpd -DFOREGROUND
           `-4907 /usr/sbin/httpd -DFOREGROUND

> journalctl -u httpd
...
-- Reboot --
Jan 13 20:05:31 markdesk.localdomain systemd[1]: Starting The Apache HTTP Server...
Jan 13 20:05:40 markdesk.localdomain systemd[1]: Started The Apache HTTP Server.
Jan 16 20:10:20 markdesk.localdomain systemd[1]: Stopped The Apache HTTP Server.
-- Reboot --
Jan 16 ...
(more)
markito3 gravatar imagemarkito3 ( 2015-03-08 19:17:18 -0600 )edit

No obvious clues here... did you put something in /etc/httpd/conf.d/ that should be working?

randomuser gravatar imagerandomuser ( 2015-03-09 20:38:26 -0600 )edit
> pwd
/etc/httpd/conf.d
> ls -l
total 20
-rw-r--r--. 1 root root 2893 Sep  3  2014 autoindex.conf
-rw-r--r--. 1 root root   73 Aug 17  2014 mod_dnssd.conf
-rw-r--r--. 1 root root  366 Sep  3  2014 README
-rw-r--r--. 1 root root 1252 Sep  3  2014 userdir.conf
-rw-r--r--. 1 root root  516 Sep  3  2014 welcome.conf
markito3 gravatar imagemarkito3 ( 2015-03-11 18:03:40 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2015-03-10 03:36:51 -0600

dejan gravatar image

As root, execute something like netstat -lap and check whether httpd is indeed listening on port 80. If it is, maybe for some reason it does not listen on all interfaces. Check the configuration then and see what interface(s) it bounds to.

edit flag offensive delete link more

Comments

Thank you dejan.

I am just getting old and slow. Turns out I had explicitly configured httpd to listen on a non-standard port (8008) rather than good old port 80. But that was a year ago, and I forgot. The netstat thing displayed the problem immediately.

Just to make it explicit, I had made the change in /etc/httpd/conf/httpd.conf, and saved a backup :

> diff httpd.conf.save.0 httpd.conf
42c42
< Listen 80
---
> Listen 8008
markito3 gravatar imagemarkito3 ( 2015-03-11 18:12:04 -0600 )edit
0

answered 2015-03-11 18:19:03 -0600

markito3 gravatar image

See my response to dejan's answer above.

edit flag offensive delete link more
0

answered 2015-03-09 19:52:23 -0600

Kanada gravatar image

Add a TCP exception to your firewall on port 80 and issue a restart command to your web server. Then attempt to connect (check documentation for your server software). If you still can not connect then you know it is not your firewall.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-03-07 20:20:46 -0600

Seen: 1,566 times

Last updated: Mar 11 '15