-   Linux - Software (
-   -   apache2 recompile with mod_rewrite -- without losing any of the current config! (

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!

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/

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

LoadModule rewrite_module modules/

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/ into server:
/home/httpd/modules/ 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. is nowhere to be found. However, looking at the source files, we do have:

rpcweb:~/Documents/httpd-2.0.55/modules # ls mappers

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_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D HTTPD_ROOT="/home/httpd"
-D SUEXEC_BIN="/home/httpd/bin/suexec"
-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

Thnx ...

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:

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

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


and restart apache

/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 04:49 AM.