Configuration of apache Virtual Host installed with apt-get In Ubuntu 1. After installing apache, the sites-enabledsites-available folders in the/etc/apache2 directory are about the virtual host configuration. In fact, sites-enabled is the connection file of sites-available, use ls-l to see 2. In sites-available
Configuration of apache Virtual Host installed with apt-get In Ubuntu
1. First, let's take a look at the directory generated after apache is installed.
In/etc/apache2
Sites-enabled
Sites-available
These two folders are about the virtual host configuration. In fact, sites-enabled is the connection file of sites-available, which can be seen through ls-l.
2. A default file is found in sites-available.
The default file is actually a standard configuration file for the VM,
Iii. VM configuration steps
If you create a VM such as pma.com
The root directory of the website is in/var/www, and pma.com corresponds to the/var/www/pma folder.
① In the sites-available folder, create a file pma with the following content:
Just follow default. Of course, it can be simpler.
ServerName pma.com
DocumentRoot/var/ww/pma/
② Connect to the sites-enabled folder
Sudo a2ensite pma
At this time, we can see that in sites-enabled, the connection file pma is generated.
③ Restart apache
Sudo service apache2 reload
Or sudo service apache2 restart
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's actually very simple,
Because if I want to maintain the pma site, I only need to run the following command:
Sudo a2dissite pma
Sudo/etc/init. d/apache2 restart
You can maintain the pma site without affecting the normal operation of other sites.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2