XAMPP - virtual server setup


Download XAMPP

XAMPP ver. 1.8.3-3 for Mac OS X ver. 10.9.2


Initial setup


Initially, XAMPP has one address, this is localhost.
When loading, a page with information about the server, PHP versions with links to phpmyadmin, etc. should open.

To create your Apache VirtualHosts

1 host . Open the configuration file - /Applications/XAMPP/xamppfiles/etc/httpd.conf

1.1. Change User daemon to User username (p. 173)

171      #running httpd, as with most system services. 
172      # 
173      User daemon 
174      Group daemon 
175  </IfModule> 

where username is your Mac OS X username

171      #running httpd, as with most system services. 
172      # 
173      User username
174      Group daemon 
175  </IfModule>  

1.2. Enable VirtualHosts - Uncommenting (p. 488)

  • Include etc / extra / httpd-vhosts.conf

487    #Virtual hosts
488    #Include etc/extra/httpd-vhosts.conf

remove the grid before Include

487    #Virtual hosts                  
488    Include etc/extra/httpd-vhosts.conf 


2. Add your own hosts - open the file - /Applications/XAMPP/etc/extra/httpd-vhosts.conf

2.1. To leave the local host running unchanged

#localhost 
<VirtualHost *:80> 
    ServerName localhost 
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" 
    <Directory "/Applications/XAMPP/xamppfiles/htdocs"> 
        Options Indexes FollowSymLinks Includes execCGI 
        AllowOverride All 
        Allow From All 
        Order Allow,Deny 
    </Directory> 
</VirtualHost> 

2.2. Connect your site - create site folder site.local (example)
username - your Mac OS X username
- let it
go to site folder site.local - site folder

#My custom host 
<VirtualHost *:80> 
    ServerName site.local 
    DocumentRoot "/Users/username/folder/site.local" 
    <Directory "/Users/username/folder/site.local"> 
        Options Indexes FollowSymLinks Includes ExecCGI 
        AllowOverride All 
        Require all granted 
    </Directory> 
    ErrorLog "logs/site.local-error_log" 
</VirtualHost> 

The AllowOverride None directive is necessarily replaced with AllowOverride All, otherwise the .htaccess file will not be read by the Apache

3 server . You must specify the Mac OS X system where the virtual sites are located.
In the terminal, enter the command:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit / etc / hosts

Add the line to the end of the hosts file: 127.0.0.1 site.local

#XAMPP    VirtualHost  
127.0.0.1        site.local 

Restart XAMPP and virtual hosts are added.

on localhost - opens XAMPP
on site.local - already opens our site.

Done!

Also popular now: