0

So, pretty newbie in linux, I followed several tipps & tricks from SO and others.

I can't get access to a locale website from another machine (Mac) on the LAN.

My server: Apache Server version: Apache/2.4.7 (Ubuntu) (Linux Mint 17.2 Rafaela).

I have the following Virtual host file:

<VirtualHost *:80>
    ServerName toesslab-new

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/toesslab-new
<Directory /var/www/html/toesslab-new>

  Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1 ::1
  Allow from 127.0.0.1 ::1
  Allow from localhost
  Allow from 192.168
  Allow from 10
  Satisfy Any

</Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

I also tried with <VirtualHost *>with no success.

The virtual host is working fine on my machine by calling: http://toesslab-new/.

Further I've adapted the /private/etc/hosts on the other machine Mac OSX Yosemite 10.10.5 which is on the LAN and wired with the following IP:

en0 -> inetaddr: 192.168.0.12

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.168.0.14    toesslab-new
127.0.0.1       toesslab-new

The IP of the Server is 127.0.0.1 but I'm not sure at all if that is the IP to take or if I have to take my local IP on the wlan:

wlan0 -> inetaddr: 192.168.0.14

so I put them both. After that I did a dscacheutil -flushcache; sudo killall -HUP mDNSResponderon the Mac and naturally a service apache2 restart on my machine.

I won't post all my (stupid) attempts but this one is by far the best.

The result of all that when I call http://toesslab-new/ on the Mac is that the browser loads extremely long time and then gives me an ERR_EMPTY_RESPONSE.

I'm not getting further by reading my log files (access.log) it just shows me normal access things. The error.log entries are outdated so no use either.

When I do a Googling about that I don't get any further either.

  • What IP do I have to enter on the Mac's hosts file?
  • Is my virtual hosts file correct?
  • What else did I missed?

Update after @Trel's answer I adapted the host file as follows with no luck:

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
#127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.168.0.14    toesslab-new
#127.0.0.1       toesslab-new

If I do a ip route get 1 | awk '{print $NF; exit}'on my machine I get 192.168.0.14so that must be the IP to use on the other machine's host file no?


ifconfig output of my machine:

eth0      Link encap:Ethernet  HWaddr 50:46:5d:09:34:b7  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:485452 errors:0 dropped:0 overruns:0 frame:0
          TX packets:485452 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:333999317 (333.9 MB)  TX bytes:333999317 (333.9 MB)

wlan0     Link encap:Ethernet  HWaddr 90:4c:e5:55:94:09  
          inet addr:192.168.0.14  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::924c:e5ff:fe55:9409/64 Scope:Link
          inet6 addr: 2a02:aa15:c300:7100:b8ba:22a8:ddab:3734/64 Scope:Global
          inet6 addr: 2a02:aa15:c300:7100::1/128 Scope:Global
          inet6 addr: 2a02:aa15:c300:7100:e49d:c7a6:20c2:7fa3/64 Scope:Global
          inet6 addr: 2a02:aa15:c300:7100:b001:78b7:b5d7:7a2a/64 Scope:Global
          inet6 addr: 2a02:aa15:c300:7100:924c:e5ff:fe55:9409/64 Scope:Global
          inet6 addr: 2a02:aa15:c300:7100:cd97:9496:59f8:3ccd/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2998367 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2541043 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2181346334 (2.1 GB)  TX bytes:395504593 (395.5 MB)

ifconfig output of the other machine (Mac):

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
    ether a8:20:66:52:48:9d 
    inet6 fe80::aa20:66ff:fe52:489d%en0 prefixlen 64 scopeid 0x4 
    inet6 2a02:aa15:c300:7100:aa20:66ff:fe52:489d prefixlen 64 autoconf 
    inet6 2a02:aa15:c300:7100:8518:985d:c778:d6c8 prefixlen 64 autoconf temporary 
    inet6 2a02:aa15:c300:7100::3 prefixlen 64 dynamic 
    nd6 options=1<PERFORMNUD>
    media: autoselect (1000baseT <full-duplex,flow-control,energy-efficient-ethernet>)
    status: active
en1: flags=8823<UP,BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
    ether 8c:2d:aa:45:1b:f1 
    nd6 options=1<PERFORMNUD>
    media: autoselect (<unknown type>)
    status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether 32:00:13:dd:f8:60 
    media: autoselect <full-duplex>
    status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether 32:00:13:dd:f8:61 
    media: autoselect <full-duplex>
    status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether aa:20:66:25:19:00 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x2
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 6 priority 0 path cost 0
    member: en3 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 7 priority 0 path cost 0
    nd6 options=1<PERFORMNUD>
    media: <unknown type>
    status: inactive
p2p0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 2304
    ether 0e:2d:aa:45:1b:f1 
    media: autoselect
    status: inactive
awdl0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> mtu 1452
    ether 26:5e:59:3d:a2:35 
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: inactive

1 Answer 1

1

127.0.0.1 is a local address

If you put 127.0.0.1 toesslab-new on the machine you're trying to access FROM, it is telling it to use itself for that hostname.

What is the LAN IP of the server with Apache? If you're editing the hosts file to hardcode an entry, that is the IP you need to put.

Additionally, as discussed in chat, ensure that the firewall (UFW by default for Ubunut and Mint) is allowing port 80. You can open that up for TCP with the command sudo ufw allow 80/tcp.

7
  • I only have access over wlan with the machine the server is running on. That is 192.168.0.14. So I've to put only that one in the hosts file?
    – toesslab
    Mar 24, 2016 at 21:20
  • If that's how the server is connected to the network, that's the IP you'll have to use.
    – Trel
    Mar 24, 2016 at 21:26
  • No luck either. When I do a netstat -tulpn it gives me that IP with the port 137. Could that be the issue?
    – toesslab
    Mar 24, 2016 at 21:27
  • Can you get to a console on the server itself? If so, can you give the full output of ifconfig ? Also, is Apache definitely running and set to listen on port 80? (Also run netstat again (same options) but use sudo.)
    – Trel
    Mar 25, 2016 at 14:22
  • thx for getting back to me. 1. How do I get a console on the server itself? 2. I'll put ifconifg in the question. 3. How do I see on which port apache is listening? ... As said newbie in linux ;-(
    – toesslab
    Mar 25, 2016 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .