DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 14th July 2008
Yuka Yuka is offline
Complete BSD nubcake
 
Join Date: Jul 2008
Posts: 31
Thanked 0 Times in 0 Posts
Default Mounting NAS as apache alias directory

Hi everyone. I'm new here and somewhat new to FreeBSD. I recently built a FreeBSD-based apache webserver as my home server project and I've come to the point where I want to make a share on my NAS publicly accessable. I have been managing apache webservers for quite a few years at this point, although usually on a windows server, so forgive my lack of knowledge of FreeBSD related know-how.

I mounted the share to /mnt/misc/

It's technically a windows share, although the file system on the NAS is ext3 (I think) and I know it's managed in a weird way by the NAS system itself, so we can consider it not modifyable by any external systems, the accounts set up on the NAS itself have to be specified in order to gain access. The NAS is a Buffalo Terastation Pro II Rackmount. I *think* the NAS can create NFS shares, but I haven't played with that yet. It also handles FTP access to its shares, which would be a quick and easy way to access the files but sounds quite unconventional in this situation.

I did try mounting it as NFS, but it failed, perhaps I didn't set it up when I configured the share. See: this reply

I set up a VirtualHost in httpd-vhosts.conf that works great and I added the Alias and <Directory /misc> directive as shown below:

Code:
<VirtualHost *>
	ServerName domain.com
	ServerAdmin user@domain.com
	DocumentRoot "/usr/local/www/vhosts/domain.com"
Alias /misc /mnt/misc/
<Directory "/mnt/misc">
	Options Indexes FollowSymLinks
	AllowOverride None
	Order allow,deny
	Allow from all	
</Directory>
</VirtualHost>
The problem
That sort of works... I can pull up http://domain.com/misc/ and I can browse the file structure just fine and dandy (there are no html or php or other website files... the NAS share is a directory of various files), but when I try to download/access any of the files, they are totally blank. I tried a work around for further diagnosis by setting up an FTP account (pureftpd) that has access to /mnt/misc and I had the same problem.

I tried chmod -R 777 /mnt/misc but that did nothing. I tried chown -R www:www /mnt/misc but that also did nothing for the HTTP service. I then tried chown -R vftpuser:vftpuser /mnt/misc and that, too, did nothing for the FTP service.

So, uh, can anyone help me out here on the side of FreeBSD? I think I can hold my own with the apache side of the fence, unless someone knows a better trick than the Alias directive.

And this spawns a side question... if I mounted the share into /usr/local/www/vhosts/domain.com/misc would the contents of the mount get backed up if I ran dump on /usr?

Thanks!

Last edited by Yuka; 14th July 2008 at 10:02 PM.
Reply With Quote
  #2   (View Single Post)  
Old 14th July 2008
hunteronline hunteronline is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 52
Thanked 6 Times in 5 Posts
Default

Maybe:

http://www.afnog.org/archives/2007-May/003163.html
Reply With Quote
  #3   (View Single Post)  
Old 14th July 2008
Yuka Yuka is offline
Complete BSD nubcake
 
Join Date: Jul 2008
Posts: 31
Thanked 0 Times in 0 Posts
Default

I'm getting:

mount_nfs: -o username=: option not supported

I'm assuming NFS would be a better route for this setup instead of SMBFS.
Reply With Quote
  #4   (View Single Post)  
Old 14th July 2008
hunteronline hunteronline is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 52
Thanked 6 Times in 5 Posts
Default

Next Thread; http://www.afnog.org/archives/2007-May/003170.html

"I don't see '-o username=xyz,password=abc' mentioned in the manual pages, archived on FreeBSD.org (I don't have a box to play with), and frankly, I don't think what you want, can work."
Reply With Quote
  #5   (View Single Post)  
Old 14th July 2008
Yuka Yuka is offline
Complete BSD nubcake
 
Join Date: Jul 2008
Posts: 31
Thanked 0 Times in 0 Posts
Default

Going back to diagnosing/troubleshooting...

As root, I can open up a text file on the NAS and read its contents. I can read the very same file via HTTP without a hitch. However, something of some "disk consumption" substance, an ISO file, for example, is essentially an empty file when accessed via HTTP. JPG files, considerably smaller than most ISO files are 0 byte files via HTTP, whereas they can be copied to a local directory as root and are the filesize they should be.

Like I documented above, it seems like a permissions issue, but that's why I granted www:www ownership of the mount (if that can be done...?) and that yielded no change.

I thought maybe it was apache saying that I didn't have rights, but that's not the case either. If it was, apache would return a 403 error, which it doesn't.

Maybe it's a filetype declaration in Apache somewhere?

This problem is really baking my noodle.
Reply With Quote
  #6   (View Single Post)  
Old 14th July 2008
hunteronline hunteronline is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 52
Thanked 6 Times in 5 Posts
Default

I'm learning here also, what you are trying do to is actually a planned future project of mine.

Reading; http://www.freebsd.org/doc/en/books/...twork-nfs.html

What's in your;
rc.conf
etc/export
etc/hosts
Reply With Quote
  #7   (View Single Post)  
Old 14th July 2008
Yuka Yuka is offline
Complete BSD nubcake
 
Join Date: Jul 2008
Posts: 31
Thanked 0 Times in 0 Posts
Default

If it helps... I've done this before with windows, although not with this NAS. I tried it with this NAS unit, but windows didn't like it and whenever a directory on this NAS unit was mentioned anywhere in any apache conf file, apache would just refuse to restart. I think it was something to do with the permissions or authentication associated with the NAS.

I'm going to open up the NAS unit's authentication tonite (in a few hours actually) so there is essentially no authentication required and we'll see what happens.

*Fingers crossed*

UPDATE: My NAS Unit does NOT handle NFS... just SMBFS, Apple's whatever-they-call-it-today, and FTP.

UPDATE 2:

rc.conf:
Code:
hostname="host.domain.com"
ifconfig_le0="DHCP"
linux_enable="YES"
sshd_enable="YES"
courier_authdaemond_enable="YES"
courier_imap_imapd_enable="YES"
courier_imap_imapd_ssl_enable="YES"
slapd_enable="YES"
slapd_flags='-4'
mysql_enable="YES"
pureftpd_enable="YES"
apache22_enable="YES"
saslauthd_enable="YES"
postfix_enable="YES"
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
etc/export appears empty and etc/hosts has nothing besides loopback declarations.

Last edited by Yuka; 14th July 2008 at 09:57 PM.
Reply With Quote
  #8   (View Single Post)  
Old 18th July 2008
Yuka Yuka is offline
Complete BSD nubcake
 
Join Date: Jul 2008
Posts: 31
Thanked 0 Times in 0 Posts
Default

Just a thought, could it be where I am mounting the SMBFS that is causing apache to not be able to read files? The same for pureftpd?

What if I were to mount it into /usr/local/www/apache22/data?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrade Apache 1.3 mod_ssl to Apache 2.2 beandip FreeBSD Ports and Packages 11 26th March 2009 09:12 PM
strange "~" directory in home directory gosha OpenBSD General 5 23rd February 2009 06:12 PM
Changing MAC address to an alias interface? DNAeon FreeBSD General 6 20th January 2009 04:48 PM
Upgrading application not installed in default port directory APACHE ijk FreeBSD Ports and Packages 5 13th July 2008 04:34 PM
ip alias confusion hamba FreeBSD General 2 5th June 2008 10:23 AM


All times are GMT. The time now is 10:03 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick