Some Web sites, such as on-line stores, require secure communication (HTTPS) to protect credit-card transactions and customer information. Like Apache, Nginx supports HTTPS via an SSL module, and it’s very easy to set up. In this tutorial i use hostname srv-web01.nginx.vn with the ip address 10.11.218.251. First, you need to generate an SSL certificate. The openssl command will ask you a bunch of questions, but you simply can press Enter for each one: # yum install openssl # mkdir /etc/nginx/ssl # cd /etc/nginx/ssl # openssl req -new -x509 -nodes -days 265 -newkey rsa:2048 -out server.crt -keyout server.key Create a new config file called /etc/nginx/sites-available/nginx.vn, which contains the following: server { listen 443; server_name nginx.vn; root /var/www/nginx.vn index index.html index.htm access_log /var/log/nginx/nginx.vn-access.log; error_log /var/log/nginx/nginx.vn-error.log; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key ...
Comments
Post a Comment