Reprint: Mac system XAMPP configuration virtual Host

Source: Internet
Author: User

After installing XAMPP, want to add a virsualhost, always error. Check for a half-day information, are nonsense, and later saw a foreign article, finally out, tidy up a bit.

The first step is to configure the local hosts

sudo vi/etc/hosts

Add your domain name at the back xxx.com

127.0.0.1 xxx.com

The second step is to enable the Apache Virtual Host feature

Open configuration file vi/applications/xampp/xamppfiles/etc/httpd.conf

Find the following line, remove the front #

#Include/applications/xampp/etc/extra/httpd-vhosts.conf

The third step is to configure the virtual host

First open the configuration file vi/applications/xampp/etc/extra/httpd-vhosts.conf

Empty the contents of the content, because it is newly installed, do not empty or can

First the virsualhost of the localhost configuration, or it will be wrong, is usually stuck here. My website editor has the problem, view the page source code can see the configuration file.

Default Virtual Host

<virtualhost *:80>

ServerName localhost

DocumentRoot "/applications/xampp/xamppfiles/htdocs"

<directory "/applications/xampp/xamppfiles/htdocs" >

Options Indexes FollowSymLinks includes execcgi

AllowOverride All

Require all granted

</directory>

</virtualhost>

Then add your own virtual host

<virtualhost *:80>

ServerName mysite.local

DocumentRoot "/users/yourusername/path/to/your/site"

<directory "/users/yourusername/path/to/your/site" >

Options Indexes FollowSymLinks includes execcgi

AllowOverride All

Require all granted

</directory>

Errorlog "Logs/mysite.local-error_log"

</virtualhost>

Fourth step if you restart Apache after the above steps, there are 403 errors and you will find/applications/xampp/xamppfiles/etc/httpd.conf

Modify the user and group inside, users change to your computer's username, group changed to staff

That is

#User Daemon

User mac

#Group Daemon

Group Staff

Reprint: Mac system XAMPP configuration virtual Host

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.