LoginSignup
1
0

httpd001.png

今回はhttpdについてご紹介させていただきます。

httpdコマンドを使用する事でwebサーバーでの作業を効率的に行う事が出来ます。

httpd -t

「httpd -t」コマンドは、Apacheの設定ファイルの構文をチェックするコマンドとなります。

利用タイミングとしては設定変更等を行った際のリロード前に実行する事が多いです。

一種のおまじない的なポジション(最終確認)のコマンドとなります。

下記コマンドとなります。

httpd -t

上記実行し構文に問題が無ければ下記の様に表示されます。

Syntax OK

構文にエラーがある場合はエラー文を出力します。

エラー内容を確認し修正してください。

httpd -M

「httpd -M」コマンドは、Apacheのモジュール一覧を表示するコマンドとなります。

下記コマンドとなります。

httpd -M

上記実行すると下記の様にモジュール一覧が表示されます。

Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 substitute_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_ajp_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 cgi_module (shared)
 version_module (shared)
 php5_module (shared)
 ssl_module (shared)
 wsgi_module (shared)

httpd -S

「httpd -S」コマンドは、Apacheのバーチャルホストの設定一覧を表示するコマンドとなります。

下記コマンドとなります。

httpd -S

上記実行すると下記の例の様にバーチャルホストの設定一覧が表示されます。

VirtualHost configuration:
*:80         example1.com (/etc/apache2/sites-enabled/example1.conf:1)
*:443        example1.com (/etc/apache2/sites-enabled/example1-ssl.conf:1)
*:80         example2.com (/etc/apache2/sites-enabled/example2.conf:1)
*:443        example2.com (/etc/apache2/sites-enabled/example2-ssl.conf:1)
*:80         example3.com (/etc/apache2/sites-enabled/example3.conf:1)
*:443        example3.com (/etc/apache2/sites-enabled/example3-ssl.conf:1)

httpd -V

「httpd -V」コマンドは、Apacheのバージョン情報等を表示するコマンドとなります。

下記コマンドとなります。

httpd -V

上記実行すると下記の例の様にバージョン情報等が表示されます。

Server version: Apache/2.4.41 (OS名)
Server built:   Aug  4 2023 16:27:34
Server's Module Magic Number: 20120211:88
Server loaded:  APR 1.6.5, APR-UTIL 1.6.1
Compiled using: APR 1.6.5, APR-UTIL 1.6.1
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_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=256
 -D HTTPD_ROOT="/usr/local/apache2"
 -D SUEXEC_BIN="/usr/local/apache2/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

httpd -k

「httpd -k」コマンドは、Apacheの起動を管理コマンドとなります。

基本的にはsystemd等で管理する為、あまり利用されないコマンドかと思います!

下記コマンドとなります。

#起動
httpd -k start

#停止
httpd -k stop

#リスタート
ttpd -k restart
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0