我的 Windows 7 本地主机服务器配置了我的主本地主机地址和几个虚拟主机,用于提供无 cookie 的图像和 JavaScript(我还配置了其他几个虚拟主机)。
我使用虚拟主机地址加载几个文件需要 5000 毫秒的时间,需要一些帮助来找出原因。
更新
根据建议这个帖子,我已注释掉::1 localhost
。我会看看这是否能解决问题并报告。
我的主机文件包含以下内容:
127.0.0.1 localhost static mseifert design static-mseifert static-design
::1 localhost
我的虚拟主机设置如下:
<VirtualHost *:80>
ServerAdmin michael@localhost
DocumentRoot "D:/Website/mseifert/xyz"
ServerName static
<Directory "D:/Website/mseifert/xyz">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
deny from all
Allow from localhost
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin michael@localhost
DocumentRoot "D:/Website/mseifert"
ServerName static-mseifert
<Directory "D:/Website/mseifert">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
deny from all
Allow from localhost
Require all granted
</Directory>
</VirtualHost>
我的 apache access.log 中没有错误:
127.0.0.1 - - [07/Feb/2017:20:38:49 -0800] "GET / HTTP/1.1" 200 101841
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /css/colwidth.min.css?v=1476516603 HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /js-common/dragdrop.min.js?v=1483776115 HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /css/slideshow.css.php?static-img-common=http://static-mseifert/img-common&v=1484865716 HTTP/1.1" 200 6394
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /css/slideshow.min.js?v=1486279758 HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /js-common/common.min.js?v=1485074534 HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /js/media.match.min.js?v=1370658510 HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /css/ms.min.js?v=1485063063 HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /css/wtr.css.min.php?static-img-common=http://static-mseifert/img-common&static-site-root=http://static&static-top-root=http://static-mseifert&v=1486360034 HTTP/1.1" 200 37255
127.0.0.1 - - [07/Feb/2017:20:39:11 -0800] "GET /js/hmac-sha1.js?v=1455443904 HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:12 -0800] "GET /img-common/lock.png HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:12 -0800] "GET /img/lady.jpg HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:12 -0800] "GET /img/lady-header.jpg HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:12 -0800] "GET /img-common/menublank.png HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:12 -0800] "GET /img-common/menublanka.png HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:12 -0800] "GET /img-common/arrow.gif HTTP/1.1" 304 -
127.0.0.1 - - [07/Feb/2017:20:39:12 -0800] "GET /img-common/vmenuback.gif HTTP/1.1" 304 -
答案1
仅在 Apache 配置指令中使用 IP 地址。
不要localhost
在 Apache 配置文件中使用,而只需使用127.0.0.1
。因此:
Allow from localhost
对此的更改:
Allow from 127.0.0.1
我更详细地我对这里另一个问题的回答,但HostnameLookups
对于 Apache 来说基本上是一个缓慢的过程,当它成为 Apache 配置指令的一部分时,HostnameLookups
会打开即使在其他地方被禁用。因此它确实可以解决localhost
并且只是挂起并挂起。
Allow
这解决了使用/指令的 Apache 服务器上的许多“神秘”挂起问题Deny
。