ubuntu下 apache2配置多端口:

打开/etc/apache2/site-enabled/0000-default

里面打如下代码


<VirtualHost *:8080>  //8080是端口,可以随意改
ServerName localhost;
DocumentRoot "/var/dhulabme/web" //指定项目路径
DirectoryIndex index.php
Alias /sf/ "/var/dhulabme/sf/data/web/sf/"  //指定SF路径
<Directory "/var/dhulabme/sf/data/web/sf/">
AllowOverride All
Allow from All
</Directory>
<Directory "/var/dhuabme/web/lms.php"> //指定默认访问页面
AllowOverride All
Allow from All
</Directory>
</VirtualHost>


之后需要打开/etc/apache2/ports.conf

NameVirtualHost :8080

listen :8080

~~~~~~~~~~~~~~~~~~~~~~