Advertisement
IchHabRecht

[APACHE] SSL certificate

Dec 28th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.95 KB | None | 0 0
  1. Step 1: Generate a Private Key
  2.     openssl genrsa -des3 -out server.key 1024
  3.  
  4. Step 2: Generate a CSR (Certificate Signing Request)
  5.     openssl req -new -key server.key -out server.csr
  6.  
  7. Step 3: Remove Passphrase from Key
  8.     cp server.key server.key.old
  9.     openssl rsa -in server.key.old -out server.key
  10.  
  11. Step 4: Generating a Self-Signed Certificate
  12.     openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  13.  
  14. Step 5: Installing the Private Key and Certificate
  15.     a2enmod ssl
  16.     mkdir /etc/apache2/ssl
  17.     cp server.crt /etc/apache2/ssl/ssl.crt
  18.     cp server.key /etc/apache2/ssl/ssl.key
  19.  
  20. Step 6: Virtuel Host
  21.     <VirtualHost *:443>
  22.             ServerAdmin webmaster@localhost
  23.  
  24.             DocumentRoot /var/www
  25.             <Directory />
  26.                     Options FollowSymLinks
  27.                     AllowOverride None
  28.             </Directory>
  29.             <Directory /var/www/>
  30.                     Options Indexes FollowSymLinks MultiViews
  31.                     AllowOverride None
  32.                     Order allow,deny
  33.                     allow from all
  34.             </Directory>
  35.  
  36.             ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  37.             <Directory "/usr/lib/cgi-bin">
  38.                     AllowOverride None
  39.                     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  40.                     Order allow,deny
  41.                     Allow from all
  42.             </Directory>
  43.  
  44.             SSLEngine on
  45.             ServerSignature On
  46.             SSLCertificateFile /etc/apache2/ssl/ssl.crt
  47.             SSLCertificateKeyFile /etc/apache2/ssl/ssl.key
  48.             SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
  49.  
  50.             ErrorLog ${APACHE_LOG_DIR}/ssl-error.log
  51.  
  52.             # Possible values include: debug, info, notice, warn, error, crit,
  53.             # alert, emerg.
  54.             LogLevel warn
  55.  
  56.             CustomLog ${APACHE_LOG_DIR}/ssl-access.log combined
  57.     </VirtualHost>
  58.  
  59. ---
  60.  
  61. Certificate Signing Request for webserver
  62.  
  63. openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement