Clean install of Apache but can't access it via lan client

6,672

The problem is not with your firewall but with your apache configuration.

As, muru explained correctly, you can see by this line:

tcp6       0      0 :::80                   :::*                    LISTEN      19199/apache2  

that apache is listening on both ipv4 and ipv6.

Since you mentioned it is working from localhost I would suggest checking your network configuration.

Share:
6,672

Related videos on Youtube

Charlie
Author by

Charlie

Nerdy, back-end software engineer with a passion for family, friends, business, cheese enchiladas & quality woodworking. SOreadytohelp

Updated on September 18, 2022

Comments

  • Charlie
    Charlie over 1 year

    I've been fighting this issue for a couple days now and am at whits end, so any help would be great. I have several computers in the office. One is now a Ubuntu Server that I'm setting up for a web-based application. The rest are a mix of Windows 7 and Apples. I can't access the Ubuntu LAMP through the other client browsers with the IP. I get a 'Page Not Found' error after spinning for a while. I'm not interested in the Ubuntu server being accessible from WAN, only LAN.

    Setup on the Ubuntu Server: I nuked a hard drive and installed a fresh version of 15.04 so it's the only OS on the system. I installed xrdp to enable remote desktop control. That installed without a hitch. I ran this apt-get install lamp-server^ to install the LAMP stack. That installed without a hitch. I haven't changed any of the conf files. This is what I show when I run ufw status:

    root@ubuntuserver:/# ufw status
    Status: inactive
    

    This is what my iptables looks like when I run iptables -L:

    root@ubuntuserver:/# iptables -L
    Chain INPUT (policy ACCEPT)
    target    prot  opt  source          destination
    ACCEPT    tcp   --   anywhere        anywhere           tcp dpt:ssh
    ACCEPT    tcp   --   anywhere        anywhere           tcp dpt:http
    
    Chain FORWARD (policy ACCEPT)
    target    prot  opt  source          destination
    
    Chain OUTPUT (policy ACCEPT)
    target    prot  opt  source          destination
    

    This is what netstat shows for netstat -ntlp:

    root@ubuntuserver:/# netstat -ntlp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      17201/mysqld   
    tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1227/dnsmasq   
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      11437/sshd     
    tcp        0      0 127.0.0.1:5910          0.0.0.0:*               LISTEN      1742/Xvnc      
    tcp        0      0 127.0.0.1:3350          0.0.0.0:*               LISTEN      1594/xrdp-sesman
    tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      1590/xrdp      
    tcp6       0      0 :::80                   :::*                    LISTEN      19199/apache2  
    tcp6       0      0 :::22                   :::*                    LISTEN      11437/sshd
    

    Sometimes if I service apache2 reload then I can access the It Works page from my Windows 7 computer once. But only once. If I try to navigate to the phpinfo.php page, it times out. Or vice versa if I try to access the phpinfo.php page first, then I can't get to the It Works page.

    On the Ubuntu server, I can access any number of pages through localhost and the IP 172.19.0.15. I don't have that same kind of success via other computers in the office, though. And because it's a web-based app that they'll need to access, I need that access.

    What am I missing?

    EDIT 1

    Taking Ben's advice, I've edited the ports.conf file to read:

    #Listen 80
    Listen 0.0.0.0:80
    

    I've restarted the Apache2 service and this is what the netstat now looks like:

    tcp    0    0  0.0.0.0:80    0.0.0.0:*     LISTEN     9342/apache2
    

    However, I'm still getting the same behavior. I was able to access the phpinfo.php or the It Works! page once, then I couldn't navigate to another page.

    I did read about editing the <Directory> entry in apache2.conf. Currently it reads:

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
    </Directory>
    <Directory /usr/share>
        AllowOverride None
        Require all denied
    </Directory>
    <Directory /var/www>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
    

    But again, I haven't changed this from the default. That and the localhost works fine... Any other thoughts?

    EDIT 2

    Here's the contents of my 000-default.conf file:

    <VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port t$
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com
    
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www
    
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
    
        #LogLevel info ssl:warn
        #LogLevel info ssl:warn
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    

    I restarted the server and still can't access it using the IP from a LAN computer.

    • cargo
      cargo almost 9 years
      Listen 0.0.0.0:80 binds it to ipv4 addresses, it might be worth going back to Listen 80 while trouble shooting. What does your Virtual hosts directive look like. The Ubuntu default they should be in /etc/apache2/sites-enabled
    • Charlie
      Charlie almost 9 years
      I changed the Listen back to just 80 and have included the contents of the Virtual Hosts directive above. Please see the edit of the OP. Thanks Cargo
    • gone
      gone about 4 years
      I had similar symptoms in U16 immediately after upgrading from U14, though everything worked under U14. In my case, whilst UFW was inactive, I had iptables setting firewall rules at boot (something I setup when I did my initial install on U10), and it turned out that somehow I had missed opening ports 80 and 443. What made this difficult to debug was that, for some reason, under U14, everything worked fine and I had forgotten about iptables thinking UFW was doing all the work.
  • Charlie
    Charlie almost 9 years
    Please see the edit above. I changed it, however, I still can't access the Ubuntu from a LAN client using a browser and the IP.
  • muru
    muru almost 9 years
    -1: This output indicates Apache listens on all interfaces. It shows only :: because IPv4 is handled by addresses mapped to IPv6, which works fine on Linux.
  • Charlie
    Charlie almost 9 years
    It ended up being a firewall that was upstream from me. Got that configured and things are working well now! Thanks for the tip!