Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mod_rewrite problem - unable to restart apache web server

Posted on 2004-04-23
13
Medium Priority
?
849 Views
Last Modified: 2010-03-04
Hi experts,

I have apache_2.0.43 on solaris 8 machine. I tried to configure httpd.conf to set 'Authorization' http header as environment variable as following:

#####################################
LoadModule rewrite_module modules/mod_rewrite.so
 
<Directory "/www/httpd/apache_2.0.43/pcgi">
 RewriteEngine on
 RewriteCond %{HTTP:Authorization} (.*)
 RewriteRule .* - [E=HTTP_AUTHORIZATION:%1]
</Directory>
#####################################

I couldn't restart the Apache because it couldn't find mod_rewrite.so
Please let me know where can I find this module in apache directories. How can I check the list of modules currently loaded on the web server.

Thanks,
Rakesh.
0
Comment
Question by:rakmohan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +1
13 Comments
 
LVL 2

Accepted Solution

by:
apdtech earned 1200 total points
ID: 10902983
Look in your $APACHE_HOME/modules directory
you should see a mod_rewrite.so

If not, it was not compiled in, to do so you need to do for example:

bash-2.05$ ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite=shared
bash-2.05$ make
bash-2.05# make install

to check which modules you have installed already to to:

http://www.yourserver.com/server-info on a browser as well as lookin in the $APACHE_HOME/modules directory toi see what exists.
0
 

Author Comment

by:rakmohan
ID: 10903879
I didn't see any .so file in modules directory except httpd.exp. But I got the list of modules using 'httpd -l' and mod_rewrite.so was not there. I will try to recompile apache and test this module on Monday.

Thanks,
Rakesh.
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10905734
You should have actually 2 lines in your httpd.conf:

LoadModule rewrite_module     /usr/lib/apache/mod_rewrite.so
AddModule mod_rewrite.c
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 2

Expert Comment

by:apdtech
ID: 10909096
httpd -l will only show you modules built statically i believe.  I run apache 2.0.49 on Solaris 9, with mod_rewrite installed:
---------------
/usr/local/apache/bin#httpd -l
Compiled in modules:
  core.c
  mod_access.c
  mod_auth.c
  mod_include.c
  mod_log_config.c
  mod_env.c
  mod_setenvif.c
  mod_ssl.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_info.c
  mod_negotiation.c
  mod_dir.c
  mod_imap.c
  mod_actions.c
  mod_so.c
---------------
is what i get when I run httpd -l, now I have mod_rewrite installed, in my httpd.conf I only have:
---------------
LoadModule rewrite_module           modules/mod_rewrite.so
---------------

From the documentation:
(http://httpd.apache.org/docs-2.0/programs/httpd.html)
"-l
Output a list of modules compiled into the server. This will not list dynamically loaded modules included using the LoadModule directive."  

AddModule is only used if the user wants to re-order the prioritzation of his modules and is using the ClearModule feature.

By default, this is not a required option for modules on apache.
0
 
LVL 2

Expert Comment

by:apdtech
ID: 10909107
Also, did you LOOK for the module mod_rewrite.so on your server? the physical file? yoou are running linux, you most likely ahve locate installed - do "locate mod_rewrite.so" if you dont have your locatedb done, run first updatedb as root.  then execute the locate command.   If you dont have locate/updatedb installed, that is ok, it is a gnu find utility for making life easier when seaching your computer.  

But you should first look to see if the module is already built and installed, you just may be not using it.
0
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10911537
0
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10911554
0
 

Author Comment

by:rakmohan
ID: 10964249
Hi,

I am getting 'Access denied (error code 403)' for my web pages when I compiled apache (2.0.43) as following:
############################
bash-2.05$ ./configure --prefix=/usr/local/apache2 --enable-so --enable-module=rewrite --enable-rewrite=shared
bash-2.05$ make
bash-2.05# make install
############################

and added these lines in httpd.conf:

############################
<Directory "/www/httpd/apache_2.0.43/pcgi">
  RewriteEngine on
  RewriteCond %{HTTP:Authorization} (.*)
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%1]
</Directory>
############################

httpd.conf has following statements after above mentioned statements:

############################
<Directory "/www/httpd/apache_2.0.43/pcgi">
    AllowOverride All
    Options None
    Order allow,deny
    Allow from all
</Directory>
############################

My web pages under '/www/httpd/apache_2.0.43/pcgi' directory works fine when I comment these statements:
############################
#<Directory "/www/httpd/apache_2.0.43/pcgi">
#  RewriteEngine on
#  RewriteCond %{HTTP:Authorization} (.*)
#  RewriteRule .* - [E=HTTP_AUTHORIZATION:%1]
#</Directory>
############################

Please help me to reolve this problem.

My httpd.conf already has the following statement after installation:
LoadModule rewrite_module modules/mod_rewrite.so

Thanks,
Rakesh.
0
 
LVL 10

Assisted Solution

by:Mercantilum
Mercantilum earned 800 total points
ID: 10965566
You want to pass the mime auth information to your cgi through the var http_authorization.
A few ideas

1. just in case, use a different variable name e.g. MY_HTTP_AUTHORIZATION that you will use in your cgi

2. Log the rewriting process, add these lines to your httpd.conf

RewriteLog "/var/log/httpd/rewrite.log"
RewriteLogLevel 3

try again, then  have a look into /var/log/httpd/rewrite.log

3. Look at the error_log as well, there could be some relevant information
0
 

Author Comment

by:rakmohan
ID: 10998280
Where should I keep rewrite statements - httpd.conf or .htaccess? Currently, it is in httpd.conf and giving 403 error.

Thanks,
Rakesh.
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10998308
.htaccess is to be used for a particular directory - you can try as  well ...

Did you check the error_log ?
Did you try the rewrite_log ?
Did you try to use a different variable MY... ?
0
 

Author Comment

by:rakmohan
ID: 11000481
I tried all three suggestions. I am getting following error in error_log:

###################################
[Wed May 05 15:15:44 2004] [error] [client 128.107.155.203] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /www/httpd/apache_2.0.43/pcgi/btools/proto/auth.cgi
###################################

rewrite.log is empty.
0
 

Author Comment

by:rakmohan
ID: 11000767
I solved the 403 error, when I added 'Options FollowSymLinks' for the required directory.

Many thanks,
Rakesh.
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question