Centos7.3 yum 安装 apache httpd 服务

  • 1. 查看 httpd 包是否可用
    yum list | grep httpd

  • 2. 安装 Apache
    yum install httpd

  • 3. 配置 servername
    vi /etc/httpd/conf/httpd.conf
    修改这行: ServerName localhost:80,修改为你指定的服务器名

  • 4. 启动
    systemctl start httpd.service
    设置开机自启动:
    systemctl enable httpd.service
    若要验证是否自动启动可在重启服务器后在终端键入以下命令来检测 Apache 是否已经启动
    systemctl is-enabled httpd.service
    如果看到了 enable 这样的响应,则表示 Apache 已经启动成功

  • 5. 安装 apache 扩展(让其支持 sll 及正则扩展)
    yum -y install mod_ssl mod_perl

  • 6. 安装目录介绍
    Apache 默认将网站的根目录指向 /var/www/html
    默认的主配置文件 /etc/httpd/conf/httpd.conf
    配置存储在的 /etc/httpd/conf.d/ 目录

  
    展开阅读全文