Apache Configuration Site Directory, virtual directory, new Port

Source: Internet
Author: User

1 Configuring the Site Directory, take Ubuntu as an example

1) Open the default configuration folder for Apache: cd/etc/apache2/sites-available

2) Open config file, this machine is sudo vi 000-default.conf

3) Modify the path

<virtualhost *:>        ServerAdmin [email protected]        /data/test        errorlog ${apache_log_dir}/error.log        customlog ${apache_log_dir}/Access.log combined </VirtualHost>

2 Configure the virtual directory, take windows as an example

1) Open httpd.conf, add a line of code

<ifmodule alias_module>    "d:/cgi-bin/"    # Sets the site alias, the alias is related to the access path , you can take any name (except Special)     ""     </IfModule>

2) then add the following lines of code

<directory e:/test>      Options Indexes followsymlinks         allowoverride None         Order Allow,deny           from all   </Directory>  

3 Configure a new port, take Ubuntu as an example

1) Open the default configuration folder for Apache: cd/etc/apache2/

2) modify port file sudo vi ports.conf new line

 the

3) Toggle Configuration default directory Cd/etc/apache2/sites-available

4) Configure new port mappings sudo vi 000-default.conf Add a few lines of code

<virtualhost *:>        ServerAdmin [email protected]        /data/newtest        errorlog $ {Apache_log_dir} /error.log        customlog ${apache_log_dir}/access.log combined</VirtualHost>

After 4 operation, we need to restart Apache, for example, Ubuntu

Sudo/etc/init.d/apache2 restart

Apache configuration Site Directory, virtual directory, new Port

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.