LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   apache2 recompile with mod_rewrite -- without losing any of the current config! (http://www.linuxquestions.org/questions/linux-software-2/apache2-recompile-with-mod_rewrite-without-losing-any-of-the-current-config-468420/)

scabrous1 07-27-2006 11:56 PM

apache2 recompile with mod_rewrite -- without losing any of the current config!
 
Here is the deal.

On a sles9 server I have apache 2 compiled but am
not using the stuff from yast ... compiled our own. But, it's scary,
cuz we don't really know what we are doing, and this is going to be a real, genuine, the public face of the business web server! Yikes!
Gulp!

Anyway ... the developers have asked that we enable/re-compile apache to include mod_rewrite functionality. So I need to figure out how to add that in, without modifying anything else about how apache is configured.

I thought maybe I would not have to re-compile, since doesn't apache2 use modules, so that you don't have to recomplile anytimg you add something? Anyway, I found in the httpd.conf file that the load line was present, but appeared to be incomplete:

LoadModule modules/mod_rewrite.so

So I googled, and found that others who use mod_rewrite, the load
modules line looks like this:

LoadModule rewrite_module modules/mod_rewrite.so

So I added that, and tried to restart apache. I get this report, when trying to stop it:

rpcweb:/home/httpd/bin # ./apachectl stop
[Thu Jul 27 22:31:40 2006] [warn] module php5_module is already loaded, skipping
Syntax error on line 234 of /home/httpd/conf/httpd.conf:
Cannot load /home/httpd/modules/mod_rewrite.so into server:
/home/httpd/modules/mod_rewrite.so: cannot open shared object file: No such file or directory
rpcweb:/home/httpd/bin #

this tells me that mod_rewrite may not actually be present, so doing a find, I confirm this. mod_rewrite.so is nowhere to be found. However, looking at the source files, we do have:

rpcweb:~/Documents/httpd-2.0.55/modules # ls mappers
mod_rewrite.c
mod_rewrite.dsp
mod_rewrite.exp
mod_rewrite.h

So, I guess we need to re-compile this baby, so that the above files
get turned into an .so file, correct?

Anyway, it was a long time ago that I originally compiled it, and (of course) I cannot find my notes regarding the compile options I used. It looks as though apachectl -V gives some good info, though:

rpcweb:/home/httpd/bin # ./apachectl -V
Server version: Apache/2.0.55
Server built: Feb 9 2006 13:38:43
Server's Module Magic Number: 20020903:11
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/home/httpd"
-D SUEXEC_BIN="/home/httpd/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
rpcweb:/home/httpd/bin #

so, given the above, and knowing that we want everything to be exactly as it is now, with the addition of mod_rewrite:

what do I have to do to accomplish this? How do figure out what
compile options to specify in order to ADD mod_rewrite, but not modify anything else?

lol! If anyone has a quick suggestion, so that I don't have to spend
my weekend labbing various compile scenarios, it would be MUCH
appreciated!


Thnx ...
scabrous

ctb123 07-28-2006 05:56 PM

We use the rpm package on our server but if your config files are set up like mine you would:
open
Code:

vi /etc/sysconfig/apache2
find the line that looks like:
Code:

APACHE_MODULES="suexec access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif userdir ssl php4"
and add rewrite between the quotes

run
Code:

SuSEconfig
and restart apache
Code:

/etc/init.d/apache2 force-reload
you can check it by making a php script with
PHP Code:

<? phpinfo(); ?>

and verifying it's under LoadedModules


All times are GMT -5. The time now is 05:29 AM.