Apache Open Sub-site configuration method _linux

Source: Internet
Author: User
Because there is no own virtual host, so it is intended to exist on their own small Ben. However, found that their own WWW root directory there are many folders, are previously done things, can not put their own records system and they mix it? So I wanted to open a main site for myself. So with this article.
Objective: To open the homepage of my own records West system after entering "Myhost" in the browser address bar.
Realize:
1, because I am doing in this machine, so need to modify the host file (c:\windows\System32\drivers\etc\hosts), add "myhost" Domain name (of course you can use any you want to use the name) to point to the local 127.0.0.1.
1 127.0.0.1 myhost
2, open the Apache configuration file (httpd.conf) will include conf/extra/httpd-vhosts.conf before the # Delete
3, open the "conf/extra/httpd-vhosts.conf" under the Apache directory can see the default example, where we want to first modify the access rights of the folder
I revise as follows:
Copy Code code as follows:

<directory "u:/www/" >
Options FollowSymLinks Indexes
Order Allow,deny
Allow from all
AllowOverride All
</Directory>

First act you want to change the directory path of permissions
4, according to the example to write a new subweb
Copy Code code as follows:

<virtualhost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "u:/www/doug/"
ServerName Myhost
Serveralias Myhost
ErrorLog "Logs/dummy-host.example.com-error.log"
Customlog "Logs/dummy-host.example.com-access.log" common
</VirtualHost>

Here you need to note:
The path to the third row is the subweb path
The four and fifth acts you set up for the subweb access domain name, where I used to set up before the Myhost
5, when I use, turn on this feature, found that localhost can not be properly accessed, after the solution is here also for localhost write a subweb
<virtualhost *:80> ServerAdmin webmaster@dummy-host.example.com documentroot "u:/www/" ServerName localhost serv Eralias localhost ErrorLog "logs/dummy-host.example.com-error.log" Customlog "logs/" Dummy-host.example.com-access.log "Common </VirtualHost>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

You can now visit your station by typing your new domain name in the browser's address bar (here is myhost).

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.