Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to setup the built in apache part of os x to work with php. I've gone through the process of uncommenting the php lines and so forth in the httpd.conf file. However, I can't seem to get the webserver to find any of my files to test. I changed the ListenPort to 3333, since i run https://github.com/37signals/pow on port 80. Like so:

 <IfDefine !MACOSXSERVER>
   Listen 3333
 </IfDefine>

And the server seems to respond to 3333 just fine. I also setup the /etc/apache2/users/aaronmcleod.conf to store a virtual host to the ~/Sites folder like so:

<Directory "/Users/aaronmcleod/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

NameVirtualHost *:3333

<Virtualhost *:3333>
    DocumentRoot /Users/aaronmcleod/Sites
    ServerName aaronmcleod.dev
</Virtualhost>

However, when i go to http://localhost:3333/test.php i just receive a 404 error from apache. Any ideas on what i missed?

share|improve this question
add comment

2 Answers 2

# Mac OS X / Mac OS X Server
# The <IfDefine> blocks segregate server-specific directives
# and also directives that only apply when Web Sharing or
# server Web Service (as opposed to other services that need Apache) is on.
# The launchd plist sets appropriate Define parameters.
# Generally, desktop has no vhosts and server does; server has added modules,
# custom virtual hosts are only activated when Web Service is on, and
# default document root and personal web sites at ~username are only
# activated when Web Sharing is on.

This means that /etc/apache2/httpd.conf is set up with special xml tags that enable the user to enable or disable modules based on simply if you are a OS X Server or a regular OS X Desktop. Also the configuration is set so that if you go into System Preferences - Sharing - Enable Web Sharing that it configures OS X to load /etc/apache2/other/*.conf which is where you would want to consider placing your whateversite.conf file.

share|improve this answer
    
Also, you might want to consider rolling your own apache if you're doing any really deep development. It's really easy with hombrew : github.com/ampt/homebrew –  Todd Baur Feb 11 '12 at 6:02
add comment
up vote 0 down vote accepted

Looks like if i launch apache under the sharing section of system preferences, i can get to it fine. Though i wonder why it doesn't work when starting the server via terminal.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.