首先我们先下载nginx安装包
dnf install nginx -y
这样才可以cd进入nginx生成密钥
私钥:
openssl genrsa -out xxx.key 2048
公钥:
openssl req -new -key xxx.key -x509 -days 365 -out xxx.crt
先cd到conf.d/中
再进入ssl_web.conf配置
vim /etc/nginx/conf.d/ssl_web.conf
server{
listen 443 ssl http2;
server_name *.xxx.com;
root /webpage;
ssl_certificate /etc/nginx/xxx.crt;
ssl_certificate_key /etc/nginx/xxx.key;
location /image{
root /webpage/image;
}
location /mp4{
root /tmp/mp4;
}
}
当然不要忘记写入内容
cd webpage/
echo "hallo 0.0.0.0" > index.html
最后重启进行
nginx -s reload
OK,访问网址即可
不安全是正常的,这是因为我们是自测使用,就这样。