Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with IBM HTTP Server Powered by Apache and CGI

Similar presentations


Presentation on theme: "Getting Started with IBM HTTP Server Powered by Apache and CGI"— Presentation transcript:

1 Getting Started with IBM HTTP Server Powered by Apache and CGI
Chris Adair Information Systems Director - National Envelope Treasurer – Metro Midrange Systems Association

2

3 iSeries GUI Debugger Chris Adair
Information Systems Director - National Envelope Treasurer – Metro Midrange Systems Association

4 Disclaimer Note: In this presentation, when we refer to the eServer i5 or iSeries primary operating system, we refer to OS/400, even though the operating system name has changed to i5/OS in V5R3. If it is not explicitly stated otherwise, the term OS/400 also refers to i5/OS.

5 HTTP Server And CGI How many of you have a HTTP Server running on a Systemi? How many of you have CGI running on that server?

6 What is an HTTP Server? A computer that is responsible for accepting HTTP requests from clients, which are known as Web browsers, and serving them HTTP responses along with optional data contents, which usually are Web pages such as HTML documents and linked objects (images, etc.).

7 Why the Apache HTTP Server?
Most popular Web server in the industry 70% of the web sites on the internet are using Apache ( 2005 Netcraft Web Server Survey) Easily maintainable Many Apache skills in the marketplace Scalable Handles the small usage sites to the well traveled sites Affordability Most likely, you already have everything you need.

8 What Do You Need? 5722–DG1 IBM HTTP Server for iSeries
HTTP Server (original) - Only until OS/400 V5R2 HTTP Server Powered by Apache Net.Data Webserver Search Engine and Crawler Apache Software Foundation’s Jakarta Tomcat Highly Available HTTP Server Triggered Cache Manager 5722-TC1 TCP/IP Utilities 5722-JV1 Java Developer Kit 1.3

9 The Admin Server A HTTP Server used to manage Web Servers
To Start the Admin Server iSeries Navigator Under Network > Servers > TCP/IP: Right Click HTTP Administration Command STRTCPSVR SERVER(*HTTP) HTTPSVR(*ADMIN)

10

11

12 Accessing the Admin Server
The Admin Server “listens” on port 2001 for normal HTTP traffic Using a browser, enter this URL The Admin Server is secured by i5/OS user profiles User profiles must have *IOSYSCFG and *ALLOBJ special authority to perform configuration activities IBM does not recommend using QSECOFR

13

14

15 Now that the Admin Server is started, we can use the wizard to create a new IBM HTTP Server Powered by Apache

16 Create a New HTTP Server
From the Admin Server, click IBM Web Administration for iSeries When the HTTPAdmin page is displayed, be sure to select the “Manage” and “All Servers” tabs From the navigation pane on the left, click “Create HTTP Server”

17

18

19 Step 1: Server Name and Desc.
On the Create HTTP Server pane, key a name and description for your server. On the bottom of the page, click “Next”.

20

21 Step 2: Specify Root Directory
The root directory is where the configuration files and log files are kept. This will be in the Integrated File System. Typically, this will just be defaulted, and there’s nothing to key. On the bottom of the page click “Next”.

22

23 Step 3: Specify Document Root
The document root directory is where all the servable files are kept. You will put all your HTML’s, images, etc... under this directory or subdirectories Typically, this will just be defaulted, and there’s nothing to key. On the bottom of the page click “Next”.

24

25 Step 4: Specify IP Addresses / Port
Typically, you will want all IP addresses Key the desired port number The HTTP default is 80 Do not use a port number already in use On the bottom of the page click “Next”.

26

27 Step 5: Access Log You can indicate whether or not you want an access log. An access log will keep track of who is making requests of your server. The error log will automatically be created, regardless of this selection. On the bottom of the page click “Next”.

28

29 Step 6: Specify Time to Keep Logs
New log files will be created on a daily basis to prevent any one file from becoming to large. Specify whether or not to keep log files, both error and access logs. And, how many days to wait before they’re purged On the bottom of the page click “Next”.

30

31 Step 7: Summary Screen The wizard displays all the information from the prior steps for a final review. If any changes are needed, click the “Back” button. If no changes are needed, and your ready to create the server, click “Finish”.

32

33 Back To The Admin Server
Once completed, the Admin Server is displayed with the new server. We can continue to make configuration changes, or start the server and give it a test, We’ll start the server by clicking the green arrow.

34

35

36

37 Here’s What We Added Some IFS Directories/Files to hold our configuration and content 5 Jobs running in the QHTTPSVR subsystem Let’s take a look……

38

39

40 Serve Some Static Reports

41 Create Your Own index.html
Using your favorite HTML editor, make your own index.html. I used IBM Rational Software Gave my page a title and image Moved it to the “HTDOCS” directory under APACHE01 in the IFS

42

43

44

45 Add Some Directories I added some links for a few locations
Those links need to direct us to a directory under the APACHE01, where I plan to put some month end reports, stored as PDF’s But first, we’ll need to change the configuration of the server to allow directory listings.

46

47

48

49

50 Global Configuration I added all my directories under “Global Configuration”. Now, I need to go to each directory location and specify “Directory Handling” and “Security”

51

52

53

54 Create the IFS Directories
Now that the server is set, we need to create the IFS directories Using iSeries Navigator: Under File Systems > IFS > Root > WWW > Apache01, Right click on HTDOCS and select “New Folder”.

55

56

57 Restart the Server All my directories have now been entered.
I’ve secured the ones I need, based on a i5/OS profile. All the directories have been created on the IFS. Let’s restart the server and see what happens.

58

59

60 There’s Not Any Files Use your SPLF conversion utility to put some files in the directories If you don’t have a SPLF conversion utility Take a look at this site: Download 4 source members: CVT2CMD, CVT2CLP, CVT2HTML, and CVT2PDF Compile and Run

61

62

63 Summary Started the Admin Server Created an IBM HTTP Server
(Powered by Apache) Configured the server Added some IFS directories Downloaded some conversion software Displaying static reports via the browser

64 Dynamic Data

65 Dynamic Data Examples CGI Net.Data PHP PERL WevDav

66 Step 1: CGI Create a new library to hold your new programs
CGILIB Create source file CGILIB/QRPGLESRC Copy Service Program to your new library QHTTPSVR/QZHBCGI

67 QHTTPSVR/QZHBCGI Contains HTTP API procedures for communicating with server – just a few are: QtmhWrStout – The most used API that writes data to standard output. In other words, writes HTML or JavaScript commands to a browser. QtmhRdStin – This API will read information that is made available with a POST operation. QtmhGetEnv – Used to retrieve values set by the server. Typically used to retrieve GET data.

68 Step 2: Binding Directory
Create a binding directory CGILIB/CGIBNDDIR Put your QZHBCGI service program in the binding directory. ADDBNDDIRE

69 Step 3: Change Your HTTP Server
We’ll to change the configuration to allow for CGI programs Add a directory under Global configuration Add a “Script Alias Match” under URL Mapping in Global configuration Check security of new directory Enable CGI in new directory Stop the server and re-start

70

71

72

73

74 Step 4: Create a Sample Program
Don’t let all the CGI routines scare you Basically, all it’s doing is formatting some HTML and giving it to the browser. Compile using CRTBNDRPG and place in the CGILIB

75

76

77 If It Doesn’t Work Check the error log in the IFS
/www/apache01/logs/error_log Check you server configuration If you didn’t APPLY your changes, it may not have taken Check security of the CGI directory

78 Summary We made a library and put a service program and binding directory in it. Changed a few things on our HTTP Server to allow for CGI Wrote some sample code to test CGI

79 Interactive CGI

80 Interactive CGI Using you favorite HTML editor, create a page that asks for some input. I created an “Inventory Lookup” page The user keys a SKU number, presses “Submit” The “Submit” actually calls a CGI program I use the QtmhGetEnv API to retrieve the SKU number entered Process the request and display

81

82

83 Code Snippets

84 CGI Freebies

85 Some CGI Freebies WRKCGISPLF STRCGISQL
STRCGISQL

86 WRKCGISPLF

87 STRCGISQL

88 STRCGISQL

89 Conclusion

90 Summary We started the Admin Server
Created and configured a HTTP server Allowed for some static report serving Compiled and ran some CGI Cost = 0 Most likely, you already have everything you need.

91 Hints Learn some HTML Buy a good CGI book and read the online articles
It doesn’t take much to get started. The basic syntax of creating some basic HTML Tables and Hyperlinks will go a long way Buy a good CGI book and read the online articles Brad Stone Paul Tuohy Bob Cozzi Jon Paris All are using RPG CGI and have written publications on how to get started

92 CGIDEV2 Thank You, Giovanni B. Perotti
39 years at IBM Creator of CGIDEV2 If you’re at V5R1 download CGIDEV2 Lot’s of code samples and pre-written procedures

93 You may contact me via email at: CADAIR@NATENV.COM
Questions? You may contact me via at:


Download ppt "Getting Started with IBM HTTP Server Powered by Apache and CGI"

Similar presentations


Ads by Google