1.简单的sudo apt-get install apache2

2.ps -ef | grep apache2可以看到如下信息

root      2657     1  0 11:54 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  2658  2657  0 11:54 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  2659  2657  0 11:54 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  2690  2657  0 11:54 ?        00:00:00 /usr/sbin/apache2 -k start

3.在浏览器中输入
http://localhost/
成功的话,会出现It,works!

4.apache2的配置文件为
/etc/apache2/apache2.conf
修改端口可在/etc/apache2/ports.conf
修改Listen 8082
注意配置文件中有说明:

  1. # If you just change the port or add more ports here, you will likely also
  2. # have to change the VirtualHost statement in
  3. # /etc/apache2/sites-enabled/000-default
  4. NameVirtualHost *:80
    Listen 8082
所以还需要修改
/etc/apache2/sites-enabled/000-default
中的8082>


5.重新加载配置文件
 sudo service apache2 reload

6.在浏览器中输入http://localhost:8082/会出现测试的主页

10-16 06:21
查看更多