Configuring and Managing MPE/iX Internet Services
> Chapter 9 Apache for MPE/iXMajor Components |
||||||||||||||||||||||||||||||||||||||||||
|
Hardware RequirementsThe following are estimates for hardware resources required for an Apache installation.
Steps for Starting ApacheTo start the Apache web server:
Prepare Your HP 3000 for Network AccessBefore your HP3000 can act as a web server, it must be available for network access via TCP/IP. In preparation, you should:
:run ping.net.sys;info="15.99.200.390" 64 byte(s) from $0F0DC0CF : icmp seq = 11, time = 2 ms 64 byte(s) from $0F0DC0CF : icmp seq = 12, time = 3 ms 64 byte(s) from $0F0DC0CF : icmp seq = 13, time = 2 ms < CONTROL-y > C:\>ping yourserver.com Pinging yourserver.com [15.99.200.390] with 32 bytes of data Reply from 15.99.200.390: bytes=32 time<10ms TTL=199 Reply from 15.99.200.390: bytes=32 time<10ms TTL=199 Reply from 15.99.200.390: bytes=32 time<10ms TTL=199You will also want to get a domain name. This is a unique identifier such as "yourserver.com" which is used (instead of the IP address) to direct requests from a browser to your server. Request a domain name from the administrator of the Domain Name Server (DNS) on your network. Configure ApacheApache reads two global configuration files when it starts: httpd.conf and mime.types. These configuration files determine how Apache behaves. Earlier versions of Apache read two additional global configuration files: access.conf and srm.conf. These additional global configuration files can be still be used, but by default they are empty and their original content is now included in the httpd.conf file. Edit your Configuration FileThe mime.types file comes as mime.types.default and must be copied or renamed to mime.types. Similarly, the magic.default file must be copied or renamed. The httpd.conf file comes in two different versions. The httpd.conf.default file is for a UNIX-based platform installation. The httpd.conf.sample file was derived from the httpd.conf.default file with modifications for MPE. This is the file you should edit. shell> cd /APACHE/PUB/conf shell> cp mime.types.default mime.types shell> cp magic.default magic shell> cp httpd.conf.sample httpd.conf shell> vi httpd.conf
Edit the JHTTPD Job Stream FileThe JHTTPD Job Stream File is used to run the HTTPD web server program in standalone mode with your local timezone: !job jhttpd,www.apache,pub;outclass=,2 !setvar TZ 'PST8PDT' !run HTTPD;info='-f /APACHE/PUB/conf/httpd.conf' !eojThe timezone variable, TZ, should be set to your local timezone (for example, EST5EDT for Eastern Daylight Time, PST8PDT for Pacific Daylight Time, and MST7MDT for Mountain Daylight Time). For more information about setting the timezone value, enter "man timezone" in the POSIX shell to read the POSIX help file. To preserve the access permissions (ACD) on the JHTTPD file, you can edit the file using the secure feature of EDITOR: :EDITOR /t JHTTPD /m ... /set secure /k JHTTPD,UNN JHTTPD ALREADY EXISTS - RESPOND YES TO PURGE OLD AND KEEP NEW PURGE OLD?yes /eThe JHTTPD file does not come with a password. If desired, the JOBSECURITY command can be used to provide password protection without adding your password to the file. Start the HTTPD Web Server ProgramThe HTTPD web server program is started using the JHTTPD job file. Apache can be started from either the CI or the POSIX shell: :STREAM JHTTPD.PUB.APACHE or :xeq sh.hpbin.sys -L shell>callci "stream jhttpd.pub.apache" Verify that Apache is RunningThere are a number of ways to verify if the Apache web server is running or, if it is not, to isolate how far the startup process progressed. After streaming the JHTTPD file, use :SHOWJOB to view the running job: JOBNUM STATE IPRI JIN JLIST INTRODUCED JOB NAME #J16 EXEC 10S LP TUE 10:27A JHTTPD,WWW.APACHEAnother method is to check server status using either ps from the POSIX shell or using :SHOWPROC at the CI. The parent process is the HTTPD process with the -f option. :SHOWPROC; job=jhttpd,www.apache D202 0:00.079 WAIT J16 73 :RUN HTTPD;info='-f /APACHE/PUB/conf/httpd.conf' D238 1:25.371 WAIT J16 97 (HTTPD.PUB.APACHE) -f /APACHE/PUB/conf/httpd.conf D202 0:00.066 WAIT J16 78 (HTTPD.PUB.APACHE) D202 0:00.072 WAIT J16 76 (HTTPD.PUB.APACHE) D202 0:00.069 WAIT J16 93 (HTTPD.PUB.APACHE) D202 0:00.090 WAIT J16 106 (HTTPD.PUB.APACHE) D202 0:00.050 WAIT J16 99 (HTTPD.PUB.APACHE) D202 0:00.055 WAIT J16 107 (HTTPD.PUB.APACHE) shell> ps -ef | grep HTTPD UID PID PPID C STIME TTY TIME COMMAND WWW.APACHE 720972 655457 0 Dec 31 ldev10 0:00 HTTPD.PUB.APACHE WWW.APACHE 589902 655457 0 Dec 31 ldev10 0:00 HTTPD.PUB.APACHE WWW.APACHE 3014749 655457 0 Dec 31 ldev10 0:00 HTTPD.PUB.APACHE WWW.APACHE 655457 5963849 0 Dec 31 ldev10 1:23 HTTPD.PUB.APACHE info=-f WWW.APACHE 4587619 655457 0 Dec 31 ldev10 0:00 HTTPD.PUB.APACHE WWW.APACHE 262250 655457 0 Dec 31 ldev10 0:00 HTTPD.PUB.APACHE WWW.APACHE 3407979 655457 0 Dec 31 ldev10 0:00 HTTPD.PUB.APACHEAfter the HTTPD program is running, make sure you can also access files in the directory tree. Some pages to try are:
telnet yourserver.com 80 Trying... Connected to yourserver.com. Escape character is '^]'. Stopping ApacheApache is stopped by aborting the Apache job from either the CI or the POSIX shell. Use SHOWJOB to view the Apache job: JOBNUM STATE IPRI JIN JLIST INTRODUCED JOB NAME #J16 EXEC 10S LP TUE 10:27A JHTTPD,WWW.APACHE :ABORTJOB #J16 or :ABORTJOB JHTTPD,WWW.APACHEApache can also be stopped using :ABORTJOB from the POSIX shell :xeq sh.hpbin.sys -L shell>callci "abortjob #j16" or shell>callci "abortjob jhttp,www.apache" Error LoggingApache error logging is useful when trying to start Apache as well as for monitoring a running web server. Apache logs errors into a log file called error_log by default. This log file resides in the /APACHE/PUB/logs directory. The number of messages logged in the error log is set by the LogLevel directive in the httpd.conf file. Possible values for LogLevel (by increasing significance) are debug, info, notice, warn, error, crit, alert, emerg. When a particular level is specified, messages from all other levels of higher significance are reported as well. For example, when LogLevel is "info", then messages with log levels of notice, warn and up to emerg are also posted. By default, the level is set to warn. Using a level of at least crit is recommended. Adding DocumentsAdd new documents by creating them under the document root, /APACHE/PUB/htdocs. Documents can also be added outside of the document root using the Alias directive in the httpd.conf file or by using symbolic links. The web server children that handle user requests run as WWW.APACHE, the username specified in the JHTTPD file. For more security, user WWW.APACHE has been created with minimal capabilities. Make sure files are readable by WWW.APACHE and cgi scripts and programs are executable by WWW.APACHE. WWW.APACHE must also have traverse directory (TD) permission for all the directories in the path of the file that it is accessing. In the POSIX shell, traverse directory permission is shown as execute (x) permission for that directory. cd htdocs mkdir newdir chown MGR.APACHE:APACHE newdir chmod 750 newdirOne way to check if a file is accessible by Apache is to logon as WWW.APACHE and try to access the file. TroubleshootingFor any kind of trouble with Apache, first look in the error log. Execute a tail command on the error_log from the POSIX shell to look at the last few entries. The last entry will be the most recent entry: shelliX> tail /APACHE/PUB/logs/error_logFor troubleshooting Apache at the source code level, the Apache program file can be run with the MPE debugger. It is best to run it with the -X (capital "X") option to prevent the parent Apache process from creating child processes: :run httpd.pub.apache;info="-X";debug Unsupported FunctionalityHP does not support Apache binaries built by individuals or organizations outside of HP. HP also does not support the scripts and programs in the /APACHE/PUB/bin directory. This is contributed software from the Apache Software Foundation and is provided for example only. PerformanceFor best performance, files returned to the user should be in bytestream format. For example, .html, .htm, .shtml, .shtm, .txt, .gif, .jpeg, and .jpg files, should be in bytestream format instead of in MPE-type format. Bytestream files are more compatible with Apache and with other POSIX applications than are MPE-type files. If you have a web page that calls many images which are not in bytestream format (BA), you could have noticeable performance degradation. If any of your files under the document root (htdocs) are either MPE fixed ascii (FA), MPE variable ascii (VA), or MPE variable binary (VB) files, you should consider converting them to bytestream files using the "tobyte" utility. Program files (fixed binary (FB) files with an NMPROG filecode) should never be converted. A file's filetype can be determined using either the POSIX file command or the CI listfile command: shell/iX> file index*.html index.html: MPE/iX 256-byte variable length binary (filecode: 0) index1.html: MPE/iX 80-byte fixed length ascii (filecode:0) shell/iX>callci listfile ./index.html,2 PATH= /APACHE/PUB/htdocs/CODE CODE ------------LOGICAL RECORD----------- ----SPACE---- FILENAME SIZE TYP EOF LIMIT R/B SECTORS #X MX 128W VB 19 204800 1 32 1 8 index.html 80B FA 54 204800 1 32 1 8 index1.htmlTo convert an ASCII-type file (.htm*, .shtm*, or .txt), use the tobyte utility with the -at option. If it is a binary-type file (such as .jpeg, .jpg, or .gif), do not use the -at option: tobyte -at /APACHE/PUB/htdocs/index.html /APACHE/PUB/htdocs/newindex.htmlFor more information on the "tobyte" utility, use the POSIX help facility (i.e. man tobyte). If your Apache web server seems slow in responding, you might try running the Apache job stream file, JHTTPD, in the C queue instead of in the default D queue. The changes shown below allow Apache to run in the C queue while keeping the default execution level for jobs in the D queue. The jobpri command can be executed on the console or in a systart file. !job JHTTPD,www.apache;pri=cs;outclass=,2 jobpri cs Additional DocumentationMuch of the public information available on Apache can be used for administrating Apache on MPE/iX. This especially applies to the description and usage of the over 128 different Apache configuration directives. Sources for additional information include
|