1. 下载Nginx服务
# centos
yum install -y nginx
# ubuntu
apt-get install -y nginx
2. 验证访问Nginx是否部署成功
http://192.168.20.11/
3. 生成SSL自签证书
openssl req -x509 -newkey rsa:2048 -nodes -keyout my-nrdstudio.key -out my-nrdstudio.crt -days 365
4. index目录和证书
5. 增加Nginx配置文件
server {listen 80;server_name hu123.cn www.hu123.cn 192.168.20.11;location ~/ {rewrite ^(.*)$ https://$host$1 permanent; # http强制跳转https}
}server {listen 443 ssl; server_name hu123.cn www.hu123.cn 192.168.20.11;root /opt/www/web/;ssl_certificate /opt/www/my-nrdstudio.crt;ssl_certificate_key /opt/www/my-nrdstudio.key; #证书密钥文件ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL;
}