понедельник, 25 октября 2010 г.

Как настроить SSL Virtual Host



Things You'll Need:

  • Linux server with Apache2
  • Internet connection 
  1. Assuming Apache2 is already installed, at the Linux command prompt, install the Apache SSL module with the following command:
    apt-get install libapache-mod-ssl

  2. Issue the following command at the prompt to enable Apache2 SSL:
    a2enmod ssl

  3. Issue the command to generate a certificate as follows:
    apache2-ssl-certificate --days 365 

    This generates a certificate that is good for 365 days.
  4. Using a text editor, edit the /etc/apache2/ports.conf file and add the following line to cause Apache2 to listen on port 443:
    Listen 443

    Save the file and exit.
  5. Copy the default Apache configuration file to a new file named "default-ssl-site" with the following command:
    cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default-ssl-site

    Edit the default-ssl-site file and ensure that the following lines are included:

    NameVirtualHost *.443

    ServerAdmin youremailaddress@yourprovider

    SSLEngine On

    SSLCertificateFile /etc/apache2/ssl/certs/apache.crt

    SSLCertificateKeyFile /etc/apache2/apache-ssl/apache.pem

  6. Issue the following commands to enable your default-ssl-site and restart the Apache2 server:
    a2ensite default-ssl-site

    /etc/init.d/apache2 restart

    Your default-ssl-site should now listen on port 443 (SSL). You can test by opening a browser and keying "localhost/default-ssl-site" in the address bar and pressing "Enter."


Комментариев нет: