IP地址显示在地址栏而不是域中 [英] IP address is shown in address bar instead of domain

查看:207
本文介绍了IP地址显示在地址栏而不是域中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WAMP家庭网络服务器,并在静态IP上运行,并使用Namecheap注册了一个域,但我对DNS有些不稳定。起初我使用URL重定向并将其指向我的IP。这意味着当您输入域名(如example.com)时,只需将您重定向到我的IP地址,即可在域名中替换域名。现在我试图让域名显示而不是地址栏中的IP,我正在努力地明白如何做。



最新的事情我尝试过许多人说要做的是,而不是使用URL重定向来使用A(地址)记录类型并将其指向我的IP,我认为这将终于解决我的问题。当然15分钟左右,当它全部更新了,我得到一个400错误请求与nginx在它下面的Firefox,和一个空白的页面在Chrome。现在我在两个空白页面。我在这里做错了吗?我需要在Web服务器上编辑某些东西,如httpd.conf吗?我完全错了吗?

解决方案

是的,你应该放弃重定向,而是创建一个A记录。子域条目通常是但不限于www。记录类型A和目标/目标将是您的外部IP地址。一旦您更新此记录,可能需要几个小时才会注意到该记录的生效,而将用户输入您的URL的位置指向您的网络服务器。



您将需要将您的路由器上的端口80转发到托管WAMP的服务器。



最后,WAMP服务器应该提供您的域名,以便知道要加载的站点。如果使用VirtualHost文件,则可以在Web服务器上托管多个域。要执行此操作...



取消注释以下行,以便在Apache httpd.conf中显示如下,以允许Apache使用virutal主机

 #虚拟主机
包含conf / extra / httpd-vhosts.conf

然后找到httpd-vhosts.conf文件,应该在您的WAMP安装位置找到,如C:\wamp\bin\apache\apache * version_number * \conf\extra\



为您的网站添加一个条目,将详细信息更改为您自己的域名和网站位置。

 < VirtualHost *:80> 
ServerName www.stackoverflow.com
ServerAlias stackoverflow.com
DocumentRootC:/ websites / stackoverflow /
ErrorLogC:/websites/stackoverflow/logs/error.log
CustomLogC:/websites/stackoverflow/logs/access.logcommon
< / VirtualHost>

现在重新启动您的WAMP服务器并给它一个旋转。



提示:如果您的服务器在这些更改后无法启动,请检查是否已创建日志文件的文件夹结构!


I have a WAMP home web server up and running on a static IP and registered a domain with Namecheap, but I'm a bit shaky with DNS. At first I used URL Redirect and pointed it to my IP. This meant that when you typed in the domain (like example.com) it just redirected you right to my IP, replacing the domain name with it in the address bar. Now I'm trying to get the domain to show instead of the IP in the address bar, which I'm struggling to understand exactly how to do.

The latest thing I've tried which many people say to do is instead of using URL Redirect to use the A (Address) record type and point it to my IP, which I thought would finally fix my problems. Of course after 15 min or so when it all got updated I'm getting a 400 Bad Request with nginx under it in Firefox, and a blank page in Chrome. Now I'm getting blank pages in both. Did I do something wrong here? Do I need to edit something on the web server such as httpd.conf? Am I going at this completely wrong?

解决方案

Yes you should do away with the redirect and instead create an "A record". The sub-domain entry would typically be, but is not restricted to "www". The record type "A" and destination/target would be your external IP address. Once you update this record it may take several hours before you notice it taking effecting, upon where on people typing your URL would be directed to your web server.

You will need to forward port 80 on your router to the server hosting WAMP.

Finally the WAMP server should be provided with your domain name so it knows which site to load. If use the VirtualHost file this will allow you to host multiple domains on your web server. To do this...

Uncomment the following line so it appears like below in your Apache httpd.conf, to allow Apache to use virutal hosts

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Then locate the httpd-vhosts.conf file, should be found in your WAMP installation location, such as C:\wamp\bin\apache\apache*version_number*\conf\extra\

Add an entry for your site, altering the details to your own domain name and website location.

<VirtualHost *:80>
ServerName www.stackoverflow.com
ServerAlias stackoverflow.com
DocumentRoot "C:/websites/stackoverflow/"
ErrorLog "C:/websites/stackoverflow/logs/error.log"
CustomLog "C:/websites/stackoverflow/logs/access.log" common
</VirtualHost>

Now restart your WAMP server and give it a whirl.

Tip: If your server won't start after these changes, check that you have created the folder structure for the log files!

这篇关于IP地址显示在地址栏而不是域中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆