22.2 The Apache Web Server

     

The full-blown Apache Web server is not started by default on HP-UX. With the current version of the software, the startup configuration file for the Apache Web server is /etc/rc.config.d/hpws_apacheconf (formerly it was called simply /etc/rc.config.d/apacheconf ):

 

 root@hpeos002[] #  cat /etc/rc.config.d/hpws_apacheconf  # Apache Web Server configuration file # Set HPWS_APACHE_START to 1 to have the Apache web server started by # the init process. HPWS_APACHE_START=0 # Set HPWS_APACHE_HOME to the location of the Apache web server. # Default is /opt/hpws/apache HPWS_APACHE_HOME=/opt/hpws/apache root@hpeos002[] # 

Previous versions of the Apache product would have had a single configuration file to control the startup of the Tomcat Servlet engine and Webmin administration tool. All three products have separate startup configuration files:

 

 root@hpeos002[] #  cd /etc/rc.config.d  root@hpeos002[rc.config.d] #  ll hpws*  -r--r--r--   1 bin        bin            280 Oct 24 18:26 hpws_apacheconf -r--r--r--   1 bin        bin            437 Dec 10  2002 hpws_tomcatconf -r--r--r--   1 bin        bin            247 Dec 10  2002 hpws_webminconf root@hpeos002[rc.config.d] # 

The Apache Web server product is installed under /opt/hpws/apache . The configuration file is similar to the ObAM-Apache configuration file. As this is the full-blown product, there are more options as well as the possibility of loading additional Apache modules to enable features such as SSL, and so on. The configuration file resides under /opt/hpws/apache/conf . There should be an httpd-std.default file as well as the http.conf file. The configuration file follows the same layout as the ObAM-Apache configuration file with Global Environment directives, e.g., SystemRoot , and so on, followed by the Main Server configuration and then the Virtual Hosts configuration. This configuration file also has an additional section titled HP-UX Apache-based Web Server Documentation , which references various directories under /opt/hpws/hp_docs and /usr/share for online documentation available via the Web browser itself. This section also includes additional configuration files such as ldap.conf , cache.conf and ssl.conf if necessary.

Something to be aware of is that the Apache does not restrict access to simply my domain in the same way as the ObAM-Apache server did.

 

 root@hpeos002[conf] #  pwd  /opt/hpws/apache/conf root@hpeos002[conf] #  more httpd.conf  ... ### Section 2: 'Main' server configuration # # The directives in this section set up the values used by the 'main' # server, which responds to any requests that aren't handled by a ... # # Controls who can get stuff from this server. #     Order allow,deny   Allow from all   </Directory> ... root@hpeos002[conf] # 

As part of the installation process, a number of directives are set up that you may wish to look at:

 

 root@hpeos002[conf] #  grep -e ServerName -e ServerAdmin httpd.conf  # ServerAdmin: Your address, where problems with the server should be   ServerAdmin www@hpeos002.maabof.com   # ServerName gives the name and port that the server uses to identify itself.   ServerName hpeos002.maabof.com:80   # ServerName directive. # Set to "EMail" to also include a mailto: link to the ServerAdmin. # your Apache version number and your ServerAdmin email address regardless #    ServerAdmin webmaster@dummy-host.example.com #    ServerName dummy-host.example.com root@hpeos002[conf] # 

You may wish to change the ServerAdmin directive to a valid email address, or alternately to set up an alias for the www email account to direct it to the appropriate place. The ServerName gives you an idea of which port the main Web server listens on by default, port = 80. Instead of using the Port directive, the Listen directive is used to tell the daemon which to bind the main daemon to. The logfile enabled by default is simply the error logfile:

 

 # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here. If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here. #   ErrorLog logs/error_log   

You might want to look at enabling the access and referrer log files as well.

 

 # The location and format of the access logfile (Common Logfile Format). # If you do not define any access logfiles within a <VirtualHost> # container, they will be logged here. Contrariwise, if you *do* # define per-<VirtualHost> access logfiles, transactions will be # logged therein and *not* in this file. #   #CustomLog logs/access_log common   # # If you would like to have agent and referer logfiles, uncomment the # following directives. #   #CustomLog logs/referer_log referer     #CustomLog logs/agent_log agent   # # If you prefer a single logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. #   #CustomLog logs/access_log combined   

When we are ready to start the daemon, we can first check the syntax (not the logic) of our logfile with the httpd command. The new version of the software uses the “t option instead of configtest :

 

 root@hpeos002[conf] #  ../bin/httpd -t  Syntax OK root@hpeos002[conf] # root@hpeos002[conf] #  /sbin/init.d/hpws_apache start  Apache Started.. root@hpeos002[conf] # 

The default Web page for Apache is a bit more interesting than the null page for the ObAM-Apache server (see Figure 22-4).

Figure 22-4. Apache default Web page.
graphics/22fig04.jpg

There are numerous links to help in setting up the Web server. An exceptionally useful link is to Administer the Web server using a browser interface. This is not enabled by default. This is the software component known as Webmin . Getting it up and running is relatively straightforward; we simply edit the startup configuration file and run the startup script.

 

 root@hpeos002[conf] #  vi /etc/rc.config.d/hpws_webminconf  # Webmin configuration file # Set HPWS_WEBMIN_START to 1 to have the Webmin started by the # init process. HPWS_WEBMIN_START=  1  # Set HPWS_WEBMIN_HOME to the location of the Webmin. # Default is /opt/hpws/webmin HPWS_WEBMIN_HOME=/opt/hpws/webmin root@hpeos002[conf] # root@hpeos002[conf] #  /sbin/init.d/hpws_webmin start  Webmin Started.. root@hpeos002[conf] # 

We can now navigate via the Administer hotlink on the default Web page of browse directly to http://www.maabof.com:10000 where we will be asked to log in (username = admin password = hp.com) (see Figure 22-5).

Figure 22-5. Webmin main screen.
graphics/22fig05.gif

At this point, we are getting into configuring Web servers and Virtual Hosts, HTML, XML, the htpasswd command, and the like ”a path we never intended going down. With our Web server up and running, we can finish our discussion here.



HP-UX CSE(c) Official Study Guide and Desk Reference
HP-UX CSE(c) Official Study Guide and Desk Reference
ISBN: N/A
EAN: N/A
Year: 2006
Pages: 434

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net