The last task is to configure your web server. Instructions below are given for Apache and mod_perl.

INSTALL document in previous versions of LXR told to edit httpd.conf. This presents serious drawbacks. A better approach is to write your configuration in a file lxrserver.conf (any name will do as long as extension is .conf) and store it into /etc/httpd/conf.d/. It is automatically read at server initialisation and merged with httpd.conf. You can keep a copy in your home directory and whenever the server is updated, all you have to do is store again this file in the /etc/httpd/conf.d/ directory.

Access to the /etc/httpd/conf.d/ directory requires root privileges.

  • Make your DocumentRoot point to the LXR root directory and grant universal access to it
    Alias /lxr /usr/local/share/lxr
    <Directory /usr/local/share/lxr>
       AllowOverride All
       Order allow,deny
       Allow from all
    </Directory>
    

    If you are strict on security, you may replace the AllowOverride directive by the less permissive directive

       AllowOverride FileInfo Limit Options
    
    • If you are running Apache version 2.x, some additional steps are needed.

        Add the following line:

        PerlRequire /usr/local/share/lxr/apache2-require.pl
        

        The according to the MPM type (as determined from with the following command):

        $ apachectl -V
        Server version: Apache/2.2.21 (Unix)Server MPM:     Prefork
      • If the Server MPM line reads Prefork:

        You normally do not need to edit apache2-require.pl. The following content is "universal":

        @INC= ( @INC
              , "."      # <- LXR root directory
              , "./lib", # <- LXR library directory
              );
        

        However, if you meet difficulties, you might need to use absolute paths to the directories where LXR and its library is installed. See below the content for Worker.

      • On the other hand, if you read Worker from the above command:
        $ apachectl -V
        Server version: Apache/2.2.21 (Unix)Server MPM:     Worker

        You can replace the PerlRequire line by the following line, but this is not mandatory (this line is a more fine-grained mod_perl version 2 directive to load the startup script):

        PerlPostConfigRequire /usr/local/share/lxr/apache2-require.pl
        

        and you must edit two files:

        • In apache2-require.pl, write all paths in OS-absolute forms

          i.e. for system-wide:

          @INC= ( @INC
                , "/usr/local/share/lxr"      # <- LXR root directory
                , "/usr/local/share/lxr/lib", # <- LXR library directory
                );
          

          or for private intallation:

          @INC= ( @INC
                , "/home/your_userid/lxr"      # <- LXR root directory
                , "/home/your_userid/lxr/lib", # <- LXR library directory
                );
          
        • In .htaccess-apache2

          replace the line

          PerlHandler ModPerl::RegistryPrefork
          

          by

          PerlHandler ModPerl::Registry
          

    Save the file in a safe place and copy it to /etc/httpd/conf.d/.

  • Some other configuration directives are already pre-packaged in provided files.

    You need to place them in the correct locations.

    • For Apache version 1.x
      $ cp .htaccess-apache1 .htaccess
      $ cp Local.pm  /usr/lib/perl5/site_perl/
      $ cp -r lib/LXR  /usr/lib/perl5/site_perl/
      
    • For Apache version 2.x
      $ cp .htaccess-apache2 .htaccess
      
  • In case you did not install mod_perl, LXR should work as CGI-scripts without modification.

    You only need to copy the following file:

    $ cp .htaccess_cgi .htaccess
    
  • In case you later encounter difficulties with SELinux (security alerts related to the LXR root directory)

    Scripts and their directories must be specifically labeled to identify them as executing code as a "normal" context. This is routinely done when they are located in /var/www/cgi-bin/. To eliminate alerts, the most reliable method is to clone /var/www/cgi-bin/ context with the following command:

    $ chcon --reference /var/www/cgi-bin -R LXR_root_directory/
    

Fire up your webbrowser and go to http://localhost/lxr/source. You should see the content of the directory of the default version for your tree.