0

I have set up a virtual debian machine that I am running on my windows box (using VirtualBox) for a development LAMP stack. Today when I try to load up a dev website from my windows machine the browser isn't getting a response from my VM. I'm not much of a linux admin; here's what i can tell you:

  1. The browser never gets a response, but it doesn't get any 500 errors either. It just sits spinning its wheels..
  2. Yesterday I did some work on the VM to build the php imagick.so executable so I could work with some pdf editing libraries. The changes were (ultimately) basically these:

    • $ apt-get update php5-devel
    • $ apt-get update make
    • $ apt-get install php-pear
    • $ apt-get install libmagickwand-dev
    • $ pecl install imagick
  3. Before I made those changes, I made a snapshot of my working VM. When I ran into this problem, I shut down my modified VM and started up my earlier snapshot. This makes no difference - same web server problem.

  4. From my windows machine I can ping my VM at the expected ip (192.168.1.222)
  5. However, I cannot ping port 80. I get a "could not find host 192.168.1.222:80 response.
  6. Previously I was able to restart apache without any apparent problems, but a moment ago when I did /etc/init.d/apache2 stop then start, I got this for the first time:

Edit: updated question after restarting apache as root

Stopping/starting server:

root@debian:/home/brd# /etc/init.d/apache2 stop
Stopping web server: apache2 ... waiting .
root@debian:/home/brd# /etc/init.d/apache2 start
Starting web server: apache2.

Apache seems to restart without complaint

root@debian:/home/brd# tail /var/log/apache2/error.log
Failed loading /usr/lib/php5# ls 20090626+lfs/xdebug.so:  /usr/lib/php5# ls 20090626+lfs/xdebug.so: cannot open shared object file: No such file or directory
Failed loading /usr/lib/php5# ls 20090626+lfs/xdebug.so:  /usr/lib/php5# ls 20090626+lfs/xdebug.so: cannot open shared object file: No such file or directory
[Thu Mar 14 09:27:16 2013] [notice] caught SIGTERM, shutting down
Failed loading /usr/lib/php5# ls 20090626+lfs/xdebug.so:  /usr/lib/php5# ls 20090626+lfs/xdebug.so: cannot open shared object file: No such file or directory
[Thu Mar 14 09:27:22 2013] [error] python_init: Python version mismatch, expected '2.6.5+', found '2.6.6'.
[Thu Mar 14 09:27:22 2013] [error] python_init: Python executable found '/usr/bin/python'.
[Thu Mar 14 09:27:22 2013] [error] python_init: Python path being used '/usr/lib/python2.6/:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload'.
[Thu Mar 14 09:27:22 2013] [notice] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[Thu Mar 14 09:27:22 2013] [notice] mod_python: using mutex_directory /tmp
[Thu Mar 14 09:27:22 2013] [notice] Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze15 with Suhosin-Patch mod_python/3.3.1 Python/2.6.6 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations

xdebug error seems to exist:

root@debian:/home/brd# ls /usr/lib/php5/20090626+lfs/ -al
total 1836
drwxr-xr-x 2 root root   4096 Mar 13 15:29 .
drwxr-xr-x 5 root root   4096 Mar 12 17:07 ..
-rw-r--r-- 1 root root 866513 Mar 13 15:29 imagick.so
-rw-r--r-- 1 root root 109220 Mar  4 09:23 mysqli.so
-rw-r--r-- 1 root root  42352 Mar  4 09:23 mysql.so
-rw-r--r-- 1 root root  26116 Mar  4 09:23 pdo_mysql.so
-rw-r--r-- 1 root root  87588 Mar  4 09:23 pdo.so
-rw-r--r-- 1 root root 141336 Aug 19  2010 suhosin.so
-rw-r--r-- 1 root root 561230 Jul  8  2010 xdebug.so

Apache seems to be running..

root@debian:/home/brd# ps aux | grep apache
root      2338  0.0  0.6  45448 12696 ?        Ss   10:51   0:00 /usr/sbin/apache2 -k start
www-data  2346  0.0  0.3  45448  6536 ?        S    10:51   0:00 /usr/sbin/apache2 -k start
www-data  2347  0.0  0.3  45448  6536 ?        S    10:51   0:00 /usr/sbin/apache2 -k start
www-data  2348  0.0  0.3  45448  6536 ?        S    10:51   0:00 /usr/sbin/apache2 -k start
www-data  2349  0.0  0.3  45448  6540 ?        S    10:51   0:00 /usr/sbin/apache2 -k start
www-data  2350  0.0  0.3  45448  6536 ?        S    10:51   0:00 /usr/sbin/apache2 -k start
root      2358  0.0  0.0   3304   764 pts/0    S+   10:52   0:00 grep apache

httpd listening on port 80?

root@debian:/home/brd# ss -nal | grep 80
0      128                           :::80                           :::*

check firewall

root@debian:/home/brd# iptables -n -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

'Listen' directives from /etc/apache2/ports.conf (there is no Listen directive in /etc/apache2/apache2.conf)

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

And yet..

I still cannot ping port 80 from my windows machine. From here, I don't know where to go. Suggestions?

doub1ejack
  • 537
  • 1
  • 6
  • 12
  • I fixed the formatting; apparently it gets confused when you use a code within a numbered list, so I added some headers in between. – Jenny D Mar 14 '13 at 14:41
  • Try to replace `Listen 80` with `Listen 192.168.1.222:80` and then `/etc/init.d/apache2 restart` – gevial Mar 14 '13 at 16:53

2 Answers2

2

Take a look at this line when starting apache2:

Permission denied: make_sock: could not bind to

You need to have root privileges to start daemon, which binds to port number less than 1024.

Try sudo /etc/init.d/apache2 start

gevial
  • 1,264
  • 8
  • 13
  • Thanks for the catch. However, restarting as root doesn't help me reach port 80 from my windows machine. See my edits above. – doub1ejack Mar 14 '13 at 15:00
  • Check if `httpd` is listening port 80: `ss -nal | grep 80` or `netstat -atnl | grep 80`. And also check firewall: `iptables -n -L -v` – gevial Mar 14 '13 at 15:04
  • 1
    And yes, you cannot `ping` port, so "could not find host 192.168.1.222:80" would be forever - because there is no such host. Try to open it in browser ot `telnet 192.168.1.222 80` from `cmd.exe` – gevial Mar 14 '13 at 15:06
  • Added results of port and firewall checks, but they don't mean much to me.. – doub1ejack Mar 14 '13 at 15:56
  • Oh, I see. Everything is fine with the firewall, but your `apache2` is listening port 80 only on IPv6 wildcard address. You need to make it listening IPv4. Please add to your post the value of `Listen` directive from `/etc/apache2/apache2.conf` or `/etc/apache2/ports.conf`. – gevial Mar 14 '13 at 16:07
  • OK, try to replace `Listen 80` with `Listen 192.168.1.222:80` and then `/etc/init.d/apache2 restart` – gevial Mar 14 '13 at 16:48
  • Did that and it works now. The browser hung for ~2 minutes the first time, but now the site loads quickly and seems to work well. Can't imagine why this wasn't an issue earlier as I have never manually changed that directive... – doub1ejack Mar 14 '13 at 17:05
  • 1
    When `apache2` starts, it tries to bind itself to any possible addresses port 80. If you start `apache2` when no IPv4 configured interfaces available, it might cause an issue. – gevial Mar 14 '13 at 17:07
0

You didn't stopped/started your Apache, as you were logged as normal user, or there's another web server running on port 80.

  • My goof. Unfortunately restarting as root doesn't give me any leads - apache seems to be running fine on the VM – doub1ejack Mar 14 '13 at 15:01