以下通过Debian7系统测试
1.安装apache2
sudo apt-get install apache2
2.默认http服务器路径
/var/www/
3.输入服务器地址,可以测试http服务器是否工作
http://192.168.5.128/
4.修改http服务路径
sudo vi /etc/apache2/sites-available/default
如将默认路径/var/www/修改为/home/ivansun/html,如下高亮部分
$ sudo vi /etc/apache2/sites-available/default
<VirtualHost *:80>ServerAdmin webmaster@localhost
DocumentRoot /home/ivansun/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/ivansun/html/>
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 ${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
</VirtualHost>