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 4, 2010, 05:00 PM   #1
xper
macrumors 6502
 
Join Date: Dec 2005
Location: Sweden - Halmstad
Apache: Allow connection to storage server?

Hi!

I thought this would be a piece of cake actually but it seems i was wrong, i want to use my Mac Mini Server as a webserver (like i do now) but use a freeNAS server as my storage server for static file with my Mac Mini Server.

The problem is that Apache seems to block all connection to a server or storage for that matter, only folders on its on harddrive seems to be allowed.
If i choose to store documentroot on my other Mac Mini Server it instantly generates a Apache 403 error document.

What have i missed?
__________________
Steve clearly never made a mixtape for a girlfriend
xper is offline   0 Reply With Quote
Old Aug 4, 2010, 05:05 PM   #2
DoFoT9
macrumors P6
 
DoFoT9's Avatar
 
Join Date: Jun 2007
Location: Singapore
Send a message via AIM to DoFoT9 Send a message via MSN to DoFoT9 Send a message via Skype™ to DoFoT9
you will most likely have to enable "Others" to have read and/or write permissions to your home drive - which is not recommended at all, i have no problems sharing files to friends via apache. i have created a folder and shared it.

if you are using client OSX, you generally only can share /Library/Web Documents/Documents/ - that is where the default mount point is for websites etc, if you have OSX Server you can manually specify (im sure you can change this using Terminal too).
__________________
Official MacRumors IRC @ irc.krono.net #macrumors (Or http://kewlirc.net:9090/)
2012 2.5GHz Mac Mini Dual - 16GB RAM
Win8 PC - i5-3570k - 16GB RAM - SSD
DoFoT9 is offline   0 Reply With Quote
Old Aug 4, 2010, 05:22 PM   #3
xper
Thread Starter
macrumors 6502
 
Join Date: Dec 2005
Location: Sweden - Halmstad
Maybe i missunderstood you now but it is the Webserver (Mac minis) that should connect to the storage server (freeNAS), not the other way around.

To clarify, i want the Mac Mini Server to act as the webserver, as it does now, and store all the files a user upload on my storage server.
__________________
Steve clearly never made a mixtape for a girlfriend
xper is offline   0 Reply With Quote
Old Aug 4, 2010, 08:17 PM   #4
belvdr
macrumors 68040
 
Join Date: Aug 2005
Whatever directory you mount the NAS under must have the correct permissions for Apache to access it. You can see what user and group Apache uses by examining the User and Group attributes in the httpd.conf file.
belvdr is offline   0 Reply With Quote
Old Aug 4, 2010, 09:34 PM   #5
xper
Thread Starter
macrumors 6502
 
Join Date: Dec 2005
Location: Sweden - Halmstad
Yes ofcourse, thank you

It´s always the small details that i always miss

Easiest way for me was to change user/group in the conf to admin/admin, any security risk to have it that simple? That pretty much auto permission to all folders on every computer i own, easy enough if its not a security issue

Edit:

I basically got it to work now but my php file upload script is pointing to /media/ but it still uploads the files to my document root, but when navigate to /media/ with the browser i end up on the freeNAS storage instead so the Alias is working but it doesnt upload the file to it. I have to manually move the uploaded files to my freeNAS folder and then the image works on the homepage

My virtual host looks like this:

Code:
Alias "/media/" "/Volumes/Storage-1/www/synix/"
	ServerName www.synix.se:80
	DocumentRoot "/Users/admin/Sites/Synix/sv"
	<Directory "/Users/admin/Sites/Synix/sv">
		Allow from all
		<IfModule mod_dav.c>
			DAV Off
		</IfModule>
		AllowOverride All
		Options +FollowSymLinks +ExecCGI +Indexes +Includes
		Order allow,deny
	</Directory>
	<Directory "/Volumes/Storage-1/www/synix/">
		Allow from all
		<IfModule mod_dav.c>
			DAV Off
		</IfModule>
		AllowOverride All
		Options +FollowSymLinks +ExecCGI +Indexes +Includes
		Order allow,deny
	</Directory>
__________________
Steve clearly never made a mixtape for a girlfriend

Last edited by xper; Aug 4, 2010 at 10:40 PM.
xper is offline   0 Reply With Quote
Old Aug 5, 2010, 07:18 AM   #6
belvdr
macrumors 68040
 
Join Date: Aug 2005
You don't want to set the user/group to admin:admin. Any visitor of your web site only has to make a small exploit and they could own the machine and all data. It's just not wise.

For the upload, your PHP script is the culprit. It has to upload the file to /media instead of /. You verified this by browsing to /media and seeing the files, so that proves the httpd.conf is correct. Additionally, the daemon doesn't control what the PHP script does in respect to where uploads are occurring. That's all done within the script itself.

Also, you should restrict the permissions on those Apache directories:

Code:
Options +FollowSymLinks +ExecCGI +Indexes +Includes
That's just asking for trouble.
belvdr is offline   0 Reply With Quote
Old Aug 5, 2010, 07:40 AM   #7
xper
Thread Starter
macrumors 6502
 
Join Date: Dec 2005
Location: Sweden - Halmstad
Ah ok thanks, i will fix those security issues as soon as possible, just want to make the uploads works properly first.

Well, i can navigate to the /media/ folder in the browser, no problem, and the PHP upload script is set to use the folder /media/ but instead of it following the alias and directory it creates a new /media/ folder in the root every time i make an upload, i am not good at Apache as you notice but shouldnt it use the new path for /media/ now?
__________________
Steve clearly never made a mixtape for a girlfriend
xper is offline   0 Reply With Quote
Old Aug 5, 2010, 08:03 AM   #8
belvdr
macrumors 68040
 
Join Date: Aug 2005
If the PHP script is using the directory path (not the URL path), then you'd need to specify the full filesystem path in your script:

Code:
/Volumes/Storage-1/www/synix/
belvdr is offline   0 Reply With Quote
Old Aug 5, 2010, 08:33 AM   #9
xper
Thread Starter
macrumors 6502
 
Join Date: Dec 2005
Location: Sweden - Halmstad
Forgive me, the symlink i made wasnt correct so obviously it didnt work, i could use the code you provided but this platform is made to work on various server setups so it would break on those system.

Also, the php script can fetch its own URL base so subdomains could be used, pretty great because the webserver is almost down at idle now, pretty nice performance boost.

Thanks for all your help
__________________
Steve clearly never made a mixtape for a girlfriend
xper 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
Mac Mini server with external RAID storage - a good file server solution? teme Digital Video 1 Mar 5, 2014 10:34 AM
How to have an Apache server host a Gopher site? Can PHP do it? blanka Web Design and Development 1 Sep 5, 2013 06:11 AM
Native Apache server or XAMPP? tytheblackcat Mac Programming 6 Jul 26, 2013 04:26 PM
Upgraded apache from 1.3 to 2.2 now server ignores site definitions max¥¥ Mac OS X Server, Xserve, and Networking 2 Nov 30, 2012 10:56 AM
Apache will not run with Mountain Lion server? Tholian Mac OS X Server, Xserve, and Networking 3 Sep 19, 2012 01:29 PM

Forum Jump

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

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

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