Difference between revisions of "Nginx"
From Organic Design wiki
(→See also: SSL - self-signed) |
m (→Self-signed SSL certificates) |
||
Line 12: | Line 12: | ||
First we need to create a private key. Note that this process will require a pass-phrase for the key - don't worry, we'll remove it later to make things easier, | First we need to create a private key. Note that this process will require a pass-phrase for the key - don't worry, we'll remove it later to make things easier, | ||
− | {{code|< | + | {{code|<pre>openssl genrsa -des3 -out ssl.key 1024</pre>}} |
Now we need to create a CSR (Certificate Signing Request): | Now we need to create a CSR (Certificate Signing Request): | ||
− | {{code|< | + | {{code|<pre>openssl req -new -key ssl.key -out ssl.csr</pre>}} |
Now we need to remove the pass-phrase otherwise it'll prevent the web-server from restarting without it being entered (you'll need to enter the pass-phrase to remove it though), | Now we need to remove the pass-phrase otherwise it'll prevent the web-server from restarting without it being entered (you'll need to enter the pass-phrase to remove it though), | ||
− | {{code|< | + | {{code|<pre>cp ssl.key ssl-pass.key |
− | openssl rsa -in ssl-pass.key -out ssl.key</ | + | openssl rsa -in ssl-pass.key -out ssl.key</pre>}} |
Now we can generate the actual certificate: | Now we can generate the actual certificate: | ||
− | {{code|< | + | {{code|<pre>openssl x509 -req -days 365 -in ssl.csr -signkey ssl.key -out ssl.crt</pre>}} |
Line 34: | Line 34: | ||
ssl_certificate /etc/nginx/certs/ssl.crt; | ssl_certificate /etc/nginx/certs/ssl.crt; | ||
ssl_certificate_key /etc/nginx/certs/ssl.key;</pre>}} | ssl_certificate_key /etc/nginx/certs/ssl.key;</pre>}} | ||
− | |||
== See also == | == See also == |
Revision as of 16:28, 29 August 2012
Self-signed SSL certificates
Nginx doesn't use the basic .pem files that can be used by Apache for self-signed certificates. We need to go through the following procedure to turn the pem into key and crt files.
First we need to create a private key. Note that this process will require a pass-phrase for the key - don't worry, we'll remove it later to make things easier,
Now we need to create a CSR (Certificate Signing Request):
Now we need to remove the pass-phrase otherwise it'll prevent the web-server from restarting without it being entered (you'll need to enter the pass-phrase to remove it though),
Now we can generate the actual certificate:
The relevant server section can now be updated in the nginx configuration,