Ubuntu系统下安装和设置Apache2

2011-04-10 13:43:46   来源:OKXUN.com

在Ubuntu中安装apache

  安装指令:sudo apt-get install apache2

  安装结束后:

  产生的启动和停止文件是:/etc/init.d/apache2

  启动:sudo apache2ctl -k start

  停止:sudo apache2ctl -k stop

  重新启动:sudo apache2ctl -k restart

  配置文件保存在:/etc/apache2

  需要说明的是,普通的apache发行版本配置文件是:

  httpd.conf

  Ubuntu发行版本的主配置文件是:

  apache2.conf

  在apache2.conf引用到了以下文件:

  # 包含动态模块的配置:

  Include /etc/apache2/mods-enabled/*.load

  Include /etc/apache2/mods-enabled/*.conf

  # 包含用户自己的配置:

  Include /etc/apache2/httpd.conf

  # 包含端口监听的配置:

  Include /etc/apache2/ports.conf

  # 包含一般性的配置语句片断:

  Include /etc/apache2/conf.d/

  # 包含虚拟主机的配置指令:

  Include /etc/apache2/sites-enabled/

  修改httpd.conf

  增加以下内容:

  ServerName 127.0.0.1:80

  进一步的配置和使用,就可以查阅APACHE的手册了