服务器 Gind.cn

服务器问题集锦,包括 Linux(Ubuntu, Centos,Debian等)和Windows Server服务器

尽pipe虚拟主机设置,使用实时服务器作为反对本地服务器的PHP

我曾计划将网站迁移到另一台服务器, 所以复制代码和数据库等,并改变我的主机文件在Windows上,一切工作几乎如预期。 我可以加载网站,并重新使用域名之前将其用于testing, 然而,有一个function,使用PHP库,在HTML代码中find图像url。 正因为如此,我必须使用外部http url来访问图像,即使图像在同一台服务器上。 我的问题, 即使网站上的其他所有内容都使用新的本地服务器,但这段代码仍在查看活动服务器,就好像没有为其设置虚拟主机设置一样。 在我的/etc/sites-enabled/example.conf我有一个虚拟主机设置… <VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com DirectoryIndex index.php DocumentRoot /var/www/html/example ScriptAlias /cgi-bin /var/www/html/example/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> ErrorLog /var/www/html/example/error.log CustomLog /var/www/html/example/access.log combined </VirtualHost> 这正如预期的那样工作,如上所述的一个问题,似乎在这种情况下忽略它。 如果我更改了该域的实际Alogging,我将确信这将工作,但我需要先testing它。 编辑:只是为了澄清更多, 我在Ubuntu上使用Apache2。 我的核心问题是, 当我的php代码与一个图像的URL,例如<img src="http://www.example.com/myimage.jpg" /> ,为什么只有在一个特定的情况下,它是从REAL服务器加载这个图像该域指向,而不是像其他所有的本地服务器?