centos怎么查看apache安装在哪里
2个回答
2016-06-11 · 知道合伙人互联网行家
关注
展开全部
在centos下Apache的安装方式无非两种,源码编译安装和yum(rpm)安装,下面列出查找方式
1. 查找服务安装位置通常使用查找进程的方式,适用于编译安装的apache,下面例子中可以看出来apache安装在/usr/local/httpd/下
ps -ef|egrep "apache|httpd"
root 30010 1 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30012 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30013 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30014 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30015 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30016 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30017 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30018 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30019 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30020 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30021 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30022 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30023 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30024 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30025 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30026 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
www 30027 30010 0 04:01 ? 00:00:00 /usr/local/httpd/bin/httpd -k start
2. 如果进程中无法找到尝试在启动脚本中寻找,适用于yum安装的apache,如下所示,可以看到启动时apache加载配置文件的位置,其中apache运行的站点目录可以在/etc/httpd/conf/httpd.conf中找到
#查看apache配置文件位置
sed -n '9,11p' /etc/init.d/httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#查看apache站点目录
grep "DocumentRoot" /etc/httpd/conf/httpd.conf|grep -v "#"
DocumentRoot "/var/www/html"
3. 通过编译参数查找
apache_bin=$(find / -type f -name "httpd"|xargs -i ls -l {}|awk '{if($5>30000)print $NF}')
$apache_bin -V|grep HTTPD_ROOT
结果:-D HTTPD_ROOT="/etc/httpd"
#apache安装在/etc/httpd 目录下
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询