nginx的https的搭建

1.防火墙不能关闭,让其开放http协议https协议

2.该网站具备账户验证

3.http

1.Server和Client下载ngnix服务

dnf install ngnix --y

修改ngnix配置文件 ,如图 etc/ngnix/ngnix.conf

  1. 检查并重启ngnix

ngnix-t

ngnix -是reload(systemctl restart ngnix)

3.添加域名解析,并将Client指向Server,如图

4.确认Server默认发布目录

root /usr/ahsre/ngnix/html;

访问www.hjf.com/image/1.png时,本质是访问/usr/share/ngnix/html/image/1.png

所以我们创建目录,并复制图片

cd /usr/share/ngnix/html

mkdir image

cp ngnix-logo.png image/1.png,如图(已创建)

5.安装工具

dnf install httpd-tools --y

6.新建用户,密码,使用htpasswd将网站和账户关联,并修改配置文件

htpasswd -c /etc/ngnix/passwd dsb

New password:

Re-type new password:

Adding password for user dsb

vim /etc/ngnix/ngnix.conf

auth_basic "please input your passwd"

auth_basic_user_file /etc/ngnix/password

如图

7.,检查,并重启ngnix

ngnix -t

ngnix -s reload

8.在Client浏览器访问www.hjf.com:8080/image/1.png测试,如图

9.开启防火墙,允许http服务通过

systemctl enable firewalld --now (重启防火墙)

firewall-cmd --add-port=8080/tcp

firewall-cmd --add-service=http

systemctl status firewalld.service (查看)

相关推荐
虎头金猫2 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
还是大剑师兰特2 天前
解决nginx错误:http://localhost:7000正常,http://localhost:7000/map 报错404
nginx·大剑师
AI职业加油站2 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
此冬歌咏2 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
xing-xing2 天前
Docker容器中Nginx站点根目录网页配置访问
nginx·docker
-梅2 天前
linux(8) 软硬链接
linux·运维·服务器
张洛闻Eren2 天前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github
其实防守也摸鱼2 天前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
布裘2 天前
【银河麒麟】V4桌面图标消失,右击鼠标没反应排查
运维·银河麒麟·桌面环境
懂软件的胡子个哥2 天前
微信机器人为什么需要“回复候选”而不是所有 AI 内容直接发送
运维·微信·自动化·wechatapi·个人微信号二次开发