How to create a self-signed (wildcard) certificate

This is a really short a efficate tutorial to generate a self-signed wildcard certificate for apache / nginx :

openssl genrsa 2048 > host.key
openssl req -new -x509 -nodes -sha1 -days 3650 -key host.key > host.cert
#[enter *.domain.com for the Common Name]
openssl x509 -noout -fingerprint -text < host.cert > host.info
cat host.cert host.key > host.pem
chmod 400 host.key host.pem

Now you can plug it with NGinx :

server {
  server_name  mobile.celogeek.com;
  listen 443;
  ssl on;
  ssl_certificate conf/ssl/celogeek_com/host.pem;
  ssl_certificate_key conf/ssl/celogeek_com/host.key;

  root /var/www/mobile;
  access_log /var/log/nginx/mobile.access.log;
  error_log  /var/log/nginx/mobile.error.log info;

  location / {
                index  index.html index.htm;
  }

  location ~ .php$ {
    fastcgi_pass unix:/var/run/php-fpm.sock;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        /usr/local/etc/nginx/fastcgi_params;
  }
}

Sources : http://www.justinsamuel.com/2006/03/11/howto-create-a-self-signed-wildca...

Short URL

Comments