Blog Archives

Setting up a VirtualHost in MAMP

mamp.jpg

If you’ve installed a MAMP dev environment and have found the instructions you’ve read elsewhere for setting up a virtual host on port :80 aren’t working, the following should get you sorted.


1. First of all, make sure Mountain Lion’s not running Apache separately from MAMP. To do so, open Terminal.app, and copy/paste this into the Terminal window:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

(that’s all one line!)

Enter your admin password when prompted. Be aware that it will be invisible as you type, so type carefully. If you get an error message that says “Sorry, try again”, then indeed, try again. Only type more carefully this time! :D. On the other hand, if Terminal just returns the prompt after you hit ‘return’ or reports ‘Nothing to unload’ then you’re good to go to Step 2.


2. Assuming that you want to call your virtual host site ‘mytest’, then add to the last line of the /etc/hosts file:

127.0.0.1 mytest

 

3. That’s the easy part! Next, add to the end of the /Applications/MAMP/conf/apache/httpd.conf file the following text:

NameVirtualHost *

<VirtualHost *>

DocumentRoot /Applications/MAMP/htdocs

ServerName localhost

</VirtualHost>

<VirtualHost *>

DocumentRoot /Users/shortusername/Sites/mytest

ServerName mytest

</VirtualHost>

Note that there are quote marks around both DocumentRoot filepaths. Also, be sure to change the items highlighted in red to reflect your own shortuser name and site name.


4. Go into your Home folder in the Finder, and create a folder called ~/Sites/mytest/ (before creating the ‘mytest’ folder, you may need to create the parent folder ‘Sites’ if it doesn’t already exist).


5. Create an ‘index.html’ file inside ~/Sites/mytest/ that looks something like this:

<!DOCTYPE html>
<html>
<body>
<p>My virtual host site is up!</p>
</body>
</html>


6. Finally, be sure to restart the MAMP servers and you should be up and running! 🙂



MAMP Documentation
For further help with MAMP, please see the documentation here.

Related:
Learn Ruby on the Mac


problems with wifi, Safari and Mountain Lion



If you’ve upgraded to Mountain Lion and traded swift wifi and fast Safari for a flakey internet connection and sluggish browser, you are not alone. Widespread reports of problems with wifi, Safari and Mountain Lion have been mounting ever since July 25th. However, unlike the lengthy debacle with similar wifi problems experienced after the Lion upgrade last year, a lot of users are finding their problems can be solved by using one or more of the tips below.

1. Create a new location and renew the DHCP lease
OS X Daily have a step-by-step procedure here

http://osxdaily.com/2012/08/02/fix-os-x-mountain-lion-wireless-connection-problems/

that is proving hugely successful. Don’t forget to follow their second step about changing the MTU value while you’re at it.

2. Reset default system preferences
If that didn’t do it for you, it’s time to roll up your sleeves and enter Terminal! Open the Terminal.app from

/Applications/Utilities/Terminal.app

and paste this command

rm ~/Library/Preferences/com.apple.systempreferences.plist

then press ‘return’.

You will need to restart your mac to see if this has had any beneficial effect, so do that now.

3. Do PRAM & SMC resets
If you’re still suffering problems, it’s time for a couple of system resets. To do the SMC reset you will need to see what kind of mac you have, as the procedure is different for some models. Take a look here and follow the instructions for your model.

Before powering up after the SMC reset, also take the trouble to do a PRAM reset. To do that:

i. Ensure the machine is powered off.

ii. Locate the following keys on your keyboard in preparation for Step 4:

‘command’ – ‘option’ – ‘P’ – ‘R’

iii. Press the ‘power on’ button.

iv. Immediately – and before the grey screen appears – hold down ‘command-option-P-R’ all together.

v. Keep them held down until you’ve heard the start-up chime twice. After you release them you should hear it again, and hopefully your Mac will boot up without wifi/Safari issues.



4. Check Wifi connection
And if that doesn’t work? Time to check your wifi connection. See how strong your signal-to-noise ratio is. You need something in the order of 25 or higher. To find out whether you signal is strong enough, hold down the ‘option’ key and click on the wifi icon in the menu bar. Choose Open Wifi Diagnostics from the menu.

When you see the welcome screen, ignore the ‘Continue’ button and instead press ‘command-N’ on your keyboard.

Click wifi scan in the task bar and scroll to the right where you will see two numbers, ‘signal’ and ‘noise’. Ignore the minus ‘-‘ signs, and subtract the signal number from the ‘noise’ number. Anything over 25 is a good enough signal, below that and the signal is too weak for a reliable connection. Over 40 is excellent (in the example below, you can see the SNR is 34, a pretty good signal for a home router located on the next floor).

If your SNR is lower than 25 you need to either move the computer closer to the router or find a better connection. If the ‘Noise’ shows a very low figure (equals more noise), you can try changing the channel on your router. Look at the other routers in the list and if they are using the same channel as yours, switch your router to something else between 1 and 11.

5. Reinstall OS X
If all else fails…some users are reporting that simply reinstalling OS X is solving the problem for them. Reinstalling doesn’t touch your Apps or user data, but its always wise to make sure you have a backup before undertaking such an operation.

To reinstall, restart the computer while also holding down ‘command-R’ on the keyboard. From the Utilities window that opens up, choose ‘Reinstall OS X’.

Still having problems? Let us know in the comments below.

🙂

featured picture: Internet by ~vagraine

%d bloggers like this: