LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 05-25-2010, 03:57 PM   #1
sweetie_lolz3
LQ Newbie
 
Registered: May 2010
Posts: 2

Rep: Reputation: 0
Unhappy Debian Apache2 rewriting subdirectory to root breaks accessing cgi scripts


OS: Debian 5.0.4
Server: Apache2

I've used mod_rewrite to rewrite my apache2 root (my.server.com/) to point to /var/www/drupal6/ instead of /var/www/. I also have a script installed in my cgi-bin (/usr/lib/cgi-bin) but since the rewrite I can't seem to access it. When I go to my.server.come/cgi-bin/test.pl, I get a page not found from my drupal.

Is there a way I can access my cgi-bin without resorting to accessing my drupal through my.server.com/drupal6/?

Background:
I have installed drupal CMS which has a base address of my.server.com/drupal6/ as it resided in /var/www/drupal6/. However I wanted users to be able to access it as my.server.com/ so I added the following into my httpd.conf
Code:
NameVirtualHost *:80

<Directory /var/www/drupal6>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
and created a Virtual Host in my sites-available (enabled through a2ensite knowpulse.usask.ca) as follows:
Code:
<VirtualHost *:80>
   ServerName knowpulse.usask.ca
   DocumentRoot /var/www/drupal6
        <Directory />
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, 
        # crit, alert, emerg.
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
</VirtualHost>
This appears to work as I can now access all my drupal pages using my.server.com/drupalpages.

What I've Tried:
1a. Adding a cgi-bin location directive to my virtualHost
Code:
#CGI Directory
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin
<Location /cgi-bin>
   Options +ExecCGI
</Location>
This gives me a Not Found from Apache
1b. Adding a cgi-bin directory directive to my virtualhost
(as per http://www.linuxquestions.org/questi...pache2-739485/)
Code:
#CGI Directory
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin
<Directory /cgi-bin>
   Options +ExecCGI
</Directory>
This gives me a Not Found from Apache
2. Adding a symbolic link to cgi-bin -> /usr/lib/cgi-bin in /var/www/drupal6/
Seems not to make a difference?
3. Adding a ScriptAlias line to my httpd.conf
Code:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin
I get a page not found from Apache as compared to drupal.
 
Old 05-25-2010, 04:02 PM   #2
sweetie_lolz3
LQ Newbie
 
Registered: May 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Also tried adding both directory and ScriptAlias to my httpd.conf
(again as per http://www.linuxquestions.org/questi...pache2-739485/)
Code:
NameVirtualHost *:80

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin
<Directory /usr/lib/cgi-bin/>
   Options +ExecCGI +SymLinksIfOwnerMatch
   AddHandler cgi-script .cgi .pl
</Directory>

<Directory /var/www/drupal6>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
With same results as with just ScriptAlias. ie: page not found from apache.
 
  


Reply

Tags
apache2, cgibin, drupal


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting up cgi scripts on apache2 jabberwok Linux - Server 18 07-14-2009 12:07 AM
Debian, apache2, CGI problem daviddutch1964 Linux - Networking 1 06-29-2007 03:19 PM
Apache2 on Debian won't execute perl cgi scripts, have tried chmod, Options ExecCGI dewert Linux - Software 1 07-03-2006 12:44 PM
Running .cgi and .pl scripts from any subdirectory in Apache b18b Linux - Networking 8 03-20-2006 02:43 PM
RH -> Debian migration breaks CGI script under Apache miggins Debian 1 09-02-2005 02:42 AM


All times are GMT -5. The time now is 11:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration