Jump to content
Sign in to follow this  
randyharris

How to set Apache to alternate port?

Recommended Posts

Hi,

 

I'm brand new to the Mac and I'm having trouble figuring something out.

 

My ISP blocks port 80, but I like to host pictures for friends and family on my computer rather than something like Flickr - so I have to use an alternate port for WWW. On my Windows XP machine I was able to tell the webserver to work on port 8080 instead of 80. I would like to do the same on my Intel iMac but can't figure it out.

 

Thanks for any help you can provide.

 

Randy

Share this post


Link to post
Share on other sites
Hi,

 

I'm brand new to the Mac and I'm having trouble figuring something out.

 

My ISP blocks port 80, but I like to host pictures for friends and family on my computer rather than something like Flickr - so I have to use an alternate port for WWW. On my Windows XP machine I was able to tell the webserver to work on port 8080 instead of 80. I would like to do the same on my Intel iMac but can't figure it out.

 

Thanks for any help you can provide.

 

Randy

 

There are two Apache directives that might help here. First is "port" which defaults to 80. You can change the port using "port 8080" as a runtime directive and the server will listen only on that port.

 

Another option is to use "listen". If you say"listen 8080" Apache should listen on that port as well as the default. Listen can also be used as a runtime directive.

 

I'm accustomed to editing a file named httpd.conf in order to configure Apache on Wormware and Linux boxes, but I find no such file on my Intel iMac. So I'm afraid I can't get you over the last hurdle and tell you how to implement these options in OS X. Someone else may know?

Share this post


Link to post
Share on other sites

OK, I found it. I had not realized previously that Spotlight would not return search results for Super-Sekrit directories. I'll grumble about the philosophical advantages of protecting users from useful information some other time.

 

Here is how to do what you want to do:

 

1] Start a Finder Window

2] Drop-down Go and select Go To Folder

3] Enter /etc/httpd

4] Right-click (or Control-click) the file httpd.conf and select Open With from the context menu

5] Select an editor that will let you save in ASCII text format, such as Text Edit or Text Wrangler, don't even think about using a word processor

6] Search the file for the string "Listen 12.34.56.78:80" (without the quotes)

7] On the blank line below this text type "Listen 8080" without the quotes and especially without the leading # you see on most lines (those are comments)

8] Save the file. It must be saved as plain text, I expect any text editor will do so as a default, since it was a plain text file to start with.

9] Next you need to restart the Apache server, you could do this by restarting your Mac, or, if you prefer, open a terminal window and type "sudo httpd restart" You'll be prompted for your administrator password, then you should see text echoed to the screen:

Processing config file: /private/etc/httpd/users/username1.conf

Processing config file: /private/etc/httpd/users/username2.conf

Processing config file: /private/etc/httpd/users/username3.conf

Machinename:~ username$

 

Procedure courtesy of Steve's Web Hosting, where our motto is "Serving Steve's websites on Steve's server for Steve"

 

Apache good! IIS Wormware.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing

    No registered users viewing this page.

  • Who's Online (See full list)

    There are no registered users currently online

×