opensuse7tg1 openSUSE 10.2: Configuring Apache with YaSTI configured Apache2 on a newly installed openSUSE 10.2 using YaST, which is how SUSE wants you to do it (rather than editing the files directly). YaST doesn’t report what files it will be modifying and can’t be undone once run, which causes me some anxiety.

Nevertheless, I still use YaST for the initial setup on SUSE because so many of the conf files are generated from source data within /etc/sysconfig/apache2. Additionally, conf files are scattered among /etc/apache2 and its conf.d, sysconfig.d and vhosts.d subdirectories. By running YaST and seeing which files change, I can conform to openSUSE conventions.

And if I edited everything by hand, I could never run YaST for fear of overwriting things. With the following approach, I can use YaST in the future to learn how to make major configuration changes. At the cost of having to retrieve a couple hand-edited files from a local RCS archive.

Part I: Content-Independent Configuration

  1. Keep a copy of the original conf files to determine what YaST has done:
    • cd /etc/apache2
    • mkdir ORIG; cp -p *.conf ORIG

  2. Start YaST/ Network Services/ HTTP Server:
    • Turn on php, perl, python and/or ruby in a config page that only appears once (can still turn these on/off later).
    • Enable dav, dav_fs, info modules. Needed to Add Module for dav_svn but the widget would not accept input, so I hit Finish.
    • The server starts. http://localhost just says “It works!” instead of the normal Apache welcome page. Didn’t like this so I copied index.html from 10.0.
    • vim /etc/sysconfig/apache2. Insert dav_svn into the Modules line. Note: Don’t hand-edit dav_svn into /etc/apache2/sysconfig.d/loadmodule.conf, as YaST will just remove it next time it runs.
    • Read comments in /etc/apache2/conf.d/*.conf files. Add SVN_DOC, SVN_VIEWCVS flags to FLAGS line in /etc/sysconfig/apache2.
    • Restart the YaST GUI and verify that the dav_svn module appears.
  3. A diff of ORIG/default-server.conf with the one YaST created shows that YaST erroneously removed the mod_userdir section, changed indents, and added ServerName and ServerAdmin. I chose the as-installed conf as the starting point:
    • mv default-server.conf{,.YAST}
    • cp ORIG/default-server.conf
    • ci -l default-server.conf
    • Edit to add ServerName and ServerAdmin from YaST version.
  4. Note: from this point forward, if YaST/HTTP Server is re-run, default-server.conf will be overwritten and must be retrieved from the RCS archive.
  5. rcapache2 restart-hup
  6. Browse http://localhost/server-info. Verify all modules present and running.
  7. Browse //locahost/manual, localhost/svn-manual.

The content-independent phase of installation is complete.

Part II: Serving Local Site Content

To prepare for Part 2, verify that Subversion archives and user public_html areas can be located via the same filespec paths as specified in the config file from SUSE 10.0.

  1. Verify that a http://localhost/~user directory works.
  2. Subversion repository configuration goes in the /etc/apache2/conf.d/subversion.conf file. See separate blog entry on this setup. I piggybacked the WebDAV configuration into this file also, rather than creating a separate file.
  3. Use htpasswd2 to create the basic authentication password file.
  4. Create /var/lock/apache2 directory, user wwwrun, group root (not www?).
  5. rcapache2 configtest
  6. rcapache2 restart-hup
  7. Browse http://localhost/svn/myrepo. Username and password are requested and the repository appears. Run RapidSVN from a Windows machine to verify connectivity.
  8. Edit /srv/viewvc/viewvc.conf to add root or root_parents, default root, and mailto.
  9. Browse http://localhost/viewvc and the ViewVC page appears. Click on the “ViewVC Help” hyperlink and the documentation appears.
  10. Using Konqueror, browse webdav://localhost/fs and a folder view of the WebDAV folder appears.
  11. See this blog entry for details of connecting to WebDAV via WindowsXP.

All of my local Subversion, WebDAV, and web page content is now available via Apache.

Part III: Virtual Hosts

Finally I’ll add virtual hosts for my various development, prototype, and staging areas. YaST HTTP Server GUI offers a screen to do this, but I chose to start with the as-delivered file as I did with default-server.conf.

  1. Add LLvhost.conf file to /etc/apache2/vhosts.d. I copied over the SUSE 10 version of this file, which follows the vhost.template example quite closely.
  2. This file defines four virtual servers:
    • localhost - contains only a ServerName statement to serve as the default server.
    • llxxx - three name-based servers that have document roots in various code development subdirectories. Each of these gets a separate set of error and access log files.
  3. Uncomment the NameVirtualHost *:80 line in /etc/apache2/listen.conf.
  4. Add the three name-based server names to /etc/hosts as synonyms for localhost.
  5. rcapache2 configtest
  6. rcapache2 restart-hup
  7. Browse http://llxxx and the virtual host content appears. Verify that log information appears in the correct file pair in /var/log/apache2.

The Apache configuration is complete.

- Tnx to Boozzie Software blog for nice and simple howto.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Print This Post Print This Post

If you like this article then subscribe to Linux and Open Source Blog and get the latest articles delivered to your Feedreader. If you want to recieve latest articles in your email click here.

Similar & Related Posts: