How do I configure OS X's built-in Apache? (and other making my Mac into a server ?s)

Posted:
in General Discussion edited January 2014
I don't know whether this is a really stupid/ignorant question, but I thought OS X features Apache server technology right out of the box. I'm thinking of serving a website off of my G5, and I'm wondering how to go about configuring Apache. (For example, I don't want people to be able to access directory listings, only webpages within those directories)



I'm on a dynamic IP, behind a router. I have a dyndns.org account set up, and I have my router set up with that. However, entering my address (nkologe.homeip.net) doesn't bring up anything. (It should bring up an directory index or the root level of my /Library/Webserver).



More specifically on Apache, how would I make the server, when somebody enters my website's address, automatically go to my index.htm page? I thought that this was default server behavior, but evidently it's not. Also, as I've mentioned before, I'd like to disable directory listings.



Can somebody explain, from start to finish (assuming that I don't know what DynDNS, Apache, or a dynamic IP are) how to set up and facilitate a website from my own computer?



Thanks to all in advance.

Comments

  • Reply 1 of 8
    I have the same setup as you, but I have an iBook.

    If you are trying to go to your server from a computer inside your network you have to use your local address. Example: http:// 192.168.1.1 , but if you are trying to get access from the web, just try your dyndns.org address. I asume that you have Apache on (System Preferences -> Sharing -> Personal Web Sharing). You have to your apache httpd config file to do some stuff you like (permission, etc). A nice place to learn some Apache for the mac is MacDevCenter. Email me if you want some docs to read about apache.
  • Reply 2 of 8
    eugeneeugene Posts: 8,254member
    Quote:

    Originally posted by Placebo

    I don't know whether this is a really stupid/ignorant question, but I thought OS X features Apache server technology right out of the box. I'm thinking of serving a website off of my G5, and I'm wondering how to go about configuring Apache. (For example, I don't want people to be able to access directory listings, only webpages within those directories)



    You want to edit the /private/etc/httpd.conf file.



    There is a line that begins with the word Options. There are actually several, for different directory locations. If you only want to remove the ability to show directory indexes in the main directory, find the Options line tha appears after <Directory "/Library/WebServer/Documents">. Remove Indexes from that line.



    Quote:

    I'm on a dynamic IP, behind a router. I have a dyndns.org account set up, and I have my router set up with that. However, entering my address (nkologe.homeip.net) doesn't bring up anything. (It should bring up an directory index or the root level of my /Library/Webserver).



    From within your own network, you wouldn't use nkologe.homeip.net. You would use the private address assigned to your computer. Your DocumentRoot would be /Library/WebServer/Documents anyway, not/Library/WebServer.



    Quote:

    More specifically on Apache, how would I make the server, when somebody enters my website's address, automatically go to my index.htm page? I thought that this was default server behavior, but evidently it's not. Also, as I've mentioned before, I'd like to disable directory listings.



    Use the .html suffix instead of .htm. If you really want to use .htm, then you'll have to add "index.htm" to the DirectoryIndex line.



    Quote:

    Can somebody explain, from start to finish (assuming that I don't know what DynDNS, Apache, or a dynamic IP are) how to set up and facilitate a website from my own computer?



    Thanks to all in advance.



    You've got to look into most of this stuff on your own because there's too much for us to teach you. We wouldn't know where to start.



    First, treat them as different subjects first of all. I suggest looking over the httpd.conf thoroughly, and then looking at apache.org's own documentation to reference all the terms.
  • Reply 3 of 8
    The first step might be to make sure that you have your DNS daemon set up right. If you aren't able to type your address into a browser and have it load the default Apache page, something's wrong. And this is assuming you have Personal Web Sharing turned On in the System Preferences.



    The first step would be to make sure your router is forwarding port 80 to your Mac's LAN IP.



    The next step I figured out myself after I was having trouble figuring out why my dyndns account wasn't working. Open your DNSUpdate app, select your actual DNS you have registered, click Edit Host and make sure Interface is set to External. Otherwise your DNS name is going to resolve to some LAN IP like 192.168... when you want your WAN IP to be mapped to the DNS name.
  • Reply 4 of 8
    Thank you segovius - I had the same query as Placebo - but (s)he got there first!

    A really useful article with lots of links to get more info!

    But I need more info on the dyndns bit (scratching head) of which the jargon is a bit confusing to me.
  • Reply 5 of 8
    eugeneeugene Posts: 8,254member
    Quote:

    Originally posted by spylaw4

    Thank you segovius - I had the same query as Placebo - but (s)he got there first!

    A really useful article with lots of links to get more info!

    But I need more info on the dyndns bit (scratching head) of which the jargon is a bit confusing to me.




    When you buy a domain, you designate primary nameservers to help propagate your domain throughout the net. These nameservers attach your domain to an IP you specify. Because many home connections use dynamic IPs via DHCP, PPPoE and what not, traditional DNS won't really cut it. Services like DynDNS.org provide you with an app or background daemon that monitors your IP address and immediately updates the record on DynDNS.org.



    In addition, since Placebo is on his own routed network with private IP addresses, he needs to configure his router to forward port 80 to the particular IP address. If he wants, he could also make that server a DMZ machine which would effectively forward all ports to that particularly computer.



    From within his own network, he must use the internal IP address to reach his server. If he wants to make it sort of transparent, he could go into NetInfo Manager and manually enter in a hostname for his localhost, but that's another story...
  • Reply 6 of 8
    placeboplacebo Posts: 5,767member
    One more question, Eugene: when you say that the nkologe.homeip.org address won't be accessible from my own network, do you mean, it won't be accessible from my network, but will work on outside clients?
  • Reply 7 of 8
    eugeneeugene Posts: 8,254member
    Quote:

    Originally posted by Placebo

    One more question, Eugene: when you say that the nkologe.homeip.org address won't be accessible from my own network, do you mean, it won't be accessible from my network, but will work on outside clients?



    When the outside world types in http://nkologe.homeip.org/ it puts an http get request on TCP port 80 to that address. That address corresponds to the dynamic IP of your router. Your router then must forward that request to a specific private IP address assigned to your server.



    Any computer on the local side of the router sees the server as the private IP and usually you can't connect to it with external address. DMZs are usually an exception and they should fool computers on both sides of the router into thinking the router's IP points to the DMZ machine.
Sign In or Register to comment.