How to Enable SSL in Apache 2

Save

The Apache Project has produced one of the most popular Web server platforms available in its Apache2 server, and the fact that it is free does not diminish its robust feature list. However, with any Web server you need to provide secure connections for your users. Secure Sockets Layer (SSL) is the accepted standard software that performs this function for many Web servers, including Apache2. Installing and implementing SSL on your Apache2 server will provide the secure connections that your users need and want. OpenSSL is the de facto standard for SSL, and Ubuntu is one of the most popular Linux distributions available.

  • Install Apache2, OpenSSL and PHP5 with the following commands at the command prompt:

    apt-get install apache2
    apt-get install openssl
    apt-get install libapache2-mod-php5
    apt-get install php5-cli php5-common php5-cgi

  • Generate an SSL certificate with the following command:

    openssl req $@ -new –x509 –days 365 –nodes –out /etc/apache2/apache.pem –keyout /etc/apache2/apache.pem

    This starts the SSL certificate generation process, which will ask you for specific information about your organization. Enter a period (“.”) to leave a field blank.

  • Ensure that the correct permissions are set for the “apache.pem” file with the following command:

    chmod 600 /etc/apache2/apach.pem

    Add the following line to the /etc/apache2/ports.conf file so that Apache2 will listen on port 443:

    Listen 443

  • Enable SSL support for your Apache2 Web server and restart the server with the following commands:

    a2enmod ssl
    /etc/init.d/apache2 restart

  • Configure Apache2 to use SSL by editing the configuration file for your site. Make sure the following two lines are present:

    NameVirtualHost .80 (change from NameVIrtualHost )
    NameVirtualHost *.443 (allows SSL connections)

    Restart Apache2 with the following command:

    /etc/init.d/apache2 restart

  • Test the SSL operation by opening a browser and keying https://&lt;webservername> or <localhost> in the URL box. Press “Enter.” If you see either a message asking permission to proceed or your website, you have successfully enabled SSL on your Apache2 server.

References

  • Photo Credit John Foxx/Stockbyte/Getty Images
Promoted By Zergnet

Comments

Resources

You May Also Like

  • How to Use Mirage OS

    Mirage OS is a type of flash application program that is used to execute TI Basic and Z80 Assembly programs for the...

  • How to Enable Mod_Rewrite on an Apache Server

    The Apache mod_rewrite module plays an important role in keeping meaningful web URLs that translate into more sensible system functions. The mod_rewrite...

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!