viewing the code - apache server & ubuntu

Help
kernelony
2012-07-14
2013-01-02
  • kernelony
    kernelony
    2012-07-14

    Hey,

    I've read prior topics but didn't find what I needed:
    Followed the installation steps of LXR 11 carefully, got exactly the correct output in every step, but I got stuck in the last step - viewing the code with the web browser (I get a 'Not Found' message).

    It's probably a problem with the apache:
    I'm using apache2, with libapache2-mod-perl2. Because it's Ubuntu, there is no 'httpd' library under /etc, so I copied apache-lxrserver.conf  to /etc/apache2/conf.d instead.

    Still, I get nothing. What can it be?   
    Please help, I've been trying to install it for two weeks now and it seems like a great tool…

    Here are the details regarding my configuration:
    * Ubuntu
    * mysql
    * glimpse
    * apache2
    * exuberant ctags 5.9
    * perl 5.12
    * browser: FireFox

     
  • Andre-Littoz
    Andre-Littoz
    2012-07-14

    Hello,

    I'm away still for some time. As soon as I'm back (about end of next week), I'll work on your problem. Meanwhile, can you be more precise on your "not found" message? Is this an HTML "standard" 404-not found? Or the infamous "directory/file xxx does not exist"?

    Regards,
    ajl

     
  • kernelony
    kernelony
    2012-07-15

    Hey,

    Thank you for the quick reply!

    I've added two outputs below - one showing the browser message, and the other showing the output of the 'genxref' command (might  also help somehow ).
    For the purpose of checking the installaion I've placed a c file named try1.c,  in the path: /home/ido/lxrsource/v4, which is the source root folder for indexing.

    Hope that helps,
    Thanks again.

    browser output:
    (after inputing http://hostname/lxr  or http://127.0.0.1/lxr or similar combinations including the source directory or an explicit path.  By the way, 'localhost' and '127.0.0.1'  by themselves worked):


    Not Found

    The requested URL /lxr was not found on this server.
    Apache/2.2.20 (Ubuntu) Server at localhost Port 80


    genxref  command output::


    ido@ido-bizo:/usr/local/share/lxr$ sudo ./genxref -url=http://localhost/lxr -version=v4
    password for ido:
    Checking Perl version … 5.12.4  OK
    Checking ctags version … 5.9  OK
    Checking glimpse version … 4.18.5
    Checking glimpseindex version … 4.18.5
    Parameter 'swishbin' not defined - trying to find swish-e
    swish-e not found, `which swish-e` returned a null string

    This is glimpseindex version 4.18.5, 2006.

    Indexing "/home/ido/lxrsource/v4" …

    Size of files being indexed = 70 B, Total #of files = 1

    Index-directory: "/home/ido/glimpse/v4"
    Glimpse-files created here:
    -rw-r-r- 1 root root     32 2012-07-15 11:25 .glimpse_filenames
    -rw-r-r- 1 root root      4 2012-07-15 11:25 .glimpse_filenames_index
    -rw-r-r- 1 root root      0 2012-07-15 11:25 .glimpse_filetimes
    -rw----- 1 root root    115 2012-07-15 11:25 .glimpse_index
    -rw-r-r- 1 root root    116 2012-07-15 11:25 .glimpse_messages
    -rw----- 1 root root     22 2012-07-15 11:25 .glimpse_partitions
    -rw-r-r- 1 root root    374 2012-07-15 11:25 .glimpse_statistics
    -rw-r-r- 1 root root 262144 2012-07-15 11:25 .glimpse_turbo
    *** / v4
    *** /try1.c v4
    -- /try1.c v4 1336509123-70
    /try1.c was already indexed
    commit ineffective with AutoCommit enabled at lib/LXR/Index/Mysql.pm line 385.
    ### / v4
    ### /try1.c v4
    -- /try1.c v4 1336509123-70
    /try1.c was already referenced


     
  • Andre-Littoz
    Andre-Littoz
    2012-07-15

    Hi,

    http://localhost/lxr does not trigger LXR execution: it only requests some "index.html" located in the DocumentRoot directory associated with URL //localhost/lxr but there is none in the LXR directory. To launch LXR you must reference one of its scripts as in:

    //localhost/lxr/source
    

    which should list the content of your source directory.

    If it still does not work, the problem is related with Apache configuration. You can check this configuration with command:

    apachectl -S
    

    ("apachectl" is Fedora command; it might be "apache" or "apache2" under Ubuntu).

    This command lists the known hosts and the configuration file and line number like the following line on my computer:

             port 80 namevhost lxr (/etc/httpd/conf.d/PatT20-httpd.conf:66)
    Syntax OK
    

    If it does not read "syntax OK", double check the configuration file.

    Regards,
    ajl

     
  • kernelony
    kernelony
    2012-07-16

    Hey,

    Thanks again for answering, it's highly appreciated.  I hope I'm not taking too much of your time.
    I did try the URL you posted before (with /source) , but it didn't work.  Also, when I used this command (in Ubuntu it is 'apache2ctl -t -D DUMP_VHOSTS' ), I didn't see any line containing lxr, just the default site (000-defaulte).
    When I inspected the directory contents of apache2 - /etc/apache2, I noticed two directories named 'sites-available' and 'sites-enabled'. They both contain only the default site, which leads the browser to html file containing the "IT WORKS!" message you see when you type the 'localhost' URL.  shouldn't there be an extra site there, reffering to lxr?
    Is copying the file apache-lxrserver.conf to   /etc/apache2/conf.d    the only thing needed?   where are the script lines responsible for adding  lxr vhost ?

    I double checked the configuration file,  seems OK.  I would have included it here but it gets all messy and disordered when I try to copy it.

    Thanks.

     
  • Andre-Littoz
    Andre-Littoz
    2012-07-16

    Hello,

    I'm not familiar with Ubuntu. In Fedora, the master Apache configuration file "httpd.conf" contains directive

    Include conf.d/*.conf
    

    (about 25% into the file) which allows to include other configuration files with cumulative effect from directory conf.d/ in /etc/httpd/. Consequently, all is needed is to copy "apache-lxrserver.conf" there. The file contains the virtual host definition for lxr.

    Look into the Ubuntu master Apache configuration file for the above "Include" directive to check the name of the "secondary" config directory. See if it points to "sites-available" or "sites-enabled". Anyway try to find some documentation about the role of these directories and the way to configure them.

    If there is some non trivial trick to get it working, please give me feedback so that I add a specific Ubuntu page on the site.

    Regards,
    ajl

    PS I'll be on the road for the next two days without possibility to connect to the Net.

     
  • kernelony
    kernelony
    2012-07-18

    Hi Andre,

    It turns out this scheme is similar in Ubuntu: although the httpd.conf in Ubuntu is an empty file, there\'s another file called apache.conf, which is the main configuration file, and it includes conf files from the directory conf.d (with a similar line). So it SHOULD work here as well.
    In order to isolate the problem, I tried installing LXR on a CentOS distro, which is Red Hat based and has exactly the same directory hierarchy as what you described (httpd etc…) - but I\'ve encountered the exact same problem - everything works until I use the browser. Again, using the apachectl command and see only the default site (with https this time):


    VirtualHost configuration:
    wildcard NameVirtualHosts and _default_ servers:
    _default_:443          localhost.localdomain (/etc/httpd/conf.d/ssl.conf:81)
    Syntax OK



    So, now I'm almost sure there really is a problem with my lxr.conf file…

    I can't post it here cause the system detects is as a SPAM :-), so I sent it to you via a message.
    When you have some time I'll be very glad if you take a brief look at at (only when you have time :-)  )

    Thanks.

     
  • Andre-Littoz
    Andre-Littoz
    2012-07-19

    Hi,

    Your lxr.conf looks correct, but for a little thing which is not relevant at this point: you kept the default value for parameter 'glimpsedir' (in the Data Storage Subsection - the last subsection) which is likely to be a non-existent path. It will matter later when LXR is operational.

    Since your Apache seems to be configured for https, you should list this scheme in parameter 'host_names'. to play it safe, add the following line:

    , 'https://localhost'
    

    and the like for localhost.localdomain and 127.0.0.1 so that you can access the LXR server both under http and https.

    This does not solve the "not found" issue, but it will help later: LXR is passed the full URL and uses the first part (up to the script name) to determine which tree should be served. This part contains the port number (:80 or :443 for the common cases). I wonder if I should get rid of this historical test and ignore the port number.

    A possible cause of your problem could be a discrepancy betwwen Apache and LXR configurations. Your lxr.conf is single-tree'd. You use the "standard" //localhost/lxr URL (meaning you have no virtual host). In apache-lxrserver.conf, you need an Alias directive to associate /xr with your LXR root directory.

    Check apache-lxrserver.conf to see if the AliasMatch directive (needed in multiple trees context) is commented out and the Alias directive is active (i.e. not commented).

    Regards,
    ajl

     
  • kernelony
    kernelony
    2012-07-19

    Hi,

    I did try creating a folder named glimpse and giving its full path (but, as you said, it made no difference at that stage so I was yet to add it this time).
    The apache-lxrserver.conf is correct,  Alias is active, AliasMatch is commented out.
    So, if I'm not mistaken, the fact I'm using a single tree'd configuration means I SHOULD see only one line stating the default host, right?

    I'll have my co-workers look at it as well. I'll keep you posted if there's any progress (matter of weeks, because there's a long vacation).

    Anyways, thanks, it's good to see the LXR developers support the users.

    P.S.  note that with the CentOS, the genexref script didn't find glimpse (or swish-e) at the beginning, although they were installed.  The output stated that 'which glimpse returned a NULL string', when which glimpse actually returned /usr/local/bin/glimpse.
    I think issuing this command from within the script caused it to search only in /usr/bin. So I moved glimpse and glimpseindex to /usr/bin and then It found glimpse (I removed swish-e, of course).

    Cheers,
    Kernelony

     
  • Andre-Littoz
    Andre-Littoz
    2012-07-19

    So, if I'm not mistaken, the fact I'm using a single tree'd configuration means I SHOULD see only one line stating the default host, right?

    It is not that simplistic, but roughly yes when you are under the "standard" configuration.

    I did not want to get you confused, so I did not enter into details. Really, "I" got confused because I did not think twice when comparing my configuration and yours (since mine has worked for a long time, I don't remember all its pecularities, for instance I separated my localhost server from the LXR server, which is a virtual host).

    There is a dedicated chapter on possible web server configurations in the user's manual you can download from Sourceforge. Things become really tricky under multiple trees context with a single instance of LXR scripts. This is where you need the AliasMatch directive and the 'treeextract' parameter.

    The output stated that 'which glimpse returned a NULL string', when which glimpse actually returned /usr/local/bin/glimpse. I think issuing this command from within the script caused it to search only in /usr/bin.
    

    My glimpse is also in /usr/local/bin and the command returns the correct location. If you have time, try replacing the lines

    $toolloc = `which glimpse 2>/dev/null`
    

    by

    $toolloc = command -v glimpse`
    

    in genxref. This is a recent suggestion by a user. "command" is an internal bash command whereas "which" is an external utility. This user argued "which" might not be up-to-date.

    Regards and enjoy your holiday,
    ajl