The process of configuring SSL for Apache

Source: Internet
Author: User
Tags openssl version openssl x509 fully qualified domain name

Reference: http://blog.csdn.net/Sky_qing/article/details/44303221

Environment: ubuntu14.04 64-bit

Because OpenSSL is already included in this version of Ubuntu, you can use:

OpenSSL version–a

View.

1. Installing Apache2

sudo apt-get install apache2

2. Enable the SSL module

sudo a2enmod SSL

3. Create a CA signature

sudo OpenSSL genrsa-des3-out server.key 1024

Here will be a password to enter the situation, set the password can be confirmed here once: be sure to remember this password, which is the key access password.

4. Create a CSR (Certificate Signing Request)

sudo OpenSSL req-new-key server.key-out SERVER.CSR

This is the first to ask for a password, this is the password you set earlier, there will be some country, the city's information settings, according to their own needs to set.

5. Self-issued certificate

sudo openssl x509-req-days 365-in server.csr-signkey server.key-out server.crt

Will prompt for success, then enter the password.

6. Copy the file to the directory you set, and then modify it in the configuration file.

I'm here to copy the files under the/etc/apache2/ssl clip.

sudo mkdir/etc/apache2/ssl

sudo mkdir/etc/apache2/ssl/certs

sudo mkdir/etc/apache2/ssl/private

Copy:

sudo cp server.crt/etc/apache2/ssl/certs

sudo cp server.key/etc/apache2/ssl/private

7. Configuration file Modification

sudo cp/etc/apache2/sites-enabled/000-default.conf/etc/apache2/sites-enabled/001-ssl

sudo gedit/etc/apache2/sites-enabled/001-ssl

Change 80 to 443

Add after DocumentRoot (follow the path you set earlier)

Sslengine on

Ssloptions +strictrequire

Sslcertificatefile/etc/apache2/ssl/certs/server.crt

Sslcertificatekeyfile/etc/apache2/ssl/private/server.key

8. Restart Apache2

Sudo/etc/init.d/apache2 restart

Here, you need to enter the key access password that you set earlier, and after successful entry, you will be able to restart successfully.

9. View in Browser

Address field input: https://localhost/

Then will prompt the untrusted certificate, adds this to the exception to be OK, can the normal access.

A few common questions:

1.

Tip 443 Port is already occupied ,

Solve:

sudo gedit/etc/apache2/ports.conf

Make sure that the file has only

Listen 80

This problem can occur if you include listen 443

Reference:

Http://stackoverflow.com/questions/9143964/make-sock-could-not-bind-to-address-443-when-restarting-apache-installi

2.

[Email protected]:/usr/share/apache2$ sudo/etc/init.d/apache2 Restart

* Restarting Web server apache2 AH00558:apache2:Could not reliably determ INE the server ' s fully qualified domain name, using 127.0.1.1. Set the ' ServerName ' directive globally to suppress this message

Restart service found, no ServerName This problem, just apache2 problem, and OpenSSL is not closed.

Reference:

Http://blog.sina.com.cn/s/blog_4ce89f200100yy1q.html

At the end of the/etc/apache2/apache2.conf document, add one sentence:

ServerName localhost:80

The process of configuring SSL for Apache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.