Three ways to create an HTTP Server on IBM i

IBM HTTP Server for i is based on the Apache HTTP Server [[HOTLINK “Apache HTTP Server” to http://httpd.apache.org ]] , developed by the Apache Software Foundation.  The IBM HTTP Server (powered by Apache) for i includes a rich collection of features:

 

  • Support for Secure Sockets Layer (SSL) connections.
  • Extended authentication using LDAP, IBM i user profiles and validation lists, Kerberos
  • Full-function, task-oriented, web-based graphical user interface for administration and configuration of servers
  • Hot backup
  • Static and dynamic local file caching, including FRCA
  • Dynamic content generation with FastCGI.
  • Real-time server statistics
  • Highly available HTTP server
  • Large file support
  • IP version 6 support
  • Proxy load balancing support

 

In this article, I’ll introduce three ways to create an HTTP Server on IBM i:

1          Use IBM Web Administration for i [[HOTLINK “IBM Web Administration for i” to http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/rzaie/rzaieconadmin.htm ]] GUI interface to automatically create an HTTP Server. Here is a very convenient for those who has very little knowledge of Apache or IBM i. This way is recommended.

2          Manually created a new Apache from the scratch. This is very necessary when the user encounter that IBM Web Administration for i is unavailable.

3          Manually created a new Apache based on the existing one. This is more convenient and simpler than the second option.

 

Before that, you need to install IBM HTTP Server for i on your IBM i server.

IBM i Release

Licensed Program

Description

V5R4

5722DG1

IBM HTTP Server for i5/OS

V6R1

5761DG1

IBM HTTP Server for i5/OS

V7R1

5770DG1

IBM HTTP Server for i

 Now, I will introduce each way respectively.

Using IBM Web Administration for i to create an HTTP Server  

 

Web Administration for i GUI is a very handy web tool which allows you to manage every aspect of the HTTP servers running on this system.

 

Bring up the IBM Web Administration for i by accessing URL http://<your_system>:2001/HTTPAdmin. This Figure 1 is the starting point to create and configure an HTTP Server. The Create HTTP Server wizard creates all the necessary configuration files and populates these files with the required directives to create a basic working HTTP server.

 

Figure 1 - Create HTTP Server wizard

 

There are 7 steps when you go through the Create HTTP Server wizard. The following are all the fields that you need to fill for each step:

  • Server name: Specify the name of your HTTP server. The Maximum length is 10.   
  • Server description: Specify the description of your HTTP server.
  • Server root: Specify which directory to use as server root, if the server root directory does not exist, the wizard will create for you.
  • Document root: Specify which directory to use as document root, if the document root directory does not exist, the wizard will create for you.
  • IP address/Port: Specify the IP address and TCP port this server listens to. Most browsers make requests to port 80 by default.
  • Access log file: Specify if you want your new server to use access log. The access log contains information about requests made to the server. This information is useful for analyzing who is using your web site and how many requests have been made during a specific period of time.
  • Log maintenance: Specify the time to keep the log files. The log files include the error and access logs. To avoid the log files from becoming too excessive, the server can be configured to automatically delete the oldest ones. When enabled, the files will be automatically deleted when the logs reach a specific age.

 

After 7 steps, you will come to the summary page, as Figure 2 indicated. Click Finish to create an HTTP Server

 

Figure 2 - Create HTTP Server Summary Page

 

Now your HTTP server has been created and is ready. Any changes to what port it listens on or configuration options can be done by editing the httpd.conf file using the Edit Configuration File under Tools, as Figure 2 indicated. Then you can use the following CL command to start it.

STRTCPSRV SERVER(*HTTP) HTTPSVR(<servername>)

Where <serverName> is the HTTP server name you just created. In our exaple, it’s WEBSERVER.  

 

Well, if you are in a situation where the IBM Web Administration Server is unusable, and you must create a HTTP server immediately, what would you do? So next I will introduce another two ways to manually create an HTTP Server. One is to manually create from the scratch; the other is to create from COPY.

Manually creating an HTTP Server —— Create from scratch  

 

The instructions for manually creating the HTTP server follow:

 

1          Setting up the Integrated File System (IFS) directory

 

Execute the following CL commands:

  • Create the base directory:

md dir('/www/<serverName>') dtaaut(*rwx) objaut(*all)

  • Then create the subdirectory to contain the instance configuration file

md dir('/www/<serverName>/conf') dtaaut(*rx) objaut(*none)

  • Next, create the subdirectory to contain the home page(s) for this instance

md dir('/www/<serverName>/htdocs') dtaaut(*rx) objaut(*none)

  • Last, create the subdirectory to contain the access log and the error log for this instance

md dir('/www/<serverName>/logs') dtaaut(*rwx) objaut(*all)

Note: The QTMHHTTP user profile is the default user profile of HTTP Server. Ensure QTMHHTTP must have read and execute authority to the directory path of the server root directory. The QTMHHTP1 user profile is the default user profile that HTTP Server uses when running CGI programs. This QTMHHTP1 user profile must have read and execute authority to the location of any CGI program.

For any problem with user profile for HTTP Server, please refer to User profiles and required authorities for HTTP Server

 [[HOTLINK “User profiles and required authorities for HTTP Server” to http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzaie/rzaiesetauth.htm ]]

 

2          Creating the Apache server instance

 

An HTTP server instance is a member in file QUSRSYS/QATMHINSTC. The name of a member is the name of the HTTP instance.

 

You may use command WRKMBRPDM FILE(QUSRSYS/QATMHINSTC) to list and display its members, as Figure 3 indicated.

Figure 3 – List all member files

 

You may use command ADDPFM QUSRSYS/QATMHINSTC <serverName>

STRDFU option 5 on file QUSRSYS/QATMHINSTC member <serverName> to add a member, as Figure 4 indicated.

 

Figure 4 – Update data in member files

 

Once the member is created, you need to insert record. Each member is made of a single record.

 

Type option 18 next to the member name to edit it in Data File Utility (DFU) mode. Then press Enter, then press F9 to insert data, as indicated in Figure 5:

 

Figure 5 – Add record in member files

 

The record contains information about the related HTTP instance:

  • The type of this HTTP instance : Original or Apache
  • The qualified name of the stream file containing the directives of this HTTP instance
  • Whether this instance should be auto-started when command STRTCPSRV *HTTP is run. When command STRTCPSVR *HTTP is entered, all the members are processed in order to start the appropriate HTTP instances.

 

Here are two examples to better show the usage:

Example 1:

-d /qsys.lib -f qusrsys.lib/qatmhttpc.file/default.mbr –AutoStartY

  • As nothing is said about the type of this instance, that is an Original HTTP instance
  • The HTTP directives of this instance are in the physical file QUSRSYS/QATMHTTPC member DEFAULT
  • This HTTP instance is autostarted when command STRTCPSRV *HTTP is run.

Example 2:

-apache -d /www/<serverName> -f conf/httpd.conf –AutoStartY

  • –apache means that the type of this HTTP instance is Apache
  • The qualified name of the stream file containing the directives of this HTTP instance is /www/<serverName>/conf/httpd.conf
  • This instance should not be auto-started when command STRTCPSRV *HTTP is run.

Now your HTTP server has been created successfully, you can also use the following CL command to start it.

STRTCPSRV SERVER(*HTTP) HTTPSVR(<servername>)

 

 

Manually creating an HTTP Server —— Create from COPY  

 

Here, you can repeat the first step as above to create the full IFS directory structure. Here, the step of creating IFS directory is similar with the above. I won’t repeat here, what I focus on is to create the member for your HTTP server based on the existing one.

 

The instructions for manually creating the HTTP server follow:

 

1          Setting up the Integrated File System (IFS) directory

You can repeat the first step as above to create the full IFS directory structure.

2          Creating the Apache server instance

Continue to use command WRKMBRPDM FILE(QUSRSYS/QATMHINSTC) to list and display its members. Then find the member APACHEDFT (default Apache instance), and press F4 to prompt the COPY command. Change the To member (TOMBR) or label parameter to whatever you would like to name your new HTTP server. This will be defined as <serverName> for use throughout this document. Press Enter to accept the changes.

 

Figure 6 – Copy Members

 

Once the member is created, type 18 next to the member name to edit it in Data File Utility (DFU). Then you can configure your member file as we mentioned above. For example, you can change the Instance Data value from the following:

 

-apache -d /www/apachedft -f conf/httpd.conf -AutoStartN  to

-apache -d /www/<serverName> -f conf/httpd.conf -AutoStartN .

 

Where <serverName> is the name of the member you just created.  

 

 

Now, you’ve successfully create a new Apache Server with different three ways. With the IBM HTTP Server (powered by Apache) for i you have everything you need to quickly and easily establish a Web presence and get started on the road to working the Web for business.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值