安裝平台:CentOS 5.x + Server version: Apache/2.2.3
(本來是想寫透過PHP使用GMail寄信,不過發現需要啟動SSH的功能)
基本上要先安裝APACHE+OPENSSL
yum install apache
yum install openssl
首先需要產生SSL憑證:
$ openssl genrsa -out yourname.key 1024
Generating RSA private key, 1024 bit long modulus
......++++++
........++++++
e is 65537 (0x10001)
設定憑證的一些資訊:
$ openssl req -new -key yourname.key -out yourname.csr
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) [GB]:TW
State or Province Name (full name) [Berkshire]:Taipei County
Locality Name (eg, city) [Newbury]:Taipei City
Organization Name (eg, company) [My Company Ltd]:Squall
Organizational Unit Name (eg, section) []:Squall
Common Name (eg, your name or your server's hostname) []:www.l-penguin.idv.tw
Email Address []:steven@ms.ntcb.edu.tw
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
憑證簽署:
$ openssl x509 -req -days 365 -in yourname.csr -signkey
編輯ssl.conf
$ vim /etc/httpd/conf.d/ssl.conf
找到下面兩行,將路徑改成您存放crt及key的地方即可
SSLCertificateFile yourname.crt #112行
SSLCertificateKeyFile yourname.key #119行
重新啟動Apache即可,只要將原本網址http://xxx.xx.xxx 改成 https://xxx.xxx.xxx
Squall Linux, OS/Server apache, CentOS, Linux, SSH
Recent Comments