Apache Config domain name point

Source: Internet
Author: User
Tags tld
<span id="Label3"></p><p><p><virtualhost *:80><br>ServerAdmin [email protected]--admin Email (you can write a random one)<br>DocumentRoot "/home/phpok-com"--site Directory<br>ServerName example.com--the domain name to bind<br>Serveralias www.example.com--the alias to bind, if there are multiple aliases separated by commas<br>Customlog logs/example.com_custom_log--user log Format (this line can also be empty)<br>Errorlog logs/example.com_error_log--error log (can also be Empty)<br></VirtualHost></p></p><p>Steps:<br>1. Modify httpd.conf<br>Remove the # # # # # conf/extra/httpd-vhosts.conf in front of it This means that the httpd.conf file contains httpd-vhosts.conf This configuration file, which is an expression of the Apache configuration modularity, not much to say Here.<br><br>Look for the servername in the httpd.conf, if the servername setting is not the domain name www.abc1.com, then change to servername www.abc1.com, If you want to use SSL and other things, then instead of servername www.abc1.com:80, is to add a port.<br><br>2. Modify httpd-vhosts.conf<br><br>Add the following code (some may be in the file, you can change it):<br><br>Namevirtualhost *<br><br><virtualhost *><br>DocumentRoot "c:/aic"<br>ServerName www.abc1.com<br>Serveralias abc1.com *.abc1.com<br></VirtualHost><br><br><virtualhost *><br>DocumentRoot "c:/aic/mybbonline"<br>ServerName www.efg2.com<br>Serveralias efg2.com *.efg2.com<br></VirtualHost><br><br>It is worth noting that VirtualHost is in order, the first virtualhost of our default site domain name, where the documentroot and servername must be the same as in httpd.conf, including the Port.<br><br>DocumentRoot is the path to the virtual host<br><br>And Serveralias is the alias of the domain name, configured this, Then some two-level domain names can be virtual host Resolution. such as *.efg2.com can represent bbs.efg2.com or news.efg2.com and so On.<br><br>-----------------------------------------------------------------<br><br>The general form of a virtual host such as (extra/httpd-vhosts.conf):<br><br>Namevirtualhost *:80<br><br><virtualhost *:80><br>ServerName Www.domain.tld<br>Serveralias Domain.tld *.domain.tld<br>Documentroot/www/domain<br></VirtualHost><br><br><virtualhost *:80><br>ServerName Www.otherdomain.tld<br>Documentroot/www/otherdomain<br></VirtualHost><br><br>This is an example in the apache2.2 Chinese reference manual. In general we have no problem configuring this in the previous Version. But it's not the same now. When accessing a page under a virtual host, something like: "403 (no access), You can't view the page ..." Error. This is obviously a prompt to deny Access. It is easy to find the following from experience (httpd.conf):<br><br><directory/><br><br>Options FollowSymLinks<br><br>AllowOverride None<br><br>Order Deny,allow<br><br>Allow deny from all after first refusal<br>Deny All Access </Directory><br><br><br>This part is the access control of the directory, it is clear that this is very strict, so we have to manually join the virtual machine directory permissions control block, so that users can access the virtual machine directory and page Files. There are two places to join the virtual Directory Access control Block: Master Profile httpd.conf and virtual machine profile httpd-vhost.conf, No doubt we choose the virtual machine configuration file, mainly to maintain more convenient. Then we insert the Directory access control block into the virtual machine configuration file, so that our virtual host configuration file is similar to the following:<br><br><virtualhost *:80><br><br>DocumentRoot "e:/web"<br>ServerName Www.domain.tld<br><directory "e:/web" ><br>Insert Start<br>Options-indexes FollowSymLinks<br>AllowOverride None<br>Order Allow,deny<br>Allow from all<br></Directory><br>Insert End </VirtualHost><br><br>After this configuration is complete, we use the APACHECTL command and the associated parameters to detect if there is a problem with the configuration File. After confirming the error, restart the Apache Service. Then use the browser to access the test (hehe!) It's crap again! )。 If not, then check your page file permissions set is too high, resulting in no access! Of course, This is a rare scenario under windows, and can typically occur in a Linux Environment.</p><p><p>Apache Config domain name point</p></p></span>

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.