2011年5月18日星期三

  apache+openssl

$prefix is for normal user #prefix is for super user

1.install apache

#mkdir --parent /opt/httpd2
#cd /tmp/httpd/httpd-with-ssl
#tar --extract --verbose --gzip --file=httpd-2.2.18.tar.gz --directory=.
#cd httpd-2.2.18
#./configure --prefix=/opt/httpd2 --enable-ssl=shared
#make
#make intall

2.create server key

#cd /opt/httpd2/conf/
#mkdir ssl.key
#cd ssl.key
#openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:tyl
Organization Name (eg, company) [Internet Widgits Pty Ltd]:tz
Organizational Unit Name (eg, section) []:tz
Common Name (eg, YOUR name) []:tyl
Email Address []:tangyl@ruyi.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
# openssl x509 -req -days 700 -in server.csr -signkey server.key -out server.cert
Signature ok
subject=/C=AU/ST=Some-State/L=tyl/O=tz/OU=tz/CN=tyl/emailAddress=tangyl@ruyi.com
Getting Private key
Enter pass phrase for server.key:

3.configure apache

#cd /opt/httpd2/conf/extra/
#vi httpd-ssl.conf
SSLCertificateFile /opt/apache2/conf/ssl.key/server.cert
SSLCertificateKeyFile /opt/apache2/conf/ssl.key/server.key
#cd /opt/httpd2/conf/
#vi httpd.conf
Include conf/extra/httpd-ssl.conf

4.start apache

#/opt/httpd2/bin/apachectl start

5.input https://192.168.10.89/ on the browser

没有评论:

发表评论