Mapping network paths for HTTP streaming
Table of contents
29 October 2012
|Prerequisite knowledge||Required products|
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:
Method 1: Using mount command
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.
Method 2: Using /etc/fstab to mount NFS file systems
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.
Method 3: Using autofs service
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:
Map the network drive and run Apache as a user other than the System user
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.
- Create a normal domain user account, and be sure to memorize its password. Make sure it is a member of Users group. Don’t make it a member of any high privileged group like Administrator.
- Grant the newly-created user a privilege of Log on as a service and Act as part of the operating system. You can do this by going to Control Panel > Administrative Tools > Local Security Policy > Local Policies > User Rights Assignment. Look for Log on as a service and Act as part of the operating system entries from the list, open it, and add the newly created user to it.
- Confirm that the created account is a member of the Users group.
- Grant the account read and execute (RX) rights to all document and script folders.
- Grant the account change (RWXD) rights to the Apache logs directory.
- Grant the account read and execute (RX) rights to the httpd.exe binary executable.
- Stop Apache by going to Control Panel > Administrative Tools > Services. Look for Apache and stop the service.
- Right-click Apache on the list > click Properties. Go to the Logon tab and then configure the account for Apache to run. Be sure to enter the correct username and password.
Using Symbolic Links (symlinks)
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
Flash Media Server Forum