Mac configures multiple virtual hosts for APACHE2 servers

Source: Internet
Author: User

Mac configures multiple virtual hosts for the Apache2 server when we do the project sometimes need to operate multiple projects at the same time, but the Apache server defaults only provide a root directory, this time is more troublesome, we can configure multiple virtual host to achieve this problem 1. Edit the apache2 configuration file sudo vim/etc/apache2/httpd.conf and then cancel the comment line so that the virtual host is enabled.




2. Edit sudo vim/etc/apache2/extra/ httpd-vhosts.conf configuration of the virtual host directory you want, it is recommended to set the virtual directory in the same directory, because the next to configure the directory permissions, if not configured in the same directory, each configuration directory to set permissions to access the more troublesome.




3. Do not forget to open the set host address permissions, or error forbidden errors, so to open the directory in httpd-vhosts.conf or http.conf file access permissions, the system default address is/library/ webserver/documents/, all I have is to configure all the directories to/library/webserver/, so as long as the permissions to open the/library/webserver/directory is OK.




4. The final step, but also the most important step, is to add the 127.0.0.1 hostname in the vhosts file, which is configured to point to the host address you configured 127.0.0.1 (native address), sudo vim/etc/hosts.

sudo apachectl-k start start

sudo apachectl-k stop stop

sudo apachectl-k restart restart

Mac configures multiple virtual hosts for APACHE2 servers

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.