my first post so please be gentle . I'm just learning about web development and am already struggling with just the basics set-up.
MacBook Air
OSX 10.8.2
XAMPP 1.8.3-2
Firefox, Chrome, Safari, all the latest versions.
Everything seems to work when I use "htdocs" as root folder to test my php code (EXTREMELY basic level still). Quickly I learned that this way I can only have one site (and one index.php file which loads on entering "localhost" if I'm not mistaken). I decided to change this as I learned about VirtualHosts feature and changed the directory where Apache looks for files.
1. I edited httpd.conf file
2. then httpd-vhosts.conf file
3. and finally hosts.
4. restarted apache
5. started Chrome, in address bar I wrote: localhost - nothing. "Oops! Google Chrome could not find localhost" I also tried http://probniphp.local - "Oops! Google Chrome could not find localhost"
Any idea what went wrong? Below is the code I tinkered with:
httpd.conf file
- Code: Select all
DocumentRoot "/Users/EdChigliak/Websites"
<Directory "/Users/EdChigliak/Websites">
httpd-vhosts.conf (commented out 2 dummy hosts and added my custom one) file
- Code: Select all
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.example.com"
# ServerName dummy-host.example.com
# ServerAlias www.dummy-host.example.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
#</VirtualHost>
#<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host2.example.com
#DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host2.example.com"
#ServerName dummy-host2.example.com
#ErrorLog "logs/dummy-host2.example.com-error_log"
#CustomLog "logs/dummy-host2.example.com-access_log" common
#</VirtualHost>
#localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/htdocs"
<Directory "/Applications/XAMPP/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>
# My custom host
<VirtualHost *:80>
ServerName probniphp.local
DocumentRoot "/Users/EdChigliak/Websites/probniphp"
<Directory "/Users/EdChigliak/Websites/probniphp">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
ErrorLog "logs/mysite.local-error_log"
</VirtualHost>
hosts file
- Code: Select all
#Virtual Hosts 127.0.0.1 probniphp.local
Thank you all in advance!