29 October 2012
You should have Windows and Linux file systems as well as Apache httpd.conf tags.
This article talks about mapping a network path in the Apache Location directive for HTTP Streaming. The Apache <Location> directive can have a network path for the HttpStreamingContentPath tag. However you cannot directly add a shared network path (e.g. ://servername/path) to it because multiple adjacent slashes are collapsed to a single slash (i.e., //servername/path is the same as /servername/path). On Linux, you need to mount the network path. On Windows, you can either link the shared network path, or map the network path and start Apache to run as a different user other than the System user.
On Linux, the network path can be mounted in three ways:
The standard form of the mount command, is
mount -t type device dir
This tells the kernel to attach the file system found on device (which is of type type) at the directory dir.
Here’s an example:
mount -t cifs //hostname/path /mount/to/dir -o username=’<name>',domain=’<domainname>’
After this, it will prompt you for the password. Here /mount/to/dir must exist on the client machine before this command can be executed.
Then you add the path of the mounted directory to HttpStreamingContentPath tag.
An alternate way to mount a NFS file system from another machine is to add a line to the /etc/fstab file. The line must state the hostname of the NFS server, the directory on the server being exported, and the directory on the local machine where the NFS share is to be mounted. The general syntax for the line in /etc/fstab is as follows:
server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr
The mount point /pub must exist on the client machine before this command can be executed. After adding this line to /etc/fstab on the client system, type the command mount /pub at a shell prompt. The mount point /pub is mounted from the server.
A third option for mounting is using the autofs service. Autofs uses the automount daemon to manage the mount points by only mounting them dynamically when they are accessed.
Autofs consults the master map configuration file /etc/auto.master to determine which mount points are defined. It then starts an automount process with the appropriate parameters for each mount point. Each line in the master map defines a mount point and a separate map file that defines the file systems to be mounted under this mount point. For example, the /etc/auto.misc file might define mount points in the /misc directory; this relationship would be defined in the /etc/auto.master file.
Each entry in auto.master has three fields. The first field is the mount point. The second field is the location of the map file, and the third field is optional. The third field can contain information such as a timeout value.
For example, to mount the directory /proj52 on the remote machine mac.example.com at the mount point /misc/myproject on your machine, add the following line to auto.master:
/misc /etc/auto.misc --timeout 60
Next, add the following line to /etc/auto.misc:
myproject -fstype=cifs,username=<name>,domain=<domain>,password=<pwd> :// mac.example.com/proj52
After this, restart the autofs service using the following command:
service autofs restart
The first field in /etc/auto.misc is the name of the /misc subdirectory. This subdirectory is created dynamically by automount. It should not actually exist on the client machine. The second field contains mount options. The third field is the location of the NFS export including the hostname and directory.
On Windows, the network path can be used in two ways:
By default on Windows, all Apache services are registered to run as the System user (the LocalSystem account). The LocalSystem account has no privileges to the network via any Windows-secured mechanism, including the file system, named pipes, DCOM, or secure RPC. For Apache to be able to access network resources, you need to create a separate account for Apache as I note below.
I recommend you create a separate account for running Apache service(s). This is required to access network resources via Apache.
An alternate way to use network path is by creating symbolic link by using the mklink command. The general syntax for the command is as follows:
mklink /d <Link> <Target>
Here’s an example:
mklink /d \\hostname\dir C:\some_dir
To know more about these commands on Linux, you can type the
man <command> on the terminal. On Windows, type the
<command> --help at the command prompt. Also, you can go through Apache documentation to learn about the tags in the httpd.conf.
Tutorials & Samples