Write a summary note and let yourself know how to deploy it later.
First Apache version is 2.4.7, then the system is Ubuntu 14.04.1 LTS. (as if the configuration file and directory are different)
First go into the apache2 directory,
We are going to explore the main sites-available and sites-enabled according to the literal meaning that the previous one is available for the site, and the latter one is available for the site, and then we also know that Sites-enabled inside the file is sites-available inside the file soft link, so we mainly change site-available file, open site-available There are two files, But we only need to 000-default.conf file, open the cat file, the code is as follows:
<virtualhost *:80> # The SERVERNAME Directive sets the request scheme, hostname and port that # the SE RVer uses to identify itself. This was used when creating # redirection URLs. In the context of the virtual hosts, the ServerName # specifies what hostname must appear in the request ' s Host:header To # Match this virtual host. For the default virtual host (this file) This # value was not decisive as it was used as a last resort host Regardles S. # However, must seothert it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin [email protected] documentroot/var/www/# Available Log Levels:trace8, ..., Trace1, debug, info, notice, warn, # Error, Crit, alert, Emerg. # It's also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/accesS.log combined # For more configuration files from conf-available/, which is # enabled or disabled at a Glo Bal level, it's possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been global Ly disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf</virtualhost>
This is the URL configuration file, and we want to modify only the annotated servername domain name, documentroot path of the two parts, remove the comments left.
<VirtualHost *:80> ServerName #这里是域名地址 ServerAdmin [email protected] DocumentRoot /var/www/ #这里是路径 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>
Can be added directly below, restart Apache became. But the priority above is higher, access to their own domain name will jump to the path you set, direct access to IP or to the first set of paths, you can also choose to delete.
Another way to change is to create a new file, xxx.conf and then content
<VirtualHost *:80> ServerName #这里是域名地址 ServerAdmin [email protected] DocumentRoot /var/www/ #这里是路径 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>
In the Create soft link ln-s: /sites-avaiable/xxx.conf. /sites-enable/xxx.conf
This can also be achieved, but the priority is still 000-default.conf high.
Well, it's that simple.
Apache deploys multi-domain names, deploys multiple sites with the same IP