Difference between revisions of "Nginx"
From Organic Design wiki
m (→See also) |
(→See also: SSL - self-signed) |
||
Line 7: | Line 7: | ||
apt-get install php5-fpm nginx</bash>}} | apt-get install php5-fpm nginx</bash>}} | ||
+ | |||
+ | == 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, | ||
+ | {{code|<bash>openssl genrsa -des3 -out ssl.key 1024</bash>}} | ||
+ | |||
+ | |||
+ | Now we need to create a CSR (Certificate Signing Request): | ||
+ | {{code|<bash>openssl req -new -key ssl.key -out ssl.csr</bash>}} | ||
+ | |||
+ | |||
+ | 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|<bash>cp ssl.key ssl-pass.key | ||
+ | openssl rsa -in ssl-pass.key -out ssl.key</bash>}} | ||
+ | |||
+ | |||
+ | Now we can generate the actual certificate: | ||
+ | {{code|<bash>openssl x509 -req -days 365 -in ssl.csr -signkey ssl.key -out ssl.crt</bash>}} | ||
+ | |||
+ | |||
+ | The relevant ''server'' section can now be updated in the nginx configuration, | ||
+ | {{code|<pre> listen 80; | ||
+ | listen 443 default ssl; | ||
+ | |||
+ | ssl_certificate /etc/nginx/certs/ssl.crt; | ||
+ | ssl_certificate_key /etc/nginx/certs/ssl.key;</pre>}} | ||
+ | |||
== See also == | == See also == | ||
*[http://wiki.nginx.org/LikeApache Config example for Apache people] | *[http://wiki.nginx.org/LikeApache Config example for Apache people] | ||
+ | *[http://articles.slicehost.com/2007/12/19/ubuntu-gutsy-self-signed-ssl-certificates-and-nginx Self-signed certs in Nginx] | ||
*[http://www.westphahl.net/blog/2012/01/03/setting-up-https-with-nginx-and-startssl/ StartSSL & Nginx] | *[http://www.westphahl.net/blog/2012/01/03/setting-up-https-with-nginx-and-startssl/ StartSSL & Nginx] | ||
[[Category:Software]] | [[Category:Software]] |
Revision as of 16:27, 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,