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