最新消息:20210917 已从crifan.com换到crifan.org

[记录]把服务器的IP地址映射到某二级域名http://hd.isip.cn

nginx crifan 2663浏览 0评论

之前有个正在使用的CentOS的服务器,运行了Flask程序

IP地址是:

115.29.173.126

对应的,有个二级域名

http://hd.isip.cn

需要绑定上去。

然后对方已经绑定了。

6分钟左右就生效了。

现在需要自己去CentOS的Nginx中,去做映射。

其中,原先的服务器,已经绑定到了另外一个二级域名上:

hd.webonn.com

➜  conf.d ll
total 20K
-rw-r–r– 1 root root  534 Aug 18 17:54 default.conf
-rw-r–r– 1 root root 2.1K Aug 18 17:01 default.conf_backup
-rw-r–r– 1 root root  163 Aug 17 20:08 sipevents.conf
-rw-r–r– 1 root root  466 Jun 17  2015 ssl.conf
-rw-r–r– 1 root root  283 Jun 17  2015 virtual.conf
➜  conf.d cat default.conf
server {
    listen 80;
    #server_name 115.29.173.126;
    server_name hd.webonn.com;
    access_log  /var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log;
    location / {
        proxy_pass         http://127.0.0.1:8080/;
        proxy_redirect     off;
        proxy_set_header   Host                 $host;
        proxy_set_header   X-Real-IP            $remote_addr;
        proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto    $scheme;
    }
}
➜  conf.d pwd
/etc/nginx/conf.d

CentOS Nginx 多域名

Nginx 多域名

nginx同一iP多域名配置方法 – myweishanli的专栏 – 博客频道 – CSDN.NET

nginx同一iP多域名配置方法 – vshcxl的个人页面 – 开源中国社区

Nginx多Server反向代理配置centos

➜  conf.d service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]

结果还是不行:

http://hd.isip.cn

温馨提示中文English
该网站暂时无法访问
尊敬的用户,您好
很抱歉,该网站暂时无法访问,可能由以下原因导致:
原因一:未备案或未接入;根据《非经营性互联网信息服务备案管理办法》,网站需要完成备案或接入。请登录代备案管理系统进行操作。
原因二:网站内容与备案信息不符或备案信息不准确;根据《非经营性互联网信息服务备案管理办法》,网站内容需要与备案信息一致,且备案信息需真实有效。建议网站管理员尽快修改网站信息。
工信部备案查询点此进入 ,购买云计算产品可领取优惠券

去ping,是可以ping通:

➜  linphone-iphone git:(master) ping hd.isip.cn
PING hd.isip.cn (115.231.25.163): 56 data bytes
64 bytes from 115.231.25.163: icmp_seq=0 ttl=55 time=15.584 ms
64 bytes from 115.231.25.163: icmp_seq=1 ttl=55 time=17.891 ms
64 bytes from 115.231.25.163: icmp_seq=2 ttl=55 time=12.776 ms
^C

<div–<- hd.isip.cn ping statistics —

3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 12.776/15.417/17.891/2.092 ms

不过IP还没有生效,还是之前别人的IP:

115.231.25.163

而我此处的自己的IP是:

115.29.173.126

后来再去ping,结果IP地址好像又是之前的:

➜  linphone-iphone git:(master) ping hd.isip.cn
PING hd.isip.cn (59.56.19.76): 56 data bytes
64 bytes from 59.56.19.76: icmp_seq=0 ttl=55 time=26.801 ms
64 bytes from 59.56.19.76: icmp_seq=1 ttl=55 time=29.810 ms
64 bytes from 59.56.19.76: icmp_seq=2 ttl=55 time=96.399 ms
64 bytes from 59.56.19.76: icmp_seq=3 ttl=55 time=27.659 ms
64 bytes from 59.56.19.76: icmp_seq=4 ttl=55 time=27.767 ms
64 bytes from 59.56.19.76: icmp_seq=5 ttl=55 time=25.701 ms
64 bytes from 59.56.19.76: icmp_seq=6 ttl=55 time=25.585 ms
64 bytes from 59.56.19.76: icmp_seq=7 ttl=55 time=27.408 ms
^C

<div–<- hd.isip.cn ping statistics —

8 packets transmitted, 8 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 25.585/35.891/96.399/22.904 ms

结果郁闷了:

改回来之前默认的配置,结果网页也无法访问了:

[已解决]nginx页面无法访问:502 Bad Gateway nginx/1.0.15

在另外的IP映射生效后:

➜  ~ ping hd.isip.cn
PING hd.isip.cn (115.29.173.126): 56 data bytes
64 bytes from 115.29.173.126: icmp_seq=0 ttl=54 time=130.791 ms
64 bytes from 115.29.173.126: icmp_seq=1 ttl=54 time=59.427 ms
64 bytes from 115.29.173.126: icmp_seq=2 ttl=54 time=107.373 ms
^C

<div–<- hd.isip.cn ping statistics —

3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 59.427/99.197/130.791/29.702 ms

然后再去试试新的二级域名:

结果还是无法访问:

暂时先不去管了。

http://hd.isip.cn

转载请注明:在路上 » [记录]把服务器的IP地址映射到某二级域名http://hd.isip.cn

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
93 queries in 0.202 seconds, using 23.39MB memory