Slow Virtual Hosts in OS X Lion

本文详细介绍了在升级至OSX Lion后,使用XAMPP时遇到的本地网站访问速度慢的问题,并提供了通过修改虚拟主机名来解决此问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Back in March I made the switch from Windows to OS X when I purchased my 13″ Macbook Pro. Since then I’ve trying to configure my ideal development environment, which has mostly meant deciding on the code editor that best suits my needs and workflow. I’ve been using XAMPP for my LAMP stack and so far things have been great. That is, until I upgraded to Lion a few months ago.

After making the upgrade to OS X 10.7 I soon noticed some of the websites running on my local server become incredibly slow. The most annoying part was trying to access phpMyAdmin to browse tables and run SQL queries. Sometimes accessing these local sites would be instant and other times they would hang for a few seconds before loading.

I turned to Google and searched for things such as “OS X Lion Apache slow after upgrade” and “Lion lookup slow”, but ever found useless posts related to people with slow internet connections not being able to download the Lion upgrade installer. At one point I tried reinstalling XAMPP and after that failed I started to consider the idea of reinstalling a clean copy of Lion. Thankfully I never did because today I discovered this Stack Overflow post after googling “Local DLS slow OS X Lion”.

The Problem

Basically Lion handles .local TLDs differently to Snow Leopard. Whenever I would try to access my phpMyAdmin installation at http://xampp.local/phpMyAdmin, Lion would take a ridiculously long time to resolve the host and it probably has something to do with the Multicast DNS feature of Bonjour. You can read more about Bonjour and the .local TLD here.

The Solution

The easiest solution is to simply stop using the .local TLD for your virtual hostnames. You could use an alternate TLD such as “.dev”, but further reading has hinted that inventing your own TLDs is a bad idea altogether due to potential naming conflicts. The recommended solutions that prevent these naming conflicts are overkill for my small development environment, so I’ve simply chosen to go against the advice and use a different TLD for my virtual hosts.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值