|
Displaying Static HTML Pages from the iSeries
by Shannon O'Donnell
In the last few issues of Midrange Programmer, I showed you how easy it is to create static HTML
pages. In this issue, I was planning to go into even more detail on HTML tags and the different
parameters available to you. But then I got to thinking about it and decided that you'd probably rather learn
how to push your newly created HTML pages to your iSeries, and then allow your users to display them
from a browser.
One of the goals of Midrange Programmer is to cut through all the baloney and just teach you the
easiest way to accomplish something. With that in mind, you'll understand why this is going to be a bare-
bones article. If you want the background on some particular topic I cover here, feel free to e-mail me and I'll
give you what information I can, or you can check out the IBM iSeries Information Center.
Instead of a lot of theory, let's focus on the steps you need to put your static HTML Web pages on the
iSeries and then display them.
Configuring HTTP Server
Here are the steps you need to configure the iSeries HTTP server. We'll be doing most of this from your
browser, but before we do that, go to an iSeries command line and enter the command STRTCPSVR
SERVER(*HTTP) HTTPSVR(*ADMIN). This will start the iSeries HTTP Administration instance. Next, you'll
need to start the ADMINA instance of the HTTP server. (This is only for iSeries running V4R5. If you're on
a V5R1 system, you can skip the step for starting the ADMINA instance.) To start the ADMINA instance,
enter the command STRTCPSVR SERVER(*HTTP) HTTPSVR(ADMINA). Give that a moment to start
running, then go to a Web browser and enter the URL http://your_server_name:2001. You can use
either the IP address or the name you created in the PC HOSTS file (see "How Does Your Browser Find a
Web Page?"). You will be prompted with a GUI to enter a user ID and password. You can use the same
user ID and password you use to sign on to your iSeries, but you will require *IOSYSCFG authority to
successfully log in to this screen, which is the HTTP Configuration and Administration screen.
Once you correctly log in, you'll see a screen similar to the one shown here (if your screen looks different,
it's probably because you don't have the latest group PTF for HTTP Server. It's not essential that you have
that for this exercise, although you'll probably want to order and install it as soon as possible, so that you're
up to date):
Click on the IBM HTTP Server for AS/400 link.
Next click on the "New! Updated Configuration and Administration for HTTP Servers (original and powered
by Apache)" link.
The next screen you'll see should be similar to the one shown here:
Click on the Create HTTP Server link, found under the Administration tab.
Give your new server a name, such as MYWEBSRVR.
Take all the defaults except for the PORT. Change that from Port 80 to Port 4095, or any Port that's open on
your system.
Note that the directory names are the same name as you chose for the server name, but they reside below
the root directory named /www. You'll end up with a directory named, for example, /www/myserver as the
server root and /www/myserver/htdocs as the document root. Keep these names in mind (in fact, it'd be a
great idea to print the final configuration page for your records), because you'll be placing all of your HTML
documents in one of these directories in a moment.
When you're all done, click the FINISH button to create your new HTTP Server instance. You can now click
on the CONFIGURE button to add further configuration directives, or the MANAGE button to Start your
new server. Click on the MANAGE button.
That's it. Those are the bare-bones steps you need to create a new HTTP server instance to serve up your
Web pages.
Now let's put some Web pages on your iSeries.
FTP Web Pages to the iSeries
Let's use FTP to push a Web page to the iSeries. From your PC, follow these steps:
1. Click Start
2. Click Run
3. Enter CMD and click OK. (For Windows 98/ME PC's, enter COMMAND instead of
CMD.)
4. Change to the directory where your HTML files are stored on your PC (let's assume they are in a
directory named MYHTML on your PC):
cd myhtml
Next, enter the following FTP commands (make sure they're all lower case):
1. ftp your_iseries_name_or_ip_address
2. type your user ID when prompted to do so.
3. type your password when prompted to do so.
4. put yourfile.html /www/mywbsvr/yourfile.html (Replace yourfile.html with the name of your
own HTML documents.)
5. quit
6. exit
Your HTML documents are now on your iSeries. You may need to edit the authority on the HTML
documents you just uploaded to allow *PUBLIC access. To do so, enter the command WRKLNK
'/www/mywebsvr' from a command line. Then enter 5 next to that directory to DISPLAY it, and,
finally, locate the HTML documents you uploaded via FTP and enter 9 in front of each (to work with
authority); ensure that *PUBLIC has at least *R authority to the document. Now let's open one of your
custom HTML pages in a browser.
Opening Your HTML Page in a Browser
From the browser, enter the URL http://your_iseries_name_or_IP_Address:4095/htdocs/yourfile.html
(where your_iseries_name_or_IP_Adress is the IP address of your iSeries--or it's name, if you use the
HOSTS file; 4095 represents the port you defined when you created your server instance; and
yourfile.html is the name of the HTML file you just pushed to the iSeries. (Note that case is sensitive,
so make sure that if your document name is CooL1.htm, you don't accidentally enter COOL1.htm.)
You should now see your new HTML page open in the browser. Turns out it's pretty easy to display your
own custom HTML pages from the iSeries!
|