安装:sudo apt-get install apache2
启动服务器:sudo /etc/init.d/apache2 start
测试:在浏览器输入:127.0.0.1进行回环地址测试,结果如下:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
停止服务器:sudo /etc/init.d/apache2 stop
重启服务器:sudo /etc/init.d/apache2 restart
另外,也可用sudo apache2ctl -k start(stop/restart)进行上述操作
上述内容实际上是服务器根目录‘/var/www'下的index.html文件。用户可以将自己开发的网页放入/var/www根目录内