CL based method for adding HTTP Servers on IBMi sy

2019-05-15 11:03发布

问题:

I have a need to develop a CL script to quickly deploy a web application across a set of IBMi systems.

Right now, I have everything set up where I can create the directories, deploy the configurations (with the correct modifications) and place the files all from the CL script, but I cannot get it to automatically create and start the HTTP Server.

All of the documentation I can find requires that the servers be set up through the "IBM Web Administration for iSeries interface." Which is pretty much useless if I am trying to automate the entire system.

The only CL commands I can find which are of use are STRTCPSVR and ENDTCPSVR . However, there does not seem to be a clear way to add the server to the underlying system to start it.

Does anyone know of a CL command that does this? If not, is there an object/member I can edit which would add a server to the HTTPA, set it to point to the already set up htdocs and conf directories and then I can start it with STRTCPSVR?

回答1:

See the Create Apache Server Instance (QzuiCreateInstance) API for a method to automate the creation of http instances.

The QzuiCreateInstance() API allows users to create a new IBM® HTTP Server for i server instance.

Also the QUSRSYS/QATMHINSTC file contains a member for every configured instance. Each member has one record that contains an entry in the format of -apache -d /www/instancename -f conf/httpd.conf. You may be able to create members and add the record without using the API.



回答2:

Refer to:

  • How to Manually Create a HTTP Server
  • About_HTTP_directives_for_CGIDEV2
  • http://compgroups.net/comp.sys.ibm.as400.misc/create-an-apache-instance/1345746

Quick Summary:

  1. Each HTTP server instance requires its own member in QUSRSYS/QATMHINSTC

    /QSYS.LIB/QUSRSYS.LIB/QATMHINSTC.FILE/<SERVERNAME>.MBR

  2. The member above should contain one record

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

  3. Refer to /www in the IFS for for the file structure of the HTTP Server

    Use <IBMi>:2001/HTTPAdmin/ to create a sample HTTP server, which can be used as the basis for future generated HTTP Servers.

  4. Starting / Stopping the HTTP Server instance

    srtcpsvr *http httpsvr(<SERVERNAME>)