地址欄重寫

用戶訪問以前的網站能跳到現在的網站(可能該了域名,誤刪除等)

在代理機器的配置文件   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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章