10

I have three Virtual Hosts running in apache2 on my personal Macintosh running OS X Mavericks and I have ran into a knot of confusion. They are configured in my httpd-vhosts.conf file as follows:

<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
ServerAlias localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents/dev1"
ServerName dev1.local
ServerAlias www.dev1.local
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents/dev2"
ServerName dev2.local
ServerAlias www.dev2.local
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents/dev3”
ServerName dev3.local
ServerAlias www.dev3.local
</VirtualHost>

Note: The first entry allows me to type in "localhost" and have it load as you'd expect it to without Virtual Hosts running.

dev1 and dev2 work fine, but I get an Error 404 saying "The requested URL / was not found on this server." when I try to load dev3 on the local machine. All three Dev folders have the same permissions I have verified the names. When I checked the error_log I found this:

[Fri Jan 24 12:55:07 2014] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/dev3\xe2\x80\x9d

Does anyone know why Apache is appending a "\xe2\x80\x9d" to the end of the Folder path, or why dev3 isn't loading? (I suspect these randomly appended characters are why) Any input welcome! Thanks for reading!

3 Answers 3

17
DocumentRoot "/Library/WebServer/Documents/dev3”
                                               ^----- no proper quotation mark :9

If you have php installed:

<?php
echo "\xe2\x80\x9d";

// or

echo utf8_decode("\xe2\x80\x9d");

// should give you ”
7
  • 2
    makes a "Not Bad" face and face palms hand through head Now see, that makes so much sense. This happens to me with HTML forms too... THANK YOU! I've been scratching my head for an hour about this. How does that character get typed out versus the regular quotation mark @DanFromGermany ? Jan 24, 2014 at 18:21
  • @UncleNerdicus depends on your text editor! I really only use NetBeans , notepad++ and vi for everything and never had such problems
    – Daniel W.
    Jan 24, 2014 at 18:26
  • 1
    @DavidHoude It's making me wait a few more minutes (stupid timers!), I haven't forgotten! Jan 24, 2014 at 18:27
  • 1
    @UncleNerdicus if you ever encounter ^M at your line endings or similiar, it's because of wrong line ending (\r\n chars) dos/unix/mac (there are tools: dos2unix etc), just in case ;D
    – Daniel W.
    Jan 24, 2014 at 18:30
  • 2
    You have no idea how enormous my discharge of joy was when I read this solution. Joined this community just to upvote this.
    – roberrrt-s
    Oct 12, 2017 at 8:44
1

You missed VirtualHost setting.

NG: DocumentRoot "/Library/WebServer/Documents/dev2"

OK: DocumentRoot /Library/WebServer/Documents/dev2

1
0

DocumentRoot "/Library/WebServer/Documents"

it should be

DocumentRoot /Library/WebServer/Documents

no "" in DocumentRoot

1
  • 1
    Welcome to Server Fault! Even though your answer is probably correct, it's essentially the same answer that we already have.
    – jornane
    Mar 13, 2019 at 12:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .