Mac OSX Virtual Host configuration

Source: Internet
Author: User

1. Open "terminal (terminal)", enter sudo apachectl-v, this command shows Apache version 2, open Apache, enter sudo apachectl start, open, enter vi/etc/hosts, view 1  27.0.0.1 corresponds to localhost, enter localhost in the browser address bar to display it works! Description Apache open successfully, Apache root directory is located under "/library (Resource library)/webserver/documents/"

The installation directory for Apache is:/etc/apache2/,etc is hidden by default. You can enter "OPEN/ETC" in terminal to open

3. Setting up a virtual host
    1. Run "" At Terminal sudo vi /etc/apache2/httpd.conf to open the Apche configuration file
    2. Find "" In httpd.conf #Include /private/etc/apache2/extra/httpd-vhosts.conf , click ' i ', go to edit mode, remove the previous " " comment, turn on the virtual host function, then press ' ESC ', then ' shift ' + ': ' Input ': Wq.
    3. Run " sudo apachectl restart ", after restarting Apache, the virtual Host Configuration feature is turned on.
    4. Run " sudo vi /etc/apache2/extra/httpd-vhosts.conf ", the configuration virtual host file httpd-vhost.conf is opened and the virtual host is configured.
    5. Locate the Set up virtual host sample, and comment out the # number before adding
    6. Add your own virtual host configuration, such as, where 80 is the port number, servername for the project to open in the browser name, documentroot as the file path, if the Laravel framework, the path to public, the following two items are error log and user log path settings.
7, set the host file, command line input ' vi/etc/hosts ', add servername to 127.0.0.1, such as this project, add 127.0.0.1 mch.rrd.com 8, restart Apache server, command line input ' sudo AP  Achectl Restart ' 9, browser input servername you can see the project in the browser! Reference for configuring a virtual host in Mac OS X

Mac OSX Virtual Host configuration

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.