这里会显示出您选择的修订版和当前版本之间的差别。
— |
vps:apache:install [2017/01/01 15:33] (当前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== 安装Apache ====== | ||
+ | |||
+ | ====== 在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 | ||
+ | |||
+ | |||
+ | 安装 php 模块: | ||
+ | apt install libapache2-mod-php | ||
+ | ===== 配置文件 ===== | ||
+ | |||
+ | 需要说明的是,普通的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的手册了 | ||
+ | |||