Here are some instructions on how to create a HTTP server from your IBM® i server command line.
The first thing we will do, is copy an existing APACHE SERVER that is defined within the IBM i Integrated Web Server. To do this, let's use PDM:
Enter option 3 next to APACHEDFT, and COPY the definition to your new proposed webserver name. Change the To member (TOMBR) or label parameter to whatever you wish to name your new HTTP server. We will use <NEWSERVER> for use throughout this lesson.
NOTE: If you dont have PDM you can copy this member just as easily using CPYF
Once the member is created, type 18 next to the member name to edit with DFU. We cannot use PDM 2 for SOURCE EDIT because this i not a source file. Of course, you can use any other file editor you may prefer.
Now, simply scroll through the file, looking for any values that contain the old APACHEDFT value and update them to match our new server name <NEWSERVER>.
Find the Server name and change:
and change this to:
Obviously <NEWSERVER> is the name of the source member, and new Apache HTTP Server, you just created.
You also have the option of setting your new HTTP server <NEWSERVER> so that the server is started every time the STRTCPSVR *HTTP *ALL command is entered. Alternatively, change to -AutoStart N to allow the server to only start when you select it manually (or from the WEBUI).
Press F3 to Save/Exit.
Define IFS components of the HTTP Server
The HTTP Server has its main definition in the IFS. So, lets create the subfolders.
Type the following commands from the 5250 command line:
MKDIR '/www/<NEWSERVER>/conf'
MKDIR '/www/<NEWSERVER>/logs'
MKDIR '/www/<NEWSERVER>/htdocs'
Once again, <NEWSERVER> is the name of your new HTTP Server (but you knew that right?)
Now we need to load a very important file into the IFS 'CONF' folder
Create httpd.conf
The 'httpd.conf' file is the main configuration file for the Apache HTTP Server. It contains directives that control the server's behavior and settings. Here are some key points about 'httpd.conf':
Copy the httpd.conf file from the following location:
to your new <serverName> location
You can do this easily with the CPY command:
When this is completed you should have an IFS location and subfolders for your new HTTP Server that look like this:
Edit this new httpd.conf and scan and replace all references of apachedft to <NEWSERVER>.
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.
For example, the Listen *:80 directive in the httpd.conf file instructs the HTTP server to listen on port 80 for all TCP interfaces. If you want your HTTP server to listen on a different port, change the port number in the Listen directive.
This is the file you will EDIT to change the REST YAJL webservices that will be called ... but more on that in the next TWEAKING YAJL lesson 😉