Generate a Certificate Signing Request (CSR) for Apache using OpenSSL

Solution ID:    SO6411    Updated:    04/13/2016


This document provides instructions for generating a Certificate Signing Request (CSR) & private key on Apache. If these instructions are unable to be used on the server, RapidSSL recommends that the server vendor or an organization that supports Apache be contacted.

Step 1: Generate Private Key

NOTE:   All certificates must have at least a 2048 bit key size.  2048 is the industry standard.  However, 4096 may be used if the environment requires a larger key size.  To generate a 4096 bit key, substitute 4096 for 2048 in the commands below.
The utility "openssl" is used to generate the key and CSR.
This utility comes with the OpenSSL package and is usually installed under /usr/local/ssl/bin.
If the utility was installed elsewhere, these instructions will need to be adjusted accordingly.
Type the following command at the prompt:

Linux / Unix servers:
openssl genrsa -des3 -out <private-key-file-name.key> 2048
Windows servers:
openssl genrsa -out <private-key-file-name.key>  2048
For example:
This command generates a 2048 bit RSA private key and stores it in the file privatekey.key.
When prompted for a pass phrase:
Enter a secure pass phrase and remember it, as this pass phrase protects the private key.  If the pass phrase is ever lost a new private key & CSR must be generated and the certifiate reissued.
NOTE: To bypass the pass phrase requirement, omit the -des3 option when generating the private key. If the private key is left unprotected, RapidSSL recommends access to the server be restricted so that only authorized server administrators can access or read the private key file.
Step 2: Generate the CSR
Type the following command at the prompt:
openssl req -new -key <private-key-file.key> -out <CSR-file.csr>
For example:

NOTE: If using openSSL on Windows, you may need to specify the path to openssl.cnf such as the following:
openssl req -new -key <private-key-file.key> -config "c:\Apache Software Foundation\Apache2.2\conf\openssl.cnf" -out <CSR-file.csr>
This command will prompt for the following X.509 attributes of the certificate:
Country Name: Use the two-letter code without punctuation for country, for example: US
State or Province: Spell out the state completely; do not abbreviate the state or province name, for example: California, not CA
Locality or City: The Locality field is the city or town name, for example: Eugene. Do not abbreviate. For example: Mountain View, not Mt. View
Company: If the company or department has an &, @, or any other symbol using the shift key in its name, the symbol must be spelled out or omitted, in order to enroll. Example: XY & Z Corporation would be XYZ Corporation or XY and Z Corporation.
Organizational Unit:  The Organizational Unit (OU) field is the name of the department or organization unit making the request. To skip the OU field, press Enter\Return on the keyboard.
Common Name: The Common Name is the Host + Domain Name. It looks like "" or "".
NOTE: Please do not enter an email address, challenge password or an optional company name when generating the CSR.  When prompted for these fields, press Enter/Return to leave the field blank.

To copy and paste the information into the enrollment form, open the file in a text editor such as Notepad or Vi. Do not use rich-text editors such as Microsoft Word as they may insert extra hidden characters that will alter the contents of the CSR.
Once the CSR has been created, proceed to Enrollment.
Step 3: Backup the private key
RapidSSL recommends backing up the private key and server certificate.  Use a back-up procedure that will securely store the files.
Contact Information
During the verification process, RapidSSL may need to contact your organization. Be sure to provide an email address, phone number, and fax number that will be checked and responded to quickly. These fields are not part of the certificate.
Once the certificate has been issued, follow the steps from this link to install the certificate on your server.

Legacy ID



RapidSSL has made efforts to ensure the accuracy and completeness of the information in this document. However, RapidSSL makes no warranties of any kind (whether express, implied or statutory) with respect to the information contained herein. RapidSSL assumes no liability to any party for any loss or damage (whether direct or indirect) caused by any errors, omissions, or statements of any kind contained in this document.  Further, RapidSSL assumes no liability arising from the application or use of the product or service described herein and specifically disclaims any representation that the products or services described herein do not infringe upon any existing or future intellectual property rights. Nothing herein grants the reader any license to make, use, or sell equipment or products constructed in accordance with this document. Finally, all rights and privileges related to any intellectual property right described herein are vested in the patent, trademark, or service mark owner, and no other person may exercise such rights without express permission, authority, or license secured from the patent, trademark, or service mark owner. RapidSSL reserves the right to make changes to any information herein without further notice.

Contact Support

US Support:

Order Processing

Technical Support

European Support:

Order Processing

Technical Support

SSL digital certificates sales live chat.

Knowledge Center

Search Tips