Ubuntu uses nginx to configure https server

WBOY
Release: 2016-07-29 09:04:41
Original
1091 people have browsed it

Reference: http://www.cnblogs.com/yanghuahui/archive/2012/06/25/2561568.html
http://www.linuxidc.com/Linux/2011-11/47477.htm

http: //blog.csdn.net/sean_cd/article/details/38738599


nginx -V
Check whether nginx’s ssl configuration has –with-http_ssl_module. If the –with-http_ssl_module compilation parameter is not found, it means it is not supported. Nginx does not support SSL by default. You need to recompile by adding the –with-http_ssl_module parameter.
apt-get install openssl
cd /etc/nginx/
Create the server private key. The command will ask you to enter a password:
openssl genrsa -des3 -out server.key 1024
Create a certificate for signing request (CSR)
openssl req -new -key server.key -out server.csr
Remove the required password when loading Nginx with SSL support and use the above private key:
openssl rsa -in server.key -out server_nopwd.key

Finally mark the certificate using the above Private key and CSR

openssl x509 -req -days 365 -in server.csr -signkey server_nopwd.key -out server.crt
vi /etc/nginx/nginx.conf

Add in the http segment:
server {
           # listen 80;
listen 443;
server_name YourServerName;
root /var/mypagedir;
index index.php index.html index.htm;
ssl on;
ssl_cer tificate /etc/nginx/server.crt;
ssl_certificate_key /etc/ nginx/server_nopwd.key;
}

Restart niginx

service nginx restart

Put the web page file in /var/mypagedir and check whether the access verification is successful

The above introduces the use of nginx to configure https server in ubuntu, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template