How to configure Apache subsite Activation

Source: Internet
Author: User

Because you do not have your own virtual host, you plan to have your own small database. However, I found that there are many folders in my www root directory, all of which were previously made. I cannot mix my record system with them, right? So I want to open a main site for myself. Therefore, this article is available.
Purpose: Enter "myhost" in the address bar of the browser to open the home page of my record West system.
Implementation:
1. Because I am working on the local machine, I need to modify the host file (c: \ windows \ System32 \ drivers \ etc \ hosts ), add the "myhost" Domain Name (of course you can use any name you want) to point to the local 127.0.0.1.
1 127.0.0.1 myhost
2. Open the Apache configuration file (httpd. conf) and delete # Before Include conf/extra/httpd-vhosts.conf
3. Open 'conf/extra/httpd-vhosts.conf 'under the Apache directory and you can see the default example. here we need to first modify the access permission of the folder
My modifications are as follows: Copy codeThe Code is as follows: <Directory "U:/www/">
Options FollowSymLinks Indexes
Order Allow, Deny
Allow from All
AllowOverride All
</Directory>

First, you need to change the directory path of the permission.
4. Write a new sub-site according to the exampleCopy codeThe Code is as follows: <VirtualHost *: 80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "U:/www/doug /"
ServerName myhost
ServerAlias myhost
ErrorLog "log/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

Note:
The path of the third line is the sub-site path.
Line 4 and line 5 configure the access domain name for your sub-site. Here I use the previously configured myhost
5. When I was using this function, I found that localhost could not be accessed correctly. Then, the solution was to write a subsite for localhost.<Virtualhost> <br/> ServerAdmin webmaster@dummy-host.example.com <br/> DocumentRoot "U: /www/"<br/> ServerName localhost <br/> ServerAlias localhost <br/> ErrorLog" logs/dummy-host.example.com-error.log "<br/> CustomLog" logs/dummy-host.example.com-access.log "common <br/> </virtualhost>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Now you can enter your new domain name (myhost) in the address bar of your browser to access your website.

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.