Install SSL first, compile and install Apache, and then configure the certificate.
1. Download Apache and OpenSSL
Web: http://www.apache.org
Http://www.openssl.org
2. Extract
# Tar zxvf httpd-2.0.54.tar.gz
# Tar zxvf openssl-0.9.7g.tar.gz
3. Compile and install OpenSSL. This software is mainly used to generate certificates:
# Cd openssl-0.9.7g
#./Config
# Make
# Make Test
# Make install
Put OpenSSL in the kernel directory so that it can run in any directory.
# Cd/usr/local/bin
# Ln-S/usr/local/SSL/bin/OpenSSL
4. Compile and install Apache
# Cd/opt/httpd-2.0.54
#./Configure -- prefix = "/opt/apache2" -- enable-so -- enable-SSL -- With-SSL = "/usr/local/SSL/bin"
# Make
# Make install
5. After the installation is complete, generate the certificate:
Create an SSL. Key Directory under/opt/apache2/Conf
# CD ../apache2/
# Cd CONF/
# Mkdir SSL. Key
Then generate a certificate in this directory:
# Cd SSL. Key/
Generate the server private key:
# OpenSSL Gen RSA-des3-out server. Key 1024
Generating RSA private key, 1024 bit long Modulus
...
........................................ ......... ++
E is 65537 (0x10001)
Enter pass phrase for server. Key:
Verifying-enter pass phrase for server. Key:
Generate a server certificate request and fill in the relevant certificate information as required:
# 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 ininitialized
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 []:
Visa:
# 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:
For security, we set the permissions for these files to 400.
Chmod 400 server. Key
Chmod 400 server. Cert
Finally, modify/opt/apache2/CONF/SSL. conf:
VI/opt/apache2/CONF/SSL. conf
The changes are as follows:
# Sslcertificatefile/opt/apache2/CONF/SSL. CRT/server. CRT # Row 108
Sslcertificatefile/opt/apache2/CONF/SSL. Key/server. Cert
# Sslcertificatefile/opt/apache2/CONF/SSL. CRT/server-dsa.crt
Sslcertificatekeyfile/opt/apache2/CONF/SSL. Key/server. Key # Row 116
# Sslcertificatekeyfile/opt/apache2/CONF/SSL. Key/server-dsa.key
In this way, we have basically configured SSL. Now let Apache start SSL.
/Opt/apache2/bin/apachectl startssl
Then, you must enter the certificate password. After the correct password is entered, SSL will be started together with Apache.
Enter https: // 210.75.18.36 in the browser.
Download Certificate required. OK ~ Okay ~ End ~ That's simple.
Reference: http://www.szlangxing.com/Article/gyw/200504/524.html
Http://www.chinaunix.net/jh/13/469276.html
Keytool application instance:
1. Generate a keystore:
Keytool-genkey-alias myssl-keyalg RSA-keystore myssl. jks
When you run this command, the system prompts:
Enter keystore password :( enter the keystore password :)
Yourpassword)
What is your first and last name? (What is your first name and last name ?)
[UNKNOWN]: www.myssl.cn (enter the Domain Name of the applied Certificate)
What is the name of your organizational unit? (What is the name of your organization ?)
[UNKNOWN]: fastcom (enter the name of your organization)
What is the name of your organization? (What is your organization name ?)
[UNKNOWN]: fastcom (enter the name of your organization)
What is the name of your city or locality? (What is the name of your city or region ?)
[UNKNOWN]: Shanghai (enter the name of the city)
What is the name of your state or province? (What is the name of your state or province ?)
[UNKNOWN]: Shanghai (enter the name of the Province)
What is the two-letter country code for this unit? (What is the two-letter country code for this unit ?)
[UNKNOWN]: CN (enter the country name. If it is China, enter CN)
Is Cn = www.myssl.cn, ou = fastcom, O = fastcom, L = Shanghai, St = Shanghai, c = cn correct? [No]:
Yes