soba3
soba3

Reputation: 389

MAMP on OSX Yosemite - Virtual host name gives 404 error

I installed MAMP v3.2.1 on my new MacBook Pro running OSX Yosemite (10.10.3).

localhost is running as expected, I can browse http://localhost, no problem.

However, something is amiss with my named virtualhost - when i browse to the site I get a 404. EDIT: I'm now seeing 'This webpage is not available - ERR_CONNECTION_TIMED_OUT' (in Chrome)

I've read and checked other threads on similar issues, but none of them has so far resolved my issue. I'm hoping somebody can help me, as I'm now totally stuck.

Here's what I've done and tried:

And added the directive in the vhosts file like so:

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost
</VirtualHost> 

<VirtualHost *:80>
    DocumentRoot “/Users/myName/Sites/mysitename“
    ServerName mysitename.dev
    ServerAlias mysitename.dev
</VirtualHost>

I changed MAMP Apache settings to listen to port 80 (and checked httpd.config for the line Listen 80 (I think MAMP updates this?)

I'm a Mac-novice - you could say I'm having some teething problems! Any help or suggestions in the right direction would be much appreciated.

Thanks in advance.

P.S. I just ping'd mysitename.dev and got

--- mysitename.dev ping statistics ---
132 packets transmitted, 132 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.039/0.096/0.294/0.042 ms

I got similar results from pinging localhost (no timeout messages), so I assume it's good, but I'm still lost...

Upvotes: 0

Views: 1189

Answers (2)

deepfriedmars
deepfriedmars

Reputation: 55

I was caught out by the formatting issue as stated above. The example I used was using around the document root instead of ".

Upvotes: 0

MWT
MWT

Reputation: 76

I believe this is a quotation mark formatting issue. Look how quotation marks on your DocumentRoot are formatted differently from the DocumentRoot in the default example. To make sure the formatting is correct just copy the correct quotation mark character from the example DocumentRoot and paste it over the your DocumentRoot quotation marks. This issue can come up when text is copy-pasted from one place to another.

Upvotes: 2

Related Questions