地址栏重写

用户访问以前的网站能跳到现在的网站(可能该了域名,误删除等)

在代理机器的配置文件   vim /usr/local/nginx/conf/nginx.conf下修改配置

[root@proxy ~]# vim /usr/local/nginx/conf/nginx.conf
.. ..
server {
        listen       80;
        server_name  localhost;
location / {
    root   html;
index  index.html index.htm;
rewrite /a.html  /b.html;            【在这个配置文件中加入这样行即可“重写a网站为b 网站”】
}
}
外面需要写入一个字符来测试网页
echo "AAA" > /usr/local/nginx/html/a.html
firefox 192.168.4.5/a.html

猜你喜欢

转载自blog.csdn.net/weixin_42628856/article/details/81332017
今日推荐