This post originally featured on the Echo & Co. blog.
In my previous post, I walked through how to set up a local environment using Nginx running on port 8080 so as to avoid running anything as root or with sudo. Something that I’ve found incredibly annoying is when I forget to specify the port I get an error in my browser, or Chrome might even suggest something based on a search term. It’s fairly easy though to configure Apache to route everything to another port.
Create the file /etc/apache2/other/port8080-redirect.conf as root. It’s probably easiest to hop into Terminal and use nano:
Enter the following lines and save and exit the editor.
1 2 3 4 5 6
Even though the DocumentRoot doesn’t appear to be necessary, I wasn’t able to get this working without it.
Go into System Preferences, open the Sharing preference pane, and check the box for Web Sharing. If you have trouble getting the check to “stick,” you can run the following in Terminal:
sudo apachectl restart