User Tools

Site Tools


homestead:ssl-self-signed-certificate

If not exists, create nginx ssl folder:

cd /etc/nginx && mkdir ssl && cd ssl

Create certificate:

openssl genrsa -des3 -out domain.local.key 2048
openssl req -new -key domain.local.key -out domain.local.csr
cp -v domain.local.{key,original}
openssl rsa -in domain.local.original -out domain.local.key
rm -v domain.local.original
openssl x509 -req -days 365 -in domain.local.csr -signkey domain.local.key -out domain.local.crt

nginx vhost conf

server {
    listen 443;
    server_name domain.local;
    root /path/to/code; # Usually /home/vagrant/Code/something/public

    ssl on;
    ssl_certificate      /etc/nginx/ssl/domain.local.crt;
    ssl_certificate_key  /etc/nginx/ssl/domain.local.key;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/domain.local-error.log error;

    error_page 404 /index.php;

    sendfile off;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}
homestead/ssl-self-signed-certificate.txt · Last modified: 2015/12/11 17:15 by osiux