Configuring Apache HTTP Server

本文介绍如何配置随Flash Media Server 3.5安装的Apache HTTP服务器,包括启用Apache、配置HTTP代理、通过HTTP传递SWF文件及HTML文件等内容。此外还介绍了如何为应用程序创建Web目录、部署CGI程序以及使用Apache作为WebDAV主机的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载:http://help.adobe.com/en_US/FlashMediaServer/3.5_AdminGuide/WSE2A5A7B9-E118-496f-92F9-E295038DB7DB.html

 

Configuring Apache HTTP Server

About 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 isRootInstall/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, seeMonitoring 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 theRootInstall\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 theRootInstall/conf/fms.ini file. You can also remove the variable and set the value directly in theHost 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 theHTTPPROXY.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 theRootInstall/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 theRootInstall/applications/hd/streams/_definst_/ folder.

For more information about editing the configuration file, see the Apache documentation atwww.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 fileRootInstall/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 atwww.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_”.

### 安装 Apache HTTP Server on Ubuntu #### 准备工作 为了确保服务器环境适合安装Apache,在开始之前应该更新现有的软件包列表。这可以通过运行`sudo apt update`命令来完成[^1]。 #### 安装 Apache HTTP Server 通过Ubuntu的默认存储库可以轻松安装Apache HTTP Server。只需执行以下命令即可完成安装过程: ```bash sudo apt install apache2 ``` 此命令会自动处理所有依赖关系并配置基本设置,使Web服务器能够立即投入使用。 #### 验证安装成功与否 一旦安装完毕,可通过多种方式验证Apache是否已正确启动和服务正常运作。一种简单的方法是在浏览器地址栏输入服务器IP地址或域名;如果看到带有“Apache2 Ubuntu Default Page”的页面,则表明安装成功。 另外还可以利用系统服务管理工具systemctl检查apache2的状态: ```bash sudo systemctl status apache2 ``` 上述命令将显示有关当前状态的信息以及任何最近的日志条目,有助于进一步确认一切运转良好。 #### 调整防火墙规则 对于启用了UFW(Uncomplicated Firewall)的情况,默认情况下HTTP流量可能被阻止。为了让外界访问到托管于该机器上的网站内容,需允许入站连接到达端口80 (HTTP) 或者443(HTTPS): ```bash sudo ufw allow 'Apache Full' ``` 这条指令不仅开放了必要的网络端口还简化了安全策略维护的工作量。 #### 测试网页浏览功能 最后一步是测试外部能否顺利加载由新搭建好的Apache Web server所提供的静态HTML文件。创建一个新的index.html文档放置在/var/www/html目录下作为首页展示给访客们看: ```html <!DOCTYPE html> <html> <head> <title>Welcome to My Website</title> </head> <body> <h1>Success! The Apache web server is working.</h1> <p>This is a test page created after installing and configuring Apache on an Ubuntu system.</p> </body> </html> ``` 保存更改之后再次尝试刷新浏览器窗口中的URL链接,应当能看到自定义的消息而不是先前的标准欢迎界面了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值