1.powerdns設定
<a href="http://s3.51cto.com/wyfs02/M01/6F/60/wKiom1WaTfqB55koAAHs-TR85D0250.jpg" target="_blank"></a>
2.内部網站介紹
web伺服器采用nginx,内網dns采用powerdns.
想實作的功能如下
通過ip通路時跳轉到A頁面,通過域名通路時,讓其跳轉到B頁面。兩種方式的端口均為80.
頁面A對應的nginx配置
server {
listen 80;
server_name localhost;
#charset koi8-r;
charset utf-8;
access_log logs/localhost.access.log main;
error_log logs/localhost.error.log;
root /var/www;
index index.php index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
location / {
}
頁面B對應的nginx配置
listen 80;
server_name zhidao.AAA.com;
#charset koi8-r;
charset utf-8;
access_log logs/localhost38.access.log;
error_log logs/localhost38.error.log;
location / {
root /var/www/q2a/question2answer-1.7;
index index.php index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
配置後重新開機nginx,
[root@movie conf]# /usr/local/nginx/sbin/nginx -s reload
3.測試
通過IP通路
<a href="http://s3.51cto.com/wyfs02/M02/6F/60/wKiom1WaUMPBHSsvAAEYwD4HT28683.jpg" target="_blank"></a>
通過域名通路
<a href="http://s3.51cto.com/wyfs02/M00/6F/5E/wKioL1WaUtmw_ivFAAIiXjq1Bho962.jpg" target="_blank"></a>
可以看到,二者分别跳轉到了不同頁面。
總結,以上其實是基于多個域名、同一端口的nginx應用。
<b>本文轉自 xoyabc 51CTO部落格,原文連結:http://blog.51cto.com/xoyabc/1671414,如需轉載請自行聯系原作者</b>