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 when compiling. The installation module depends on the OpenSSL library and some reference files. Usually these files are not in the same software package. . Usually this file name is something like libssl-dev.
Generate Certificate
You can generate a simple certificate by following these steps:
First, go to 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 a certificate for signing request (CSR):
Remove the required password when loading Nginx with SSL support and use the above private key:
Configure nginx
Finally sign the certificate using the above private key and CSR:
Modify the Nginx configuration file to include the newly tagged certificate and private key:
https://YOUR_DOMAINNAME_HERE
In addition, you can also add the following code to redirect port 80 to 443IT People Paradise
server {
The above introduces how nginx uses the ssl module to configure HTTPS support, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.