QRコード
Top / Computer / FreeBSD / apacheの導入

Computer/FreeBSD

apache2をインストール

# portinstall www/apache2

設定

  • /usr/local/etc/apache21/httpd.confを編集
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
  • /etc/rc.confに以下を追加
    apache21_enable="YES"
    apache21ssl_enable="YES"

SSLの設定

  • ディレクトリを作っておく
    # mkdir /usr/local/etc/apache21/ssl.key
    # chmod 700 /usr/local/etc/apache21/ssl.key
    # mkdir /usr/local/etc/apache21/ssl.crt
    # chmod 700 /usr/local/etc/apache21/ssl.crt
  • 秘密鍵の作成
    # openssl genrsa -out /usr/local/etc/apache21/ssl.key/server.key 1024
  • 秘密鍵からサーバのx509証明書発行要求(CSR)を作成
    # openssl req -new -key /usr/local/etc/apache21/ssl.key/server.key -out /root/server.csr
  • 自己署名で証明書を作成
    # openssl x509 -in /root/server.csr -out /usr/local/etc/apache21/ssl.crt/server.crt -req -signkey /usr/local/etc/apache21/ssl.key/server.key -days 365
    Signature ok
    subject=/C=JP/ST=Tokyo/L=Ohta-Ku/O=unpush network./CN=www.unpush.net/emailAddress=admin@unpush.net
    Getting Private key

起動

# /usr/local/etc/rc.d/apache21.sh start
[warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter

警告が出た。どうやらaccf_httpというFreeBSDのカーネルモジュールが無い、ということらしい

モジュールのサーチパスを見てみる

# kldconfig -r
# ls -la /boot/modules | grep -i accf
# ls -la /boot/kernel | grep -i accf
-r-xr-xr-x  1 root  wheel     3168 Apr 29 12:18 accf_data.ko
-r-xr-xr-x  1 root  wheel     5772 Apr 29 12:18 accf_http.ko

あった。

ロードしてみる

# kldload accf_http.ko

警告が出なくなった

# /usr/local/etc/rc.d/apache21.sh restart
Performing sanity check on apache21 configuration:
Syntax OK
Stopping apache21.
Waiting for PIDS: 65348.
Starting apache21.

今後はカーネル本体に組み込むことにする


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Counter: 2380, today: 1, yesterday: 0
Last-modified: Wed, 11 May 2005 14:38:36 JST (1320d)