linux下apache配置文件测试,重启 Apache 服务器及测试配置

在 CentOS / RHEL / Fedora Linux 服务器上安装的 Apache 网页服务器程序在系统中的进程名称为 httpd。每次更改 Apache 服务器的配置,不管是 httpd.conf 还是 vhost.conf 或者自己配置的什么 .conf,只要有改动都需要重新加载配置或者重启 httpd 服务才能生效。重启 httpd 服务很简单,重要的是这里记录了一个在重启服务前测试配置是否有错误的指令。

重启 httpd 有两个方法,使用 service (服务)指令,CentOS 7 中会重定向到 systemctl 指令,或者使用 /etc/init.d/httpd 或者 /usr/sbin/httpd 脚本(script)。实际上 service / systemctl 指令只是调用 /etc/init.d/ 或 /usr/sbin/ 里的 httpd 的 script 的简单方法,所以这两个方法是等价的。

使用 root 帐户登录,查询 httpd 的服务指令:

# service httpd

Usage: httpd {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}

{ } 中列举了可以使用的 httpd 服务指令。下面列出一些例子,同时在下一行给出对应的 CentOS 7 中 systemctl 指令格式。所以……

启动 httpd 服务器:

# service httpd start

# systemctl start httpd

停止 httpd 服务器:

# service httpd stop

# systemctl stop httpd<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值