Configuring Apache HTTP Server

About Apache HTTP Server

Flash Media Server 3.5 includes Apache HTTP Server. If you install and enable the web server, you can deliver client SWF files, container HTML pages, and media assets from Flash Media Server. You can serve content over HTTP, as well as RTMP. In addition, you can serve video over HTTP progressive download as a fallback solution for web proxies that break RTMP or RTMPT.

The Flash Media Server installation of Apache is like the standard installation. You can use Apache documentation for most configuration tasks. The Apache root installation folder is RootInstall/Apache2.2. The web root is RootInstall/webroot.

Note: The Flash Media Server documentation uses “RootInstall” to indicate the Flash Media Server root installation folder (C:\Program Files\Adobe\Flash Media Server 3.5 by default on Windows). The Apache documentation and configuration files use “ServerRoot” to indicate the Apache root installation folder.

Installation locations

The Apache server that installs with Flash Media Server differs from a standard Apache installation in the following ways:

  • The apachectl files are in the RootInstall/Apache2.2/manual/programs folder.

  • The httpd.conf file and the standard secondary configuration files are in the RootInstall/Apache2.2/conf folder.

  • The log files are in the RootInstall/Apache2.2/logs folder. For more information, see Monitoring and Managing Log Files.

Alternate configurations

To do any of the following, edit the RootInstall/Apache2.2/conf/httpd.conf file:

  • Handle multiple adaptors or virtual hosts

  • Block sensitive file types, such as ASC

  • Handle any non-standard MIME types required for progressive download

  • Serve the default server-status and server-info pages

  • Modify source directories

Enable Apache

When you install Flash Media Server and choose to install Apache, it is enabled by default. To manually enable Apache, edit the fms.ini and Adaptor.xml files.

  1. Open the fms.ini file in a text editor.

  2. Add port 80 to the ADAPTOR.HOSTPORT tag.

    ADAPTOR.HOSTPORT = :1935, 80

  3. To start and stop Apache when Flash Media Server starts and stops, set the SERVER.HTTPD_ENABLED parameter to true:

    SERVER.HTTPD_ENABLED = true
  4. Open the Adaptor.xml configuration file in a text editor.

    If you have multiple adaptors, open the file for the adaptor you want to configure. The default Adaptor.xml file is located in the RootInstall\conf\_defaultRoot_ folder.

  5. Set the enable attribute of the HttpProxy tag to "true", as in the following:

    <HttpProxy enable="true" maxbuf="16384"> 
        <Host port="80">${HTTPPROXY.HOST}</Host> 
    </HttpProxy>

    Set the value of the HTTPPROXY.HOST variable in the RootInstall/conf/fms.ini file. You can also remove the variable and set the value directly in the Host tag.

  6. Save and validate the Adaptor.xml file.

  7. Restart the server.

Configure HTTP proxying

Flash Media Server uses port 80 for RTMPT connections. HTTP connections by default use port 80. To allow Flash Media Server to serve media over HTTP when RTMPT is blocked, Flash Media Server proxies HTTP connections to port 8134.

Configure HTTP proxying in the RootInstall/conf/fms.ini file. In the fms.ini file, you can enable or disable proxying through the HTTPPROXY.HOST parameter. You can also specify the port to proxy to or proxy to a remote server.

To enable HTTP proxying, set a value for the HTTPPROXY.HOST parameter. The following default configuration proxies port 80 HTTP requests to local port 8134:

HTTPPROXY.HOST = :8134

Setting the parameter to no value disables HTTP proxying:

HTTPPROXY.HOST =

To proxy to a remote server, set the parameter to the remote server you want to use:

HTTPPROXY.HOST = webfarm.example.com:80

Deliver SWF files and HTML files over HTTP

Apache can deliver SWF files, HTML files, JPG files, and many other standard file types over HTTP. Place files that you want to deliver over HTTP in the correct folders. By default, Apache is configured to use following paths:

Path

Location

Example URL

/

RootInstall/Apache2.2/webroot

http://myFMSServer.com/app.swf

/cgi-bin

RootInstall/Apache2.2/cgi-bin

http://myFMSServer.com/cgi-bin/someScript.pl

/local-cgi-bin

RootInstall/Apache2.2/local-cgi-bin

http://myFMSServer.com/local-cgi-bin/someScript.pl

These folders are global, not application-specific. Any SWF files and HTML files you want to serve over HTTP must be in these folders or in application-specific folders. To create aliases for application-specific folders, edit the httpd.conf file.

Create web directories for applications

To have Apache serve content over HTTP, either use one of the predefined web directories or create a web directory for that application. To create a web directory for an application, add an alias to the RootInstall/Apache2.2/conf/httpd.conf file. For example, the following lines create an alias that points to the streams directory of an application called “hd”:

Alias /hd/ "applications/hd/streams/_definst_/" 
<Directory "applications/hd/streams/_definst_/"> 
    Options Indexes MultiViews FollowSymLinks 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
</Directory>

Copy media files to the RootInstall/applications/hd/streams/_definst_/ folder to serve them over HTTP. For example, if a client requests http://fms.example.com/hd/someVideo.flv, Apache serves it the someVideo.flv file from the RootInstall/applications/hd/streams/_definst_/ folder.

For more information about editing the configuration file, see the Apache documentation at www.apache.org.

Deploying CGI programs

By default, Apache is configured with the following global aliases:

Alias

Path

Notes

/cgi-bin/

RootInstall/Apache2.2/cgi-bin

Accessible to anyone through an HTTP call.

/local-cgi-bin/

RootInstall/Apache2.2/local-cgi-bin

Accessible only to Flash Media Server.

Apache assumes any file you place in the RootInstall/Apache2.2/cgi-bin folder is a CGI program. For example, if a client requests the URL http://fms.example.com/cgi-bin/someScript.pl, Apache attempts to execute the file RootInstall/Apache2.2/cgi-bin/someScript.pl.

Files in the local-cgi-bin folder, on the other hand, are accessible only to Flash Media Server. If you have a CGI program used by server-side ActionScript, place it in the local-cgi-bin folder.

To change the location of the cgi-bin or the local-cgi-bin, edit the RootInstall/Apache2.2/conf/httpd.conf file.

Using Apache as a WebDAV host

You can configure the web server to act as a WebDAV host. For information, see the Apache HTTP Server version 2.2.9 documentation at www.apache.org.

The following keywords are reserved words: open, close, send, idle, fcs, fms, crossdomain.xml, fpad. Reserved words cannot be used for directory names under the webroot directory or for anything else. If you have applications with these names, use custom aliases to give the HTTP virtual directories slightly different names from the RTMP applications, such as “open_”.