Apache uses A2ensite and a2dissite to quickly switch sites

Source: Internet
Author: User
It is often necessary to configure multiple sites at development time and to switch frequently.

The previous practice was often to include all of the configuration files in the httpd.conf, without needing to comment, for example

Include Conf/translate.conf#include Conf/addons.confinclude conf/spider.conf

This will need to locate the httpd.conf directory, then use the editor to open, modify, and then save, more trouble.

Another option is to include all the configuration files in the httpd.conf.

Include conf/*.conf  

It is also troublesome to rename the unwanted configuration file.

in fact, Apache provides a convenient tool, which is a2ensite and a2dissite, they're all in the Apache2-common bag.

A2ensite can activate the sites-available in the Apache folder that contains the configuration file, A2dissite the opposite.

1. Go to the Sites-available folder and create a new file, such as spider.conf.

 
  
   
      ServerName ci.hfahe.cn    documentroot/data/html/ci.hfahe.cn    directoryindex index.php
 
  

run A2ensite, you can see that it gives the choice, these choices are all the files under Sites-available, enter the required file name to activate the site.


After running, see that it gives a hint, need reload Apache to make the configuration take effect. You can also use the Apache2ctl graceful/restart command.

To the Sites-enables directory, you can see that this folder has just activated the site configuration file of the symbolic link, this is the A2ensite, A2dissite control the principle of the site.


The principle and operation of A2dissite is similar to that of A2ensite, which is not described in detail here.

With A2dissite and A2ensite, we can quickly activate/block sites and accelerate development and deployment efficiencies.

The above describes the Apache use A2ensite and a2dissite to quickly switch sites, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.