nginx将xxxx.html/重定向到xxxx.html
在nginx对应server中添加下面代码 123location ~ (.*\.html)/$ { rewrite (.*\.html)/$ $1 permanent;} 最近leancloud统计当中还是有一堆/archives/2021/02/589e0477.html/的数据出现。迫于无奈只能通过nginx进行匹对进行重定向,以解决该问题的出现。
服务器安装nginx
安装nginx 连接服务器执行ssh root@ip命令安装nginx执行yum -y install nginx命令等待安装完成当出现完毕!时,代表安装完成了 启动nginx服务 执行service nginx start命令会看到Redirecting to /bin/systemctl start nginx.service,代表启动服务完成然后在浏览器输入你的服务器ip会看到nginx的信息 无法访问 假如无法通过服务器ip访问,显示无法连接服务器防火墙阻拦了,需要关闭防火墙执行systemctl stop firewalld.service命令,停止防火墙执行systemctl disable firewalld.service命令,禁止防火墙开机启动重新访问你的服务器ip,会发现可以看到Welcome to nginx on Fedora! 停止nginx服务 执行service nginx stop命令会看到Redirecting to /bin/systemctl stop...