Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 20, 2013, 12:22 PM   #1
Jaggions
macrumors member
 
Join Date: Oct 2012
Location: Italy
Send a message via Skype™ to Jaggions
"default.html" file on web server

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.
Jaggions is offline   0 Reply With Quote
Old Aug 20, 2013, 01:51 PM   #2
MacUser2525
macrumors 65816
 
Join Date: Mar 2007
Location: Canada
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.
__________________
MacPro 5,1 16gb HD6870; MacPro 4,1 5,1 12x2.66ghz 24gb GT120
MacUser2525 is offline   0 Reply With Quote
Old Aug 20, 2013, 02:03 PM   #3
Jaggions
Thread Starter
macrumors member
 
Join Date: Oct 2012
Location: Italy
Send a message via Skype™ to Jaggions
Quote:
Originally Posted by MacUser2525 View Post
Move or delete the default.html file and Apache should automatically default to a directory listing like you want.
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.

Quote:
Originally Posted by MacUser2525 View Post
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.
Yeah, in my opinion here "default.html" is "index.html". Does this make any difference?
Jaggions is offline   0 Reply With Quote
Old Aug 20, 2013, 02:14 PM   #4
MacUser2525
macrumors 65816
 
Join Date: Mar 2007
Location: Canada
Quote:
Originally Posted by Jaggions View Post
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.
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.

Quote:
Yeah, in my opinion here "default.html" is "index.html". Does this make any difference?
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.
__________________
MacPro 5,1 16gb HD6870; MacPro 4,1 5,1 12x2.66ghz 24gb GT120
MacUser2525 is offline   0 Reply With Quote
Old Aug 20, 2013, 02:21 PM   #5
Jaggions
Thread Starter
macrumors member
 
Join Date: Oct 2012
Location: Italy
Send a message via Skype™ to Jaggions
Quote:
Originally Posted by MacUser2525 View Post
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.
Still no luck
Jaggions is offline   0 Reply With Quote
Old Aug 20, 2013, 02:30 PM   #6
MacUser2525
macrumors 65816
 
Join Date: Mar 2007
Location: Canada
Quote:
Originally Posted by Jaggions View Post
Still no luck

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.
__________________
MacPro 5,1 16gb HD6870; MacPro 4,1 5,1 12x2.66ghz 24gb GT120
MacUser2525 is offline   0 Reply With Quote
Old Aug 20, 2013, 02:34 PM   #7
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
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:

Code:
<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
        </IfModule>
        <Directory "/Library/Server/Web/Data/Sites/Default">
                Options All -Indexes -ExecCGI -Includes +MultiViews
                AllowOverride None
                <IfModule mod_dav.c>
                        DAV Off
                </IfModule>
                <IfDefine !WEBSERVICE_ON>
                        Deny from all
                        ErrorDocument 403 /customerror/websitesoff403.html
                </IfDefine>
        </Directory>
        ProxyPass /__collabd/streams/activity balancer://balancer-group-webapp-com.apple.webapp.collabd--__collabd-streams-activity
    ...
</VirtualHost>
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/".
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   0 Reply With Quote
Old Aug 20, 2013, 02:48 PM   #8
MacUser2525
macrumors 65816
 
Join Date: Mar 2007
Location: Canada
Quote:
Originally Posted by ElectricSheep View Post
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:

Code:
<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
        </IfModule>
        <Directory "/Library/Server/Web/Data/Sites/Default">
                Options All -Indexes -ExecCGI -Includes +MultiViews
                AllowOverride None
                <IfModule mod_dav.c>
                        DAV Off
                </IfModule>
                <IfDefine !WEBSERVICE_ON>
                        Deny from all
                        ErrorDocument 403 /customerror/websitesoff403.html
                </IfDefine>
        </Directory>
        ProxyPass /__collabd/streams/activity balancer://balancer-group-webapp-com.apple.webapp.collabd--__collabd-streams-activity
    ...
</VirtualHost>
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/".

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.

Code:
sudo mv /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/index.html.en.orig
__________________
MacPro 5,1 16gb HD6870; MacPro 4,1 5,1 12x2.66ghz 24gb GT120
MacUser2525 is offline   0 Reply With Quote
Old Aug 20, 2013, 03:02 PM   #9
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
Quote:
Originally Posted by MacUser2525 View Post
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.

Code:
sudo mv /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/index.html.en.orig
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.
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   1 Reply With Quote
Old Aug 20, 2013, 04:47 PM   #10
Jaggions
Thread Starter
macrumors member
 
Join Date: Oct 2012
Location: Italy
Send a message via Skype™ to Jaggions
Quote:
Originally Posted by ElectricSheep View Post
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:

Code:
<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
        </IfModule>
        <Directory "/Library/Server/Web/Data/Sites/Default">
                Options All -Indexes -ExecCGI -Includes +MultiViews
                AllowOverride None
                <IfModule mod_dav.c>
                        DAV Off
                </IfModule>
                <IfDefine !WEBSERVICE_ON>
                        Deny from all
                        ErrorDocument 403 /customerror/websitesoff403.html
                </IfDefine>
        </Directory>
        ProxyPass /__collabd/streams/activity balancer://balancer-group-webapp-com.apple.webapp.collabd--__collabd-streams-activity
    ...
</VirtualHost>
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/".
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.

Last edited by Jaggions; Aug 31, 2013 at 04:25 PM.
Jaggions is offline   0 Reply With Quote
Old Aug 20, 2013, 05:25 PM   #11
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
Quote:
Originally Posted by Jaggions View Post
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.
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/.
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   0 Reply With Quote
Old Aug 20, 2013, 09:00 PM   #12
jomobco
macrumors newbie
 
Join Date: Mar 2013
Location: Denver
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.

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.
__________________
Cheers,
John
jomobco is offline   0 Reply With Quote
Old Aug 21, 2013, 04:51 AM   #13
Jaggions
Thread Starter
macrumors member
 
Join Date: Oct 2012
Location: Italy
Send a message via Skype™ to Jaggions
Quote:
Originally Posted by ElectricSheep View Post
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/.
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! 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
File Type: zip conf file.zip (2.1 KB, 12 views)

Last edited by Jaggions; Aug 21, 2013 at 05:05 AM.
Jaggions is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How to create a pdf file that "compiles" html code and creates hyperlinks? seekinginfo Mac Applications and Mac App Store 0 Aug 7, 2013 02:07 PM
Where is index file for default web server Lion Server rockinmyshoe Mac OS X Server, Xserve, and Networking 0 Apr 14, 2013 10:59 PM
"Reduce", an universal app to resize your images (and file size) for the web. Thyraz iPhone and iPod touch Apps 9 Dec 29, 2012 06:24 AM
Name of the "file open" / "save as" dialog box app? ancilla OS X 10.8 Mountain Lion 0 Sep 29, 2012 03:59 PM
Mac mini 2011 vs Xserve 2006 for file server / web server / bt box Amethyst Mac mini 9 Aug 30, 2012 02:05 PM

Forum Jump

All times are GMT -5. The time now is 01:46 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC