The HTTPD web server is the Apache web server ported to run on z/OS. It runs in Unix Services, and behaves like a proper z/OS program, for example it can use z/OS userids and keyrings.
The configuration is easy, it is text driven (rather than XML), can imbed other configuration files, and can substitute variables.
I found the Apache documentation was as good, but the z/OS documentation was not very good. I prefer baby steps, taking the smallest system and adding functions, rather than configure everything and be disappointed when fails to work.
This post follows on Getting started with httpd server on z/OS and describes how to configure your first web page. Other posts on HTTPD server
- Getting started with HTTPD server on z/OS
- Getting HTTPD server to work with TLS on z/OS
- HTTPD server – what is configured?
Baby step number 2 – extending it
My HTTPD instance directory is /u/mqweb3/ .
I like to keep any changes I make to a configuration file, in a different file, and include this file in the original file. This way, if the original file changes, I just have to add the include statement rather than “diff” the my config file with the new config file. I also like to logically group changes, so my TLS configuration are in the tls.conf file, my definitions for port 8800 are in a file 8800.conf.
In the /u/mqweb3/conf is the httpd.conf file.
I edited this, and inserted
at the bottom of the file.
I created /u/mqweb3/conf/colin.conf with
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule authnz_saf_module modules/mod_authnz_saf.so
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
AuthName “Colins Page”
AuthSAFExpiration “EXPIRED! oldpw/newpw/newpw”
AuthSAFReEnter “Enter new password one more time”
The LoadModules provide the SAF support for logon
Shutdown the server (use P HTTPPCP6) – do not just cancel it – as there are several address spaces running for the server.
Restart the server (or do S httpcp,action=’restart’ ), fix any problems and try logging on to
This should prompt for userid and password, and display the status of the server. The web browsers remember the userid and password, so if you want to reuse the page it will not prompt you for the userid and password. To change to a different userid and password you will need to restart the browser.
While playing with pages and logging on, I found the curl request
curl -u colin:password -i http://10.1.1.2:8830/xxxx.html
a good way of checking the page out, and logging on each time, as the password is not saved.
If you get
BPXP015I HFS PROGRAM /usr/lpp/ihsa_zos/bin/httpd IS NOT MARKED PROGRAM
BPXP014I ENVIRONMENT MUST BE CONTROLLED FOR SERVER (BPX.SERVER)
You need to use the command
extattr +p /usr/lpp/ihsa_zos/bin/httpd
Create your a virtual host (container)
The HTTPD server can support multiple ports, and treat them as isolated environments. These are known as Virtual Hosts.
In my colin.conf I add
I created a file vhost8831.conf
Require saf-user COLIN JOE
# CharsetSourceEnc IBM-1047
# CharsetDefault ISO8859-1
# SetHandler server-status
Require saf-user COLIN JOE
# Require saf-group SYS1
ErrorLogFormat “[%t] [%l] %F: %E: [client %a] %M”
Only userids COLIN and JOE are authorised to this (http://10.1.1.2:8831/xxxx.html service).
Restart the server
If you are authorised to use this service you will get
The requested URL was not found on this server.
Because this has not been set up yet.
The DocumentRoot works with the URL to identify a file.
will look for xxxx.html in DocumentRoot so it looks for file /u/mqweb3/htdocs/xxxx.html .
Baby steps 3 – create a page.
Create a file /u/mqweb3/htdocs/xxxx.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Colin's page</title> </head> <body width="778" height="556" background="images/ihs/background.gif" resize="no" scroll="no"> <h1>Colins header</h1> <p>Colin</p> </body> </html>
Retry the web browser page.
When this is displayed you get
- The title maps to the page heading
- The background image comes from the body