Laster's Blog

Laster's Blog

気が向いた時の備忘録

Apacheのインストール

OpenSSL+Apacheをインストール

まずOpenSSLインストール

# cd /usr/locala/src
# wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz
# tar xvzf openssl-1.0.0d.tar.gz
# cd openssl-1.0.0d
# ./config --prefix=/usr/local/openssl-1.0.0d -fPIC shared
# make
# make install
# cd /usr/local/
# ln -s /usr/local/openssl-1.0.0d ssl

/etc/ld.so.confを編集
/usr/local/ssl/libを追加

include ld.so.conf.d/*.conf
/usr/local/ssl/lib

編集が終わったら
# ldconfig

次はApacheインストール

# cd /usr/locala/src
# wget http://ftp.riken.jp/net/apache//httpd/httpd-2.2.19.tar.gz
# tar xvzf httpd-2.2.19.tar.gz
# cd httpd-2.2.19
# ./configure  \
--prefix=/usr/local/apache2.2.19 \
--enable-module=so \
--enable-module=rewrite \
--enable-so \
--enable-dav \
--enable-dav-fs \
--enable-dav-lock \
--enable-ssl \
--with-ssl=/usr/local/ssl
# make
# make install
# cd /usr/local/
# ln -s apache2.2.19 apache2

次はOpenSSLの設定

# cd /usr/local/ssl/bin/
# openssl genrsa -des3 -out server.key -rand rand.dat 1024
Enter pass phrase for server.key:hogehoge
Verifying - Enter pass phrase for server.key:hogehoge

# openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:hogehoge
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Tokyo
Locality Name (eg, city) [Newbury]:Edogawa
Organization Name (eg, company) [My Company Ltd]:saltus
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:admin
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
Enter pass phrase for server.key:hogehoge
# openssl x509 -in server.crt -out server.der -outform DER
# cp server.* /usr/local/apache2/conf/

最後にApache設定
まずユーザ追加

# useradd -s /sbin/nologin apache

その次に/usr/local/apache2/conf/httpd.conf編集

User apache
Group apache
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

Apacheの起動
# /usr/local/apache2/bin/apachectl start
でパスフレーズの入力し起動
これでブラウザからIPでアクセスして正常に表示されることを確認したらOK

コメントを残す