インストール
Apache HTTP Serverでwebサーバーを構築します。
# pkg search apache
apache24-2.4.62 Version 2.4.x of Apache web server
pkg install -y apache24
httpd-default.confの設定
# ee /usr/local/etc/apache24/extra/httpd-default.conf
ServerTokens Full
↓
ServerTokens Productonly
#ヘッダーに含まれるサーバーの情報を最小限にします。
ServsrSignature Off
#デフォルトのまま。エラー画面に表示されるApacheのバージョン情報等を表示しません。
httpd.confの設定
# ee /usr/local/etc/apache24/httpd.conf
ServsrAdmin hoge@jsnsver.com
#管理者のメールアドレス
#ServerName www.example.com:80
↓
ServerName jsnsver.com:80
#コメントアウト解除、サーバー名記入
Options Indexes FollowSymLinks
↓
Options -Indexes +FollowSymLinks
#ディレクトリインデックスの禁止。シンボリックリンクを有効に
AllowOverride None
↓
AllowOverride All
#.htaccessの許可
DirectoryIndex index.html
↓
DirectoryIndex index.html index.php index.cgi
#index.php index.cgiを追加
#CustomLog “/var/log/httpd-access.log” combined
↓
CustomLog “/var/log/httpd-access.log” combined
#コメントアウト解除、combinedログに変更。
#AddHandler cgi-script .cgi
↓
AddHandler cgi-script .cgi
#コメントアウト解除、cgi使用可に変更。
#Include etc/apache24/extra/httpd-default.conf
↓
Include etc/apache24/extra/httpd-default.conf
#先程設定したhttpd-default.confの設定を有効にするためコメントアウト解除。
DocumentRoot “/usr/local/www/apache24/data”
# ↑ デフォルトのドキュメントルート
apacheの起動
# ee /etc/rc.conf
apache24_enable=”YES”
# ↑ 追記
# service apache24 start
Performing sanity check on apache24 configration:
Syntax OK
Starting apache24
#apache起動
ブラウザで確認
クライアントのブラウザからローカルIPアドレスでアクセスして、下のようなテストページが表示されればOKです。
