Configuration of XAMPP multi-domain, multi-site, and multi-virtual hosts in Mac

Source: Internet
Author: User
Tags mysql command line

OriginalArticle, Reprinted, please indicate the source! Http://www.cnblogs.com/heiniuhaha/archive/2011/10/14/2212478.html

Recently I have been working on Mac. I need to build a debugging section.ProgramYou have selected XAMPP to run multiple sites, multiple domain names, custom directories, and find a lot of information online, there are indeed a lot of text copies, and even some of them have not been written in disorder, so they cannot meet my needs. Therefore, after I configure it successfully, I will write a blog post to record it and prevent forgetting it, secondly, I hope to help some students.

Note: The terminal of this blog post uses zsh, so the interface is somewhat different from Bash, but the commands are basically the same. For details, refer to replacing bash on Mac with zsh.

XAMPP,: http://www.apachefriends.org/en/xampp-macosx.html%849. the value is XAMPP Mac OS X 1.7.3.

1. Edit the hosts file. The directory is/etc/hosts. Open the terminal and obtain the root permission temporarily because the Mac has permission restrictions.

Enter the password. For security reasons, the password does not display the number of occupied digits.Nano EditorAnd pressControl + xExit, pressYConfirm

 

 

3. Modify the XAMPP configuration file

1. Modify the httpd. conf file. The directory is/applications/XAMPP/xamppfiles/etc/httpd. conf. Enter the following command in the terminal:

2. Open the httpd. conf file, press Ctrl + W to search for "httpd-vhosts.conf", remove the # annotator, ensure that the vhosts virtual host configuration file is introduced.

3. Add the following section at the end of httpd. conf:Code

<Directory"/Users/heiniuhaha/sites/Project">
# Options indexes followsymlinks execcgi includes # Don'T permission see list
Options all
AllowOverride all
Order allow, deny
Allow from all
</Directory>

Note:
"Options exist.
"Options indexes followsymlinks execcgi allowed des" is not allowed for directory browsing and is suitable for official sites.

 

4. open the file httpd-vhosts.conf file, the directory is/applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf, enter the command in the terminal as follows:


Enter the password and open the httpd-vhosts.conf file to start editing

After editing, press Ctrl + X to exit, Press Y to save, restart XAMPP, and enter 127.0.0.1 www.server.com www.test.com www.admin.com in the browser to view the content on the page.
You will find that 127.0.0.1 and www.server.com point to the XAMPP boot page, while www.test.com www.admin.com points to different sites.

 

5. MySQL Configuration

When you enter the phpMyAdmin page of MySQL, a blank password error is displayed.

Find the config. Inc. php file. The path is/applications/XAMPP/xamppfiles/PHPmyAdmin/config. Inc. php.

Open the file config. inc. after PHP, find $ cfg ['servers'] [$ I] ['Password'] = '', change to $ cfg ['servers'] [$ I] ['Password'] = '000000'. After saving and exiting, restart XAMPP.

 

Enter the MySQL Command Line

 

 

If you want to enable index.html index. php In a directory rather than in a directory, You need to configure the settings to remove the default settings.

Sudo nano/applications/XAMPP/xamppfiles/etc/httpd. conf

 

------------------ Updated on ---------------------

I encountered the problem of disabling MySQL today.

Access forbidden!

 

New XAMPP Security Concept:

Access to the requested directory is only available from the local network.

This setting can be configured in the file "httpd-xampp.conf ".

 

If you think this is a server error, please contact the webmaster.

Error 403www.server.com
Tue Dec 13 11:00:00 2011
Apache/2.2.14 (UNIX) Dav/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 PERL/v5.10.1

The solution is to disable deny from all.

Sudo nano/applications/XAMPP/xamppfiles/etc/extra/httpd-xampp.conf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.