"Go" ubuntu+apache bind multiple domain names

Source: Internet
Author: User

1. Resolve the DNS of http://www.a.com and http://www.b.com to your server IP.

2. Remove the Apache default host configuration file. You also do not want to create 2 virtual host after people can also directly access/var/www/bar;
Enter/etc/apache2/sites-enabled/; Delete the 000-default file.

3. In the/etc/apache2/sites-enabled/directory, create 2 files with VI. File name with www.a.com.conf; Www.b.com.conf
Fill in the following code into the www.a.com.conf:

1 <VirtualHost*:80>2 ServerName www.a.com3 ServerAdmin [email protected]4 documentroot/var/www/www.a.com5    <Directory/>6 Options followsymlinks7 allowoverride None8    </Directory>9    <Directory/var/www/www.a.com/>Ten Options Indexes followsymlinks multiviews One allowoverride None A Order Allow,deny -  allow from all -    </Directory> the  - scriptalias/cgi-bin//usr/lib/cgi-bin/ -    <Directory"/usr/lib/cgi-bin"> - allowoverride None + Options +execcgi-multiviews +symlinksifownermatch - Order Allow,deny +  allow from all A    </Directory> at  - #ErrorLog ${apache_log_dir}/error.log -  - # Possible Values Include:debug, info, notice, warn, error, Crit, - # Alert, Emerg. - LogLevel warn in  - #CustomLog ${apache_log_dir}/access.log Combined to  + alias/doc/"/usr/share/doc/" -     <Directory"/usr/share/doc/"> the Options Indexes multiviews followsymlinks * allowoverride None $ Order Deny,allowPanax Notoginseng Deny from all - Allow from 127.0.0.0/255.0.0.0:: 1/128 the     </Directory> +  A </VirtualHost>
www.a.com.conf
1 <VirtualHost*:80>2 ServerName www.b.com3 ServerAdmin [email protected]4 documentroot/var/www/www.b.com5    <Directory/>6 Options followsymlinks7 allowoverride None8    </Directory>9    <Directory/var/www/www.b.com/>Ten Options Indexes followsymlinks multiviews One allowoverride None A Order Allow,deny -  allow from all -    </Directory> the  - scriptalias/cgi-bin//usr/lib/cgi-bin/ -    <Directory"/usr/lib/cgi-bin"> - allowoverride None + Options +execcgi-multiviews +symlinksifownermatch - Order Allow,deny +  allow from all A    </Directory> at  - #ErrorLog ${apache_log_dir}/error.log -  - # Possible Values Include:debug, info, notice, warn, error, Crit, - # Alert, Emerg. - LogLevel warn in  - #CustomLog ${apache_log_dir}/access.log Combined to  + alias/doc/"/usr/share/doc/" -     <Directory"/usr/share/doc/"> the Options Indexes multiviews followsymlinks * allowoverride None $ Order Deny,allowPanax Notoginseng Deny from all - Allow from 127.0.0.0/255.0.0.0:: 1/128 the     </Directory> +  A </VirtualHost>
www.b.com.conf

Apache detailed permissions can be modified on the above configuration file.

Article turned from: http://forum.ubuntu.org.cn/viewtopic.php?t=341070

"Go" ubuntu+apache bind multiple domain names

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.