Apache Virtual Host Guide

Source: Internet
Author: User
Tags plone

To make it clear, add another virtual host site edunuke.firehare.com. First, create an edunuke file in the/etc/apache2/sites-available/directory. Of course, this file name does not contain the "." or "#" characters. Then edit the file:

<VirtualHost 10.39.6.59>
ServerName edunuke.firehare.com
ServerAdmin ubuntu.firehare@firehare.com
DocumentRoot "/var/www/edunuke/"
ErrorLog "/var/log/apache2/edunuke_errors.log"
CustomLog "/var/log/apache2/edunuke_accesses.log" common
</VirtualHost>

The specific meanings of the settings are similar to those above. Then run the following command:

sudo a2ensite edunuke

In this case, the virtual host site edunuke.firehare.com has been installed. You can also find a soft link to/etc/apache2/sites-enabled/in the/etc/apache2/sites-available/edunuke directory. Next, restart apache2 to run the VM site:

Sudo/etc/init. d/apache2 restart here you can use reload to reload

In this way, if you enter edunuke.firehare.com in the browser, it will be directed to the/var/www/edunuke directory, the input of other domain names pointing to the local machine will be directed to the/var/WWW directory in the default configuration. If you are familiar with apache2, you may ask why it is so troublesome. Is it okay to put it in a file? Why should I use two files? It is actually very simple, because if I want to maintain the edunuke site, I just need to run the command:

sudo a2dissite edunuke
sudo /etc/init.d/apache2 restart

You can maintain the edunuke site without affecting the normal operation of other sites.

[Edit] Advanced Configuration

I talked about the simple virtual host configuration method. This basically satisfies most of our needs. However, if Zope + plone is installed, the above settings are far from enough. Because the Zope + plone structure uses port 80 instead of port 80, We have to perform port redirection. To do this, we have to activate the rewrite and proxy modules. The activation module is very simple. Like the site configuration directory, apache2 also has two modules: mod-available and mod-enabled. All available modules are available in the directory of "mod-available", while the modules that have been installed in apache2 are in the directory of "mod-enabled. Because the rewrite and proxy module configuration boot files are already available in the directory of the mod-available, you just need to install them in apache2. Run the following command:

sudo a2enmod rewrite
sudo a2enmod proxy

Then, add the VM site plone.firehare.com, and create a file plone in the/etc/apache2/sites-available/directory similar to that created by the edunuke site. Obviously, this file name does not contain the "." or "#" characters. Then edit the file:

<VirtualHost 10.39.6.59>
ServerName plone.firehare.com
ServerAdmin ubuntu.firehare@firehare.com
ErrorLog "/var/log/apache2/plone_errors.log"
CustomLog "/var/log/apache2/plone_accesses.log" common

RewriteEngine on
RewriteRule ^/(.*) http://127.0.0.1:8081/VirtualHostBase/http/plone.firehare.com:80/plone/VirtualHostRoot/$1 [L,P]

<Proxy *>
Order Deny,Allow
Deny from all
Allow from all
</Proxy>

</VirtualHost>

So that the plone.firehare.com virtual host site is installed, you can enter the http://plone.firehare.com in the address bar in the browser to redirect to the Zope + plone site.

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.