一、问题

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. framework7 可以拉动右侧工具栏和点击当前item就可以出发事件的HTML结构

    <li class="swipeout"> <div class="swipeout-content item-content"> &l ...

  2. Oracle 日期加减运算

    -- Start 我们都知道数字可以进行加.减.乘.除等运算.那么,日期可不可以呢?答案是,日期只能进行加.减运算. 在开始操作日期之前,我们先了解一下 Oracle 支持哪些日期数据类型,如下所示: ...

  3. Map的嵌套,HDU(1263)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 新学的map的嵌套 #include <stdio.h> #include < ...

  4. Linux空间PHP开发环境小白教程(LAMP)

    租了一个云服务器, 但是只有linux系统,没有php开发环境, 只好自己摸索着一步一步安装啦. 本教程来自自学IT创E老师的Linux教程,想详细了解的可以去论坛找. 一.使用PUTTY登录服务器 ...

  5. sqlserver 使用小技巧总结

    1.  在数据库 查询中  在表名后面 加    英文字母,可以方便 查询 select a.name ,b.hobbynamefrom student as a, hobby as bwhere a ...

  6. MapReduce计算每年最大值

    1. 测试文件生成程序,参考 https://www.cnblogs.com/jonban/p/10555364.html MapReduce程序示例如下: 2. 新建Maven项目  hadoop ...

  7. Mathematica 讲座

    Mathematica 讲座笔记本 [下载] 第一章 Mathematica 简介 [观看] [下载] 第二章 Mathematica 界面和编程语言 [观看] [下载] 第三章 符号运算 [观看] ...

  8. NodeJS中常见异步接口定义(get、post、jsonp)

    越来越多的人在使用nodeJS,作为一门服务端语言,我们不可避免的要写异步接口(ajax和jsonp).再次强调ajax和jsonp是两个概念,但是由于jquery的封装,使这两种异步接口的调用方式, ...

  9. 九九乘法表(Python实现)

    a = 1 #while实现 while a: b = 1 while b: print(str(b)+'*'+str(a),end='=') print(a*b,end=' ') if b == a ...

  10. Python爬虫,看看我最近博客都写了啥,带你制作高逼格的数据聚合云图

    转载请标明出处: http://blog.csdn.net/forezp/article/details/70198541 本文出自方志朋的博客 今天一时兴起,想用python爬爬自己的博客,通过数据 ...