Open file: /etc/apache2/sites-enabled/000-default.conf
Or you can create a separate configuration file as you prefer I keep all my VHosts in one file. Once you have the configuration file open add new VHost configuration like so:
<VirtualHost *:80>
DocumentRoot /var/www/subfolder
ServerName www.domain.com
ServerAlias domain.com
</VirtualHost>
复制代码
Now go back to the folder: /etc/apache2 and open file: apache2.conf and add a new line:
ServerName www.domain.com
Save the file and restart your server using this command: service apache2 restart, the process is same across all OS the config folder locations tho can be different you can look those up.