Paul
Paul

Reputation: 326

Accessing local host from another machine

I have seen many answers on this with what would appear to be simple solutions, none of which are working for me at this time.

I have WAMP install with Apache 2.4.33 32bit installed on a PC. I can access the site on that PC without a problem using the alias mySite.local.

The PC's host file looks like this 127.0.0.1 mySite.local

The remote lap top's host file is 192.168.1.114 mySite.local That is the IP of the PC on the network.

httpd.conf

Listen 80
ServerName mySite.local:80
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "H:/Intranet/mySite_v2_www/public"

httpd-vhosts.conf

<VirtualHost *:80>
  ServerName mySite.local
  DocumentRoot "H:/Intranet/mySite_v2_www/public"
</VirtualHost>

I have tried disabling the windows firewall and virus checker on the PC.

The laptop appears to be getting there but being blocked. The message is..

Forbidden You don't have permission to access / on this server. Apache/2.4.33 (Win32) PHP/7.2.4 Server at mySite.local Port 80

So it looks like it can see Apache but is being blocked. So what else needs to be set to get access to the server?

Here are two of the links that I have been following to try and get this to work Error message "Forbidden You don't have permission to access / on this server" and How do I connect to this localhost from another computer on the same network?

Thanks for any direction you can provide.

Upvotes: 2

Views: 1862

Answers (2)

Miguel Ortiz
Miguel Ortiz

Reputation: 1482

To complement the answer of Paul Neale:

Forbidden You don't have permission to access / on this server. Apache/2.4.33 (Win32) PHP/7.2.4 Server at mySite.local Port 80

That message is an answer from Apache. Disabling the windows firewall and virus checker on the PC won't have any effect, you are already reaching Apache there is not any networking problem.

Apache is receiving your request to access the root folder "public":

H:/Intranet/mySite_v2_www/public

But denies the request because, the directive Require local is enabled. This directive means, you can access to the content of public from the local server (localhost), which is the same to say 127.0.0.0 or localhost.

What you wanted is to tell apache that allows the access of certain IP address to the root directory "public".

When you changed the directive to Require all granted you are telling apache that, no matter who asks, give it access to / (root folder) in other words "public".

So, what you was searching for is "Access Control" in apache, and the directive Require can be used with IP address, here's the main document from Apache, this is an example:

Require host address
Require ip ip.address

It's important to differentiate between Network//Permissions problems. If you want to know if you are able to communicate (At network level) with Apache, you could do:

telnet <IP_APACHE_SERVER> <PORT_APACHE_SERVER>
#example: telnet 172.10.10.2 80

Upvotes: 1

Paul
Paul

Reputation: 326

So after playing around will combinations for a day I found that in the httpd.conf I needed to change Require local to Require all granted in the section.

<Directory "H:/Intranet/mySite_v2_www/public/">
    Options +Indexes +FollowSymLinks +Multiviews
    AllowOverride all
#   onlineoffline tag - don't remove
    # Require local
    Require all granted
</Directory>

Upvotes: 0

Related Questions