#
ドキュメント

Document

自分のための備忘録です。

Apacheのコマンド一覧

# configファイルチェック
$ apache2ctl configtest
# 問題がないのに sytax error が発生する場合環境変数を読み込み直すと解消することがあった
# $ source /etc/apache2/envvars
# サイト有効化&無効化
$ a2dissite
$ a2ensite
# モジュール有効化&無効化
$ a2enmod
$ a2dismod
# 再起動
$ systemctl start apache2
// or sudo apachectl start
$ systemctl reload apache2
// or sudo apachectl restart 
# バージョン確認
$ apache2 -v
# モジュール確認
$ apachectl -M
// こちらは有効化されているモジュール
// 利用可能モジュールではないことに注意

httpとhttpsの例

$ cd /etc/apache2/sites-available
$ ls -al
-rw-r--r-- 1 root root 1588 Mar 19 09:44 hiroshi-sawai.com-ssl.conf
-rw-r--r-- 1 root root 1537 Aug 13  2020 hiroshi-sawai.com.conf

それぞれ有効化する。

$ a2ensite hiroshi-sawai.com-ssl.conf
$ a2ensite hiroshi-sawai.com.conf