MAMP:重新加载页面非常慢 [英] MAMP: reloading pages is very slow
问题描述
在 MAMP 的基本安装上,我正在本地使用CodeIgniter构建应用程序(MacBook Pro,Core2Duo 2,26 GhZ,4GB RAM).
On a basic installation of MAMP, I'm building an application with CodeIgniter locally (MacBook Pro, Core2Duo 2,26 GhZ, 4GB RAM).
我的问题是,当我重新加载页面时,它的加载速度非常慢,甚至比放在网络服务器上时还要慢.
My problem is, that when I reload a page, it does load very slow, even slower than when I put on a web server.
奇怪的是,它只会在我重新加载页面时加载缓慢,而不是在我单击应用程序本身中的链接时加载.
It's strange that it only loads slow when I reload the page, not when I click on a link in the application itself.
该应用程序使用MySQL数据库,但是即使我重新加载不进行MySQL查询的页面,它也是如此缓慢,以至于大约需要10秒钟来加载页面.
The application uses a MySQL database, but even when I reload a page that doesn't make MySQL queries, it's so slow, that it takes about 10 seconds to load a page.
我在 http://forum.mamp.info/viewtopic中阅读.php?f = 6& t = 14081 ,我可以尝试将服务器名称从.local更改为.dev.但是我不知道该怎么做,当我用Google搜索它时也没找到任何东西.
I read on http://forum.mamp.info/viewtopic.php?f=6&t=14081 that I could try to change the server name from .local to .dev. But I don't know how to do that and didn't find anything when I googled it.
我该怎么办?
推荐答案
.local"域与Bonjour冲突,Bonjour将带有".local" TLD的任何内容都视为Bonjour服务器.
The '.local' domains conflict with Bonjour, which treats anything with a '.local' TLD as a Bonjour server.
我在这里找到了答案: https://discussions.apple.com/message/15834652#15834652 .
I found the answer here: http://www.bram.us/2011/12/12/mamp-pro-slow-name-resolving-with-local-vhosts-in-lion-fix/, and that post refers to https://discussions.apple.com/message/15834652#15834652.
正如乔恩所说,解决方案是在/etc/hosts中放置一个::1
地址.
The solution is to, as Jon said, put a ::1
address in/etc/hosts.
::1 localhost example.local anotherexample.local
不幸的是,MAMP Pro在重新启动时会删除该条目.因此请在IP与每个主机之间放置一个制表符(不要有空格).
Unfortunately, MAMP Pro will delete the entry when it restarts so put a tab (not spaces) between the IP and each of the hosts.
另一种选择是放置一个不同的TLD-.dev
或类似的东西.
The alternative is to put a different TLD - .dev
or something like that.
这篇关于MAMP:重新加载页面非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!