Apache httpd : インストール2026/01/16 |
|
Apache httpd をインストールして Web サーバーを構築します。 |
|
| [1] | httpd をインストールします。 |
|
root@www:~ # pkg install -y apache24
|
| [2] | httpd の設定です。サーバーの名前等は自身の環境に置き換えてください。 |
|
root@www:~ #
vi /usr/local/etc/apache24/httpd.conf # 217行目 : 管理者アドレス指定 ServerAdmin root@srv.world
# 226行目 : コメント解除しサーバー名指定 ServerName www.srv.world:80
# 264行目 : 変更 (Indexes は削除) Options FollowSymLinks # 271行目 : 変更 AllowOverride All
# 284行目 : 必要に応じて追記 # ディレクトリ名のみでアクセスできるファイル名 DirectoryIndex index.html index.php index.cgi
# 331行目 : コメント化 (combined ログに切り替え) # CustomLog "/var/log/httpd-access.log" common
# 337行目 : コメント解除 (combined ログに切り替え) CustomLog "/var/log/httpd-access.log" combined
root@www:~ #
vi /usr/local/etc/apache24/extra/httpd-default.conf # 55行目 : 変更 (サーバーの応答ヘッダー) ServerTokens Prod
service apache24 enable apache24 enabled in /etc/rc.conf root@www:~ # service apache24 start Performing sanity check on apache24 configuration: Syntax OK Starting apache24. |
| [3] | HTML テストページを作成して動作確認をします。クライアントコンピューターで Web ブラウザーを起動し、以下のように作成したテストページにアクセスできれば OK です。 |
|
root@www:~ #
vi /usr/local/www/apache24/data/index.html <html> <body> <h1 style="width: 100%; font-size: 40px; text-align: center;"> Test Page </h1> </body> </html> |
|
| Sponsored Link |