![]() key file to the SSLCertificateKeyFile directive. crt file you have generated earlier after SSLCertificateFile.Īdd the location of the. ![]() MAMP might put both DocumentRoots together, resulting in it looking for /Applications/MAMP/htdocs/Applications/MAMP/htdocs, which fails.įinally, specify the SSLCertificateFile and SSLCertificateKeyFile directives. If you see 404 errors on but the site works fine on try commenting out the DocumentRoot line (by placing a # in front of it). Note: The DocumentRoot might not be necessary anymore from MAMP 4.4.1. Finally, the SSLEngine needs to be set to on. The ServerName should be changed to localhost:443. First, the VirtualHost should be set to *:443, instead of _default_:443. # Enable/Disable SSL for this virtual host.Ī couple of things need to be changed in this configuration. TransferLog “/Applications/MAMP/Library/logs/access_log” Openssl req -new -sha256 -nodes -out server.csr -newkey rsa: 2048 -keyout server.key -config ĭocumentRoot “/Applications/MAMP/Library/htdocs”ĮrrorLog “/Applications/MAMP/Library/logs/error_log” Openssl req -x509 -new -nodes -key ~/ssl/rootCA.key -sha256 -days 1024 -out ~/ssl/rootCA.pemĪfterwards, we can create the private key for the certificate (server.key): Next, we will generate the root certificate which will be valid for 1024 days: Openssl genrsa -des3 -out ~/ssl/rootCA.key 2048 Next, paste the following line which will generate a RSA private key: Which will show all files in the ~/ssl/ directory. You can verify the files are in the directory by typing KeyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment You can change these attributes to reflect those of your own organization:įollowed by an enter. Next up, create a file named by using your text editor of choice, in this case, I’m using viĪnd copy the following information (for more information about what each field after does, refer to this guide by Oracle). We now need to enter that directory by typing: This will create a directory called ssl in your root folder. Open up a terminal and type the following: The following steps need to be taken to create a certificate with SAN for localhost: Generating the certificate This does involve some messing around with the command line but is not too hard to do. Getting a certificate with the right properties can be a daunting task, but luckily Alexander Zeitler has written a guide on how to generate a certificate with a Subject Alternative Name. Since Chrome 58, certificates for use on localhost need to have a SAN, Subject Alternative Name. Generating a self-signed certificate for local use It combines free software such as Apache, NGINX, and MySQL and is the software of choice here at Really Simple SSL headquarters. MAMP is a one-click solution for macOS and Windows for setting up a local development environment. The instructions are based on macOS Sierra 10.12.5, using MAMP (Apache) and Chrome 59. This guide will walk you through all the necessary steps to get a working certificate on localhost. If you do development on your own machine, then deploy to production, and you have an SSL certificate on your site, it is useful to have SSL on your localhost environment.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |