Linux under Apache server configuration virtual domain name

Source: Internet
Author: User

While looking at one of Laravel's introductory tutorials, the author writes:

Configure the Web site root directory as learnlaravel5/public.

In itself, the root directory for Linux under Apache is set to /var/www/html , while the access directory for Laravel settings is learnlaravel5/public . Directly under the root directory, the access to hit time need to enter a long string, too cumbersome. So think about also configure, like the author, input www.nine.com can also be accessed.

1. Modify Httpd.conf

You can add a virtual domain name to Apache by adding the following code directly at the end of the Apache configuration file:

NameVirtualHost *:80<VirtualHost *:80>        ServerName www.nine.com        DocumentRoot "/var/www/html/learnlaravel/public"        <Directory "/var/www/html/learnlaravel/public">                Options Indexes FollowSymLinks                AllowOverride All                Require all granted        </Directory></VirtualHost>

Of course, a better approach would be to put the above code in a custom file, such as learnlaravel.comf , and then learnlaravel.comf include it httpd.conf in.

2. Modify the Hosts file

Added in hosts127.0.0.1 www.nine.com

Here the method is only suitable for the local test, the release, the corresponding modification.

Reference: http://blog.sina.com.cn/s/blog_94f216d10101l5h6.html

Linux under Apache server configuration virtual domain name

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.