Reputation: 261
I am using Apache VirtualHosts with 2 local domains on my home computer for development & testing.
• d4damage.local (personal websites)
• company.local (work stuff on external drive)
It's working perfectly on my network. However, I also need to optionally access d4damage.local
via IP 192.168.1.60
(my computer is fixed to this IP)
The reason is my PS3 cannot resolve d4damage.local
, but it can via IP. (all my other wi-fi devices are fine using d4damage.local
)
It seems I can set d4damage.local
to work on IP or name, but not both. (403 forbidden) the commented lines show the alternatives.
httpd-vhosts.conf
#NameVirtualHost 192.168.1.60:80
#<VirtualHost 192.168.1.60:80>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/Users/paul/Sites"
ServerName d4damage.local
ErrorLog "/private/var/log/apache2/d4damage.local-error_log"
CustomLog "/private/var/log/apache2/d4damage.local-access_log" common
</VirtualHost>
httpd.conf
ServerName d4damage.local
...
DocumentRoot "/Users/paul/Sites"
<Directory "/Users/paul/Sites">
hosts
127.0.0.1 localhost
192.168.1.60 company.local d4damage.local
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
The above files concern the main domain i wish to use on my computer, the company.local
one is additional & i don't need to access that via IP.
Hope you can help! Thanks.
Upvotes: 3
Views: 9132
Reputation: 261
ah ha! I have found the issue.
I had (carelessly) left the example vhosts dummy-host.example.com
in the vhosts file & simply commenting that block out has fixed the problem. I assume that because the dummy name/directory is not defined in httpd.conf & therefore causes a misconfiguration.
So the answer is to make sure you remove or comment-out the dummy examples in httpd-vhosts.conf
Upvotes: 0
Reputation: 1243
you will want to edit your hosts file, commonly found ´/etc/hosts´.
sudo nano /etc/hosts
and new line like this:
192.168.1.60 d4damage.local
Save the file and reboot.
Upvotes: 3