apache的/etc/httpd/conf/httpd.conf和/usr/local/apache2/conf/httpd.conf区别

一、问题

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
时间: 2024-08-02 00:12:06

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

vim /usr/local/apache2/conf/httpd.conf

[[email protected] ~]# vim -n /usr/local/apache2/conf/httpd.conf 1 # 2 # This is the main Apache HTTP server configuration file. It contains the 3 # configuration directives that give the server its instructions. 4 # See <URL:http://httpd.apache.org/

PHP 5.6启动失败failed to open configuration file &#39;/usr/local/php/etc/php-fpm.conf&#39;

PHP编译安装完毕,启动失败,提示 1 [23-Jun-2014 12:27:02] ERROR: failed to open configuration file '/usr/local/php/etc/php-fpm.conf': No such file or directory (2) 2 [23-Jun-2014 12:27:02] ERROR: failed to load configuration file '/usr/local/php/etc/php-fpm.conf' 3

nginx: [emerg] host not found in upstream &quot;baafile.yiche.com&quot; in /usr/local/etc/nginx/nginx.conf:67

场景:nginx之前配置好的,直接启动即可,过了一段时间,突然启动报错. nginx: [emerg] host not found in upstream "baafile.yiche.com" in /usr/local/etc/nginx/nginx.conf:67 应该是 baafile.yiche.com  这个域名 之前可以访问,现在不能访问了.把此处的注释重启即可. 原文地址:https://www.cnblogs.com/kpengfang/p/12698756.htm

apache 在 加载openssl 模块时出现 “/usr/local/ssl/lib/libssl.a: could not read symbols: Bad value”错误解决方案

正式环境: 系统:Red Hat Enterprise Linux Server release 5.6 (Tikanga) 内核:2.6.18-238.31.1.el5 位数:64 测试环境: 系统:CentOS release 5.8 (Final) 内核:2.6.18-53.el5 位数: 32 相关软件版本及下载地址 1.apr: http://labs.mop.com/apache-mirror//apr/apr-1.4.6.tar.gz 2.apr-util:http://labs.

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

[[email protected] conf]# service httpd restart 停止 httpd: [确定] 启动 httpd:AH00548: NameVirtualHost has no effect and will be removed in the next release /usr/local/apache/conf/extra/httpd-vhosts.conf:1 文件 /usr/local/apache/conf/extra/httpd-vhosts.conf

nginx配置文件/usr/local/nginx/conf/nginx.conf

首先清空原来的/usr/local/nginx/conf/nginx.conf >/usr/lcoal/nginx/conf/nginx.conf  //把以下信息拷贝 user nobody nobody;worker_processes 2;error_log /usr/local/nginx/logs/nginx_error.log crit;pid /usr/local/nginx/logs/nginx.pid;worker_rlimit_nofile 51200;events{   

nginx: [emerg] the &quot;ssl&quot; 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 requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:37 原因也很简单,nginx缺少http_ssl_module模块,编译安装的时候带上--with-http_ssl_module配置就行了,但是现在的情况是我的nginx已经安装过了,

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

安装方法主要参考了:http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html这篇文章,出现“cp: "conf/koi-win" 与"/usr/local/nginx/conf/koi-win" 问题的时候参考了http://my.oschina.net/websec/blog/178133这篇文章,但照做会出现另一个问题:conf/koi-win找不到.这样一来问题反而清楚了:问题出在解压的包的名称

nginx: [emerg] the &quot;ssl&quot; 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/conf/nginx.conf 其中,/usr/local/nginx/sbin/nginx 是我的nginx安装后的可执行程序路径,/usr/local/nginx/conf/nginx.conf 是我的nginx主配置文件路径. 该命令输出如下: 可见,nginx缺少SSL模块支持.所以以前编