There is a default file in/etc/apache2/sites-available, which is roughly configured as follows:
<virtualhost *:80> ServerAdmin xujie19841206@hotmail.com ServerName localhost documentroot/home/xujie/www < Directory/> Options Indexes followsymlinks allowoverride all </Directory> <Directory/home/xujie/www/> Options Indexes followsymlinks multiviews allowoverride All order Allow,deny allow to all </Directory> Scriptalias /cgi-bin//usr/lib/cgi-bin/<directory "/usr/lib/cgi-bin" > allowoverride None Options +execcgi-multiviews + SymLinksIfOwnerMatch order Allow,deny allow from all </Directory> Errorlog/var/log/apache2/error.log # Possible VA Lues Include:debug, info, notice, warn, error, crit, # Alert, Emerg. LogLevel warn Customlog/var/log/apache2/access.log combined alias/doc/"/usr/share/doc/" <directory doc/"> Options Indexes multiviews followsymlinks allowoverride None order Deny,allow deny to all allow from 127.0.0.0 /255.0.0.0:: 1/128 </Directory> </VirtualHost>
When you enter http://localhost, the server automatically resolves to the/home/xujie/www folder. Find index.php, however if you want to add another virtual host, add it locally.
Each site has the same IP address, but with a different domain name, it is called a virtual host based on a first name or host name.
If you want to create a www.drug.com.cn directory again, then create a file in the/etc/apache2/sites-available/directory, named Drug, and then through sudo gedit drug,
Add to
<virtualhost 127.0.0.1>
ServerName www.drug.com.cn
ServerAdmin abc@abc.com
DocumentRoot "/home/xujie/www/drug"
ErrorLog "/var/log/apache2/drug_errors.log"
</VirtualHost>
Here is not done, Run command sudo a2ensite Edunuke, need to modify host file, edit/etc/hosts, and then add 127.0.0.1 www.drug.com.cn here, the server restarts, you can let www.drug.com.cn automatically parse to the local/home/xujie/www/drug directory.