Chinaunix首页 | 论坛 | 博客

qsh

  • 博客访问: 3948718
  • 博文数量: 1015
  • 博客积分: 15904
  • 博客等级: 上将
  • 技术积分: 8572
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-04 19:16
文章分类

全部博文(1015)

文章存档

2019年(1)

2017年(1)

2016年(19)

2015年(27)

2014年(30)

2013年(95)

2012年(199)

2011年(72)

2010年(109)

2009年(166)

2008年(296)

分类: LINUX

2016-07-30 16:22:47

第一步:找到apache启动命令:

[root@WAPBJ01 ~]# ps -ef|grep httpd
root     10575     1  0 19:45 ?        00:00:03 /usr/sbin/httpd -k start
myuser       15356     2982     0   Jan19   ?                 00:00:00   /home/apache/bin/httpd   -f   /home/apache/conf/httpd.conf   -k   start

如果看到 httpd命令使用了-f选项,则可以直接得到配置文件目录。

如果httpd命令没有使用-f选项,如:

[root@WAPBJ01 ~]# ps -ef|grep httpd
root     10575     1  0 19:45 ?        00:00:03 /usr/sbin/httpd -k start
apache   10577 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10583 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10584 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10587 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10590 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10591 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start

则执行第二步。


第二步:执行httpd -S命令,找出配置文件路径

[root@WAPBJ01 ~]# /usr/sbin/httpd -S

VirtualHost configuration:
211.157.8.76:80        is a NameVirtualHost
         default server wap.wapwu.com (/etc/httpd/conf/httpd.conf:1041)
         port 80 namevhost wap.wapwu.com (/etc/httpd/conf/httpd.conf:1041)
         port 80 namevhost wapu.wapwu.com (/etc/httpd/conf/httpd.conf:1052)
wildcard NameVirtualHosts and _default_ servers:
_default_:443          211.157.8.76 (/etc/httpd/conf.d/ssl.conf:88)
Syntax OK
[root@WAPBJ01 ~]# 

从apache输出的日志信息中可以看到配置文件是在/etc/httpd/conf/ 目录下。


你可以是用httpd -V命令查看,输出信息类似如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#httpd -V
Server version: Apache/2.2.21 (Unix)
Server built:   Feb  9 2012 17:33:51
Server’s Module Magic Number: 20051115:30
Server loaded:  APR 1.4.2, APR-Util 1.3.10
Compiled using: APR 1.4.2, APR-Util 1.3.10
Architecture:   64-bit
Server MPM:     Prefork
threaded:     no
forked:     yes (variable process count)
Server compiled with….
-D APACHE_MPM_DIR=”server/mpm/prefork”
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT=”/usr/local/httpd2.2.21″
-D SUEXEC_BIN=”/usr/local/httpd2.2.21/bin/suexec”
-D DEFAULT_PIDLOG=”logs/httpd.pid”
-D DEFAULT_SCOREBOARD=”logs/apache_runtime_status”
-D DEFAULT_LOCKFILE=”logs/accept.lock”
-D DEFAULT_ERRORLOG=”logs/error_log”
-D AP_TYPES_CONFIG_FILE=”conf/mime.types”
-D SERVER_CONFIG_FILE=”conf/httpd.conf”

其中HTTPD_ROOT和SERVER_CONFIG_FILE  就可以确定httpd.conf的路径了




阅读(786) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~