Server IP Address: 127.0.0.1:80
Bind two domain names my.cms.com my.test.com
Bind my.cms.com to/home/gaofei/desktop/www/my_cms
Bind My.cms.test to/home/gaofei/desktop/www/my_test
1.
Cd/etc/hosts
Add a domain name
127.0. 0.1 my.test.com127.0. 0.1 My.cms.com
2. Enter/etc/apache2/sites-enabled/; Delete the 000-default file.
3. Create two files under/etc/apache2/sites-available/named My.test.com my.cms.com
Insert the following in my.cms.com
<virtualhost *: the>ServerAdmin [email protected] ServerName my.cms.com documentroot/home/gaofei/desktop/www/My_cms<directory/>Options followsymlinks directoryindex index.php index.html index.htm allowoverride None</Directory> <Directory/home/gaofei/Desktop/www/my_cms># options Indexes followsymlinks multiviews options followsymlinks rewriteengine on Rewritecond%{request_filename}!-F Rewritecond%{request_filename}!-d rewriterule. index.php allowoverride all Order allow,deny allow from 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 ${apache_log_dir}/Error.log # Possible values Include:debug, info, notice, warn, error, crit, # Alert, Emerg. LogLevel warn Customlog ${apache_log_dir}/Access.log Combined Alias/doc/"/usr/share/doc/"<directory"/usr/share/doc/">Options Indexes multiviews followsymlinks allowoverride None Order deny,allow deny from all allow from 127.0.0.0/255.0.0.0::1/ -</Directory></VirtualHost>
Insert the following inside the my.test.com
<virtualhost *: the>ServerAdmin [email protected] ServerName my.test.com documentroot/home/gaofei/desktop/www/my_test<directory/>Options followsymlinks directoryindex index.php index.html index.htm allowoverride None</Directory> <Directory/home/gaofei/Desktop/www/my_test># options Indexes followsymlinks multiviews options followsymlinks rewriteengine on Rewritecond%{request_filename}!-F Rewritecond%{request_filename}!-d rewriterule. index.php allowoverride all Order allow,deny allow from 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 ${apache_log_dir}/Error.log # Possible values Include:debug, info, notice, warn, error, crit, # Alert, Emerg. LogLevel warn Customlog ${apache_log_dir}/Access.log Combined Alias/doc/"/usr/share/doc/"<directory"/usr/share/doc/">Options Indexes multiviews followsymlinks allowoverride None Order deny,allow deny from all allow from 127.0.0.0/255.0.0.0::1/ -</Directory></VirtualHost>
4. Create the ln link in/etc/apache2/sites_enabled/:
Ln-s /etc/apache2/sites-available/my.test.com/etc/apache2/sites-enabled/-S /etc/apache2/ Sites-available/my.cms.com/etc/apache2/sites-enabled/my.cms.com
5. Restart Apache2
Service Apache2 Restart
Configure Apache virtual host under Ubuntu