📜 ⬆️ ⬇️

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 that is localhost.
When loading - the page with information about the server, PHP versions with links to phpmyadmin, etc. should open.

To create your Apache VirtualHosts host

1. 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)


 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.local site folder (example)
username is your Mac OS X username
folder - let the 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 must be replaced with AllowOverride All, otherwise the .htaccess file will not be read by the Apache server.

3. You need to 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 a 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.

localhost - opens XAMPP
by site.local - our site opens.

Done!

Source: https://habr.com/ru/post/439994/