在apache中区分端口配置多个网站
以下配置在kubuntu12.04版本中验证通过。假设有两个网站,分别配置在80端口以及81端口。
step1:修改/etc/apache2/ports.conf,增加以下内容:
NameVirtualHost *:81 Listen 81
step2:修改/etc/apache2/sites-available/default文件,增加以下内容:
<VirtualHost *:81> ServerAdmin webmaster@localhost DocumentRoot /home/yi/work/mss_web <Directory /> Options FollowSymLinks AllowOverride all </Directory> <Directory /home/yi/work/mss_web/> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /home/yi/work/mss_web/cgi-bin/ <Directory "/home/yi/work/mss_web/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> </VirtualHost>
最后,重新启动apache2即可:
sudo service apache2 restart