5

I have configured all my websites in the "Sites" folder to be tested in my browser. When I type a web address for example http://test.dev, I get "It Works".

Why?

1
  • 5
    Because you haven't configured it to say anything else?
    – Zoredache
    Dec 25, 2010 at 15:07

4 Answers 4

17

That's the default Apache HTTP index page. It's there to indicate you've correctly installed and enabled httpd.

2
  • 12
    In other words, because "It Works".
    – mattdm
    Dec 24, 2010 at 22:14
  • Past few hours I have been trying to remove this page. Even after removing httpd, it is still showing. May 7, 2023 at 12:04
10

That page is located in /Library/Webserver/Documents.

You need to make sure you uncomment the second line of the following:

# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf

That file then includes the files in /private/etc/apache2/users

There should be one with your username.

You can then go to localhost/~username, which is equivalent of visiting Users/username/Sites

2
  • 1
    or uncomment this line Include /private/etc/apache2/extra/httpd-vhosts.conf in /etc/apache2/httpd.conf Oct 10, 2016 at 15:08
  • That is the default page location. But it's not the page being posted. Use apachectl -S to find the location of the Main DocumentRoot
    – Gi1ber7
    Sep 3, 2021 at 19:59
4

This probably means that you don't have a specific entry in your web server configuration for for the IP address (if using IP-based virtual hosting) or the name you are trying to reach (test.dev, in your example, if using name-based virtual hosting).

For example, in Apache you can create <VirtualHost> sections which specify the document root for requests that match the IP and/or name (again, depending on if you're doing IP or name based virtuals). If none of those match, it will fall back to the DocumentRoot and other settings that are set outside of the <VirtualHost> entries.

So, to resolve it you could either make the virtual host config for the site that you want to receive these requests include this name/IP that isn't currently matching (preferable) or make one of your sites existing in the main config instead of in a <VirtualHost> (or similar depending on the web server you are using) section.

3

Use apachectl -S (mac) to list the loaded configuration and to see all your loaded virtual hosts. Probably your project's .conf file is not in that list.

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