MAMP, Apache, WordPress and the case of the mysterious port number

I’m developing a few sites with WordPress on a local server. I have my MAMP (2.0.1) running with the default port numbers for Apache and MySQL on Lion (10.7.2). It’s been working quite well until I recently encountered a perplexing problem.

One site in particular has undergone a few internal domain/vhost changes (this is how I came to the conclusion of using the default port numbers re:my own WordPress development) which are referenced in my /etc/hosts file and also in my MAMP apache httpd.conf VirtualHosts section. Now when I visit this particular development domain defined in the hosts and httpd.conf vhost, it gives me a browser error stating that it couldn’t establish a connection to dev.example.com:8888 (the WordPress index.php and htaccess files are in the folder index). I’m a bit annoyed and confused as I’ve changed the MAMP ports to the default, yet this references the 8888 default MAMP apache port only on the domain index and doesn’t want to sway its course even if I visit dev.example.com:80. I can access files and folders within the domain by specifically typing them in, but visiting the domain index as it is gives me this error with the default port number. I have no idea why that is and haven’t been able to find a solution via the internet.

Read More

Some search results have mentioned incorrect line formats in the hosts and httpd.conf files, but mine are all Unix LF based so that solution hasn’t made a difference. I’ve removed WordPress from the domain’s folder structure and tried again but it still gives me the same error. On another domain I’m using with WordPress it works fine; the folders are set up exactly the same way, as are the entries in the hosts and the httpd.conf files. I get no apache errors when I visit the particular erroring domain as well. I’m just a bit stumped on the whole thing.

Hosts entry:

127.0.0.1     dev.example.com

Vhost entry:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName dev.example.com
  DocumentRoot "/Sites/example.com"
</VirtualHost>

WordPress config:

sql.wp_options.siteurl = http://dev.example.com/wp
sql.wp_options.home    = http://dev.example.com/

Related posts

Leave a Reply