一、问题

centos系统用yum安装完apache后,重启后有时会失效,然后去网上找资料,发现有的说重启命令是这样的:

/etc/init.d/httpd restart

而有的呢,说重启命令应该是这样的:

service httpd restart

这两行命令写法不同,但其实是同一个东西,都是重启httpd服务。

但很多时候发现改了配置文件后,重启并不生效,然后网上的资料有的让改 /etc/httpd/conf/httpd.conf 这个文件,有的让改 /usr/local/apache2/conf/httpd.conf 文件。那这两个文件到底哪一个对呢?这两个文件有什么区别呢?

二、区别

这两个文件都是apache的配置文件,只是一个是系统自带的(/etc/httpd/conf/httpd.conf),一个是yum安装产生的(/usr/local/apache2/conf/httpd.conf)。

三、解决办法

上面的命令不起作用的原因,往往是因为 /etc/init.d/httpd 中用的是系统自带的 apache,但我们改的是 yum安装的apache的配置文件。既然知道原因了,解决就简单了,有两种办法:

1、把 /etc/init.d/httpd 中的apache改为我们要使用的那个

2、在要使用的apache的安装目录下启动apache,如在 /usr/local/apache2/bin 下执行命令:

$ sudo apachectl restart

apache的/etc/httpd/conf/httpd.conf和/usr/local/apache2/conf/httpd.conf区别的更多相关文章

  1. PHP 5.6启动失败failed to open configuration file '/usr/local/php/etc/php-fpm.conf'

    PHP编译安装完毕,启动失败,提示 [-Jun- ::] ERROR: failed to open configuration ) [-Jun- ::] ERROR: failed to load ...

  2. ERROR: Unable to globalize '/usr/local/NONE/etc/php-fpm.d/*.conf' (ret = 2) from /usr/local/etc/php-fpm.conf at line WARNING: Nothing matches the include pattern '/usr/local/php7/etc/php-fpm.d/*.conf'

    Building from source is not easy if something is a bit different, and I had a hard time with some di ...

  3. [资料] Apache2 的 httpd.conf 经典中文翻译

    [i=s] 本帖最后由 www.PHP888.com 于 2009-5-22 13:40 编辑 [/i] # 基于 NCSA 服务的配置文件. # #这是Apache服务器主要配置文件. #它包含服务 ...

  4. Reading configuration from: /usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/bin/../conf/zoo.cfg

    2021-04-25 00:15:48,112 [myid:] - INFO  [main:QuorumPeerConfig@174] - Reading configuration from: /u ...

  5. ERROR: Unable to globalize '/usr/local/NONE/etc/php-fpm.d/*.conf' 问题的解决

    今天继续作大死,趟php7的配置的坑. 照例,安装了昨天的各种扩展之后,解压php7的压缩文件到 /usr/local/. 然后开始配置config的扩展: ./configure --prefix= ...

  6. Apache2.4.6添加虚拟主机提示:NameVirtualHost has no effect and will be removed in the next release /usr/local/apache/conf/extra/httpd-vhosts.conf

    [root@localhost conf]# service httpd restart 停止 httpd: [确定] 启动 httpd:AH00548: NameVirtualHost has no ...

  7. nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:37

    一:开始Nginx的SSL模块 1.1 Nginx如果未开启SSL模块,配置Https时提示错误 1 nginx: [emerg] the "ssl" parameter requ ...

  8. CentOS6.5安装nginx1.5.8时出现“cp: "conf/koi-win" 与"/usr/local/nginx/conf/koi-win" 为同一文件”的解决方法

    安装方法主要参考了:http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html这篇文章,出现“cp: "conf/koi-wi ...

  9. nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx//conf/nginx.conf:117

    SSL相关的配置加到了nginx的配置文件中后,nginx竟然启动不起来了 于是用如下命令测试问题所在: /usr/local/nginx/sbin/nginx -c /usr/local/nginx ...

随机推荐

  1. SAP CRM WebClient UI和Fiori UI混搭并存

    SAP CRM里有个功能可以创建HANA live report,消费HANA Studio里创建的模型. 最后创建好的report长这个样子: 具体创建步骤可以参考我的博客Step by Step ...

  2. express不是内部命令

    有时用npm install express -g安装完express时,在写express -v会显示express不是内部命令 这样的话如果自己的安装没有问题的话就要考虑到环境变量了 win7 P ...

  3. IOS 搜索条制作(UITextField 封装)

    封装到 HMSearchBar.h / .m #import <UIKit/UIKit.h> @interface HMSearchBar : UITextField + (instanc ...

  4. yum 源搭建

    RHEL系统部署网络yum源 配置网络yum源 RHEL系统本身光盘做成的yum源所提供的软件包有限,在实际使用过程中经常会出现缺包的现象,本文中以CentOS源作为替代,CentOS的软件包和RHE ...

  5. 【转】android四大组件--ContentProvider详解

    一.相关ContentProvider概念解析: 1.ContentProvider简介在Android官方指出的Android的数据存储方式总共有五种,分别是:Shared Preferences. ...

  6. 2017.11.29 JSP+Servlet 中功能验证码及验证的实现

    源代码如下: validate.jsp <%@ page language="java" import="java.util.*" pageEncodin ...

  7. Mac 修改用户环境变量

    Mac 修改用户环境变量 sudo vim ~/.bash_profile

  8. 尝试将 SCRIPT ompbox\private\ompmex 作为函数执行

    1.安装VS2010 2.配置ombox 在ombox路径下 mex -setup C++ 然后 make

  9. springmvc中校验框架(hibernate)

    JSR303定义的校验类型 <dependency> <groupId>org.hibernate</groupId> <artifactId>hibe ...

  10. AngularJS 外部文件中的控制器

    在大型的应用程序中,通常是把控制器存储在外部的文件中. <!DOCTYPE html><html><head><meta http-equiv="C ...