Linuxシステムでフロントエンドの操作と保守を行う場合、apacheのエラーログ、エラーログ、アクセスログなどの構成を確認する必要がある場合があります。これらの構成はhttpd.confファイルに書き込まれます。どのhttpdをどのように知るか.confは現在Apacheで使用されていますか?何ですか?手順は次のとおりです。
手順1.apache起動コマンドを見つける
[root@iZuf6crxor2b7uwzq9sutyZ ~]# ps -ef|grep httpd
root 4517 1 0 Nov19 ? 00:01:12 /usr/sbin/httpd -DFOREGROUND
root 8043 1 0 Jan13 ? 00:00:00 vim /etc/httpd/conf/httpd.conf
apache 19822 4517 0 10:40 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 19823 4517 0 10:40 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 19967 4517 0 10:43 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 20008 4517 0 10:45 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 20220 4517 0 10:53 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 20246 4517 0 10:54 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 20247 4517 0 10:54 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 20268 4517 0 10:55 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 20297 4517 0 10:56 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 20301 4517 0 10:56 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 20401 20345 0 10:58 pts/1 00:00:00 grep --color=auto httpd
次の例に示すように、ps -ef | grep httpdコマンドの結果が、apacheの起動時に構成ファイルが-fオプションで指定されていることを示している場合、構成ファイルの特定のパスを/ homeとして直接確認できます。 / apache / conf / httpd.conf。
/home/apache/bin/httpd -f /home/apache/conf/httpd.conf -k start
ただし、最初のステップの結果には-fオプションが表示されないため、2番目のステップに進みます。
手順2.httpd -Sコマンドを実行して、構成ファイルのパスを確認します
ステップ1は、rootユーザーがapacheを開始した結果が最初のものであることを示しています。
root 4517 1 0 Nov19 ? 00:01:12 /usr/sbin/httpd -DFOREGROUND
apacheコマンドが配置されているパスは/ usr / sbin / httpdです。引き続きhttpd-Sコマンドを実行すると、apacheの特定の構成を確認できます。
[root@iZuf6crxor2b7uwzq9sutyZ ~]# /usr/sbin/httpd -S
[Fri Dec 04 11:13:12.738249 2020] [alias:warn] [pid 20927] AH00671: The Alias directive in /etc/httpd/conf/httpd.conf at line 145 will probably never match because it overlaps an earlier Alias.
VirtualHost configuration:
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/webapp"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48
結果は、apacheによって使用されるhttpd.confが/etc/httpd/conf/httpd.confであることを示しています。