服务器域名在浏览器地址栏中被replace为IP地址

我安装了一个LAMP服务器,并设置我的域名parsing到一个合适的IP地址。 但是,当我使用域名连接到服务器时,它在地址栏中显示一个IP地址。 我的/ etc / apache2 / sites-available / default看起来像这样:

NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin ... ServerName mydomainname.irrelevant.to.the.question DocumentRoot /var/www ... 

我以为这是应该解决这个问题。 还有什么要求?

这可能是你的PHP应用程序。

Apache不会为这种redirect而烦恼,没有被明确地告知使用RedirectRewriteRule (它不会“强制”以任何方式匹配ServerName ),但世界上有很多Web应用程序就像请求的主机名匹配内部configuration的内容。