把 /etc/apache2/sites-available/default 復(fù)制為default2 和 default3 并修改對(duì)應(yīng)的端口及網(wǎng)站文件路徑:
<VirtualHost *:7777>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/tiantian
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/tiantian/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
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 "|/usr/sbin/rotatelogs ${APACHE_LOG_DIR}/error-7777-%Y-%m-%d.log 86400"
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog "|/usr/sbin/rotatelogs ${APACHE_LOG_DIR}/access-7777-%Y-%m-%d.log 86400" 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/128
</Directory>
</VirtualHost>
sudo /etc/init.d/apache2 restart
備注我的系統(tǒng)上使用apache開了3個(gè)端口82、6666、7777
另外還有l(wèi)ighthttpd使用81端口,可以使用lsof -i:端口號(hào)查看