PDA

View Full Version : Need help setting up apache




lynkynpark86
Mar 1, 2011, 08:21 AM
I'm trying to set up Apache on 10.6, and most how-to pages aren't much help. I want to set it up so anyone, anywhere (NOT HOME SHARING) can see a page I made at my IP. Also, how can I set a custom path (If someone types my IP in a browser, I want it to load /Users/admin/web/luep/index.html on my hard disk). Ideas?



iDisk
Mar 1, 2011, 08:51 AM
I'm trying to set up Apache on 10.6, and most how-to pages aren't much help. I want to set it up so anyone, anywhere (NOT HOME SHARING) can see a page I made at my IP. Also, how can I set a custom path (If someone types my IP in a browser, I want it to load /Users/admin/web/luep/index.html on my hard disk). Ideas?


Click on System Preferences
Click on Sharing
Check the box that says "Web Sharing"


Check out the attached screenshots to help you. You'll notice in screenshot #4 that apache is already built into OS X....also in screenshot #3 you'll see that once you turn on web sharing your able to click on to IP links to test your static pages.

voila

lynkynpark86
Mar 1, 2011, 09:17 AM
But the IP's shown are my 192.168.X.XYZ IPs. Will these work somewhere other than my home network? Like another country, for example? Also, how can I change the "Sites" folder path?

iDisk
Mar 1, 2011, 09:31 AM
But the IP's shown are my 192.168.X.XYZ IPs. Will these work somewhere other than my home network? Like another country, for example? Also, how can I change the "Sites" folder path?

unfortunately, i'm not able to answer your question on this one..... but I can say that if you were to click on the link in the static webpage, it will bring you to the page that shows you how to set up and power apache on your Mac.

dampfdruck
Mar 1, 2011, 09:47 AM
But the IP's shown are my 192.168.X.XYZ IPs. Will these work somewhere other than my home network? Like another country, for example? Also, how can I change the "Sites" folder path?

This is a basic network configuration task. Check here: http://en.wikipedia.org/wiki/Port_forwarding

Note: By opening up your computer like this you might get yourself a security problem. The best thing would be to place it behind a reverse proxy with IDS capabilities. If you want to do this properly, you have quite a learning curve ahead.

etchtech09
Mar 1, 2011, 05:05 PM
To change the "Sites" folder path, you will want to jump into Terminal and edit /etc/apache2/httpd.conf.

Find this:
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"

and change the last line to look like this:
#DocumentRoot "/Library/WebServer/Documents"
DocumentRoot "/Users/admin/web/luep"

Then restart Apache by running this:
sudo apachectl restart

It will ask you for your password, at this point you will be able to get to the page you want on your internal network.

You will next need to follow the advice of dampfdruck to do port forwarding on your modem/router to point to your computer that is running Apache.