Home > Article > Backend Development > nginx uses ssl module to configure HTTPS support, _PHP tutorial
The ssl module is not installed by default. If you want to use this module, you need to specify the --with-http_ssl_module parameter at compile time. The installation module depends on the OpenSSL library and some reference files, which are usually not in the same package. Usually this file name is something like libssl-dev.
You can generate a simple certificate by following these steps:
First, enter the directory where you want to create the certificate and private key, for example:
Create a server private key. The command will ask you to enter a password:
Create Certificate for Signing Request (CSR):
Remove the required password when loading Nginx with SSL support and using the above private key:
Finally mark the certificate using the above private key and CSR:
Modify the Nginx configuration file to include the newly tagged certificate and private key:
Restart nginx.
This will allow access via:
https://YOUR_DOMAINNAME_HERE
You can also add the following code to redirect port 80 to 443IT People Paradise
Please indicate the source of the article when reprinting: http://www.centos.bz/2011/12/nginx-ssl-https-support/