centos怎么查看apache安装在哪里
发布网友
发布时间:2022-02-26 21:23
我来回答
共2个回答
热心网友
时间:2022-02-26 22:53
在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 目录下
热心网友
时间:2022-02-27 00:11
find / -name apache
源码安装
指定安全路径 configure --prefix=安装路径
默认在/usr/local下
rpm安装
默认情况下目录/usr 用来存放应用程序
目录/etc 存放软件的配置文件
查看安装路径
rpm -ql httpd-xxxx