1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

"default.html" file on web server

Discussion in 'Mac OS X Server, Xserve, and Networking' started by Jaggions, Aug 20, 2013.

  1. macrumors regular

    Hi. I have just started a server using OS X Server 10.8. I have already set up AFP and SSH sharing and now I'd like to configure HTTP sharing too, so that surfing to 192.168.1.XXX I can access and download my files. What I did probably worked, because surfing to 192.168.1.XXX I can see this page:


    I browsed to the indicated path and removed the sample content of the "Default" directory, and now I'd need to edit the "default.html" file. I'd like to edit it so that surfing to 192.168.1.XXX I get an index page like this:


    ...but how? I don't know much about html and servers, can you help me please? Thank you.
  2. macrumors 65816

    Move or delete the default.html file and Apache should automatically default to a directory listing like you want.

    Edit: Most times the default.html as you have here is the index.html file who knows perhaps Apple has named it default.html but I doubt it.
  3. macrumors regular

    I deleted the file and restarted Apache, but surfing to 192.168.1.XXX now gives me the "403 Forbidden" error (You don't have the permission to access / on this server). Removing the whole "Default" folder, instead, results in a 404 error.

    Yeah, in my opinion here "default.html" is "index.html". Does this make any difference?
  4. macrumors 65816

    Lovely a permission error I did not get when I moved the file on my linux server. You can try creating a new directory under the existing one and giving it world readable permissions a rwxrwxrwx or 0777 if using chmod to do it, it may not be necessary to do the world readable off the start try it without if it does not work then make it so. Then you would navigate to http://192.168.1.XXX/new_directory_name/ to access your files.

    Don't matter what it is named if that file is present then you will get the html read and displayed instead of the directory listing you want.
  5. macrumors regular

    Still no luck :(
  6. macrumors 65816


    As in it will still not allow you to access a newly created world readable/writeable directory contained under the Default directory, if so I have no clue where to go from here Apple has one whacked implementation of Apache.
  7. macrumors 6502


    Out of the box, Mac OS X Server's (10.8+) comes with quite a bit of configuration. The base configuration file should be located at /Library/Server/Web/Config/apache2/httpd_server_app.conf. This sets up the core apache configuration, but it also contain includes to other .conf files which provide further options. For your purposes, you are going to be interested in the configuration files located in /Library/Server/Web/Config/apache2/sites/. There should be a file called 0000_any_80_.conf. This contain the VirtualHost configuration for *:80, which means any listening interface port 80.

    If you look inside this file, you should see something like:

    <VirtualHost *:80>
            ServerAdmin admin@example.com
            DocumentRoot "/Library/Server/Web/Data/Sites/Default"
            DirectoryIndex index.html index.php default.html
            CustomLog "/var/log/apache2/access_log" combinedvhost
            ErrorLog "/var/log/apache2/error_log"
            <IfModule mod_ssl.c>
                    SSLEngine Off
                    SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
                    SSLProtocol -ALL +SSLv3 +TLSv1
                    SSLProxyEngine On
                    SSLProxyProtocol -ALL +SSLv3 +TLSv1
            <Directory "/Library/Server/Web/Data/Sites/Default">
                    Options All -Indexes -ExecCGI -Includes +MultiViews
                    AllowOverride None
                    <IfModule mod_dav.c>
                            DAV Off
                    <IfDefine !WEBSERVICE_ON>
                            Deny from all
                            ErrorDocument 403 /customerror/websitesoff403.html
            ProxyPass /__collabd/streams/activity balancer://balancer-group-webapp-com.apple.webapp.collabd--__collabd-streams-activity
    You can see that the document root is /Library/Server/Web/Data/Sites/Default, and that directory has some options set for it. One of those options is -Indexes which disables the generation of auto-indexes when a suitable index specified by DirectoryIndex cannot be found. If you remove -Indexes and restart apache, you should find that the document root will return a directory listing when you access your web server. You could also change the document root to point somewhere else; I strongly advise against pointing it at someplace like "/" or "/Users/".
  8. macrumors 65816


    Interesting but does not apply to a normal OSXs install I just turned on the web server here then moved the file and it works like it should ie. gives me an index of the directory when I enter the IP address of my machine in browser.

    sudo mv /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/index.html.en.orig
  9. macrumors 6502


    But, as the OP pointed out, this is OS X Server 10.8. The configuration is completely different that what used to ship out of the box as "Personal Websharing" with MacOS X 10.7 and below.
  10. Jaggions, Aug 20, 2013
    Last edited: Aug 20, 2013

    macrumors regular

    I did what you said, and now if I surf to 192.168.1.XXX I get a blank web page. I have attached to this post the conf file I have edited and the default one, so that you can check them and see if I did something wrong.
  11. macrumors 6502


    Based on the config file you uploaded, navigating to 192.168.1.XXX/ will not serve "/Volumes/Server data/Library/Server/Web/Data/Sites/Default". You have set the DocumentRoot to "/Volumes/Server data/", but have not specified any options for that path with a matching <Directory "/Volumes/Server data/"></Directory>.

    You would have to navigate to 192.168.1.XXX/Library/Server/Web/Data/Sites/Default/.
  12. macrumors newbie

    Index.html is what I use. It seems to overwrite the default.html when I publish to the web folder (I have multiple domains from a single IP). It's easy to start over where you are. Just delete the default folder and reconfigure like you're re-setting up the domain folder in the website management. If you accessed the default page (welcome to server) from the internet than you've got everything pointed in the right direction. It's stupid simple once you get the hang of it. :D

    It's simple to tell where you publish to. Just go through the steps like you're adding a second domain and see where it gets placed. You can also use this opportunity to determine where you'd like to place your website folders.
  13. Jaggions, Aug 21, 2013
    Last edited: Aug 21, 2013

    macrumors regular

    I fixed that in the conf file, and now surfing to any path after 192.168.1.XXX just doesn't load the page. I wonder what I'm doing wrong! :confused: I feel soo stupid!

    EDIT: After a reboot now the pages load again, but I get the same errors as before.
    Again, I'll upload my configuration file. Thank you very much for your patience and for your help.

    Attached Files:

Share This Page