ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   Apache Web Server (https://www.scoobynet.com/computer-and-technology-related-34/278302-apache-web-server.html)

boxst 04 December 2003 10:39 AM

Hello

Does anyone know anything about Apache on Solaris?

I naively assumed that if I copied the apache directory to another place, changed httpd.conf then everything would work fine. But it appears to have a hard coded reference somewhere to the original directory.

Any suggestions?

Thanks,

Steve.

stevem2k 04 December 2003 10:53 AM

Should just be a copy over. Where are you getting the problem - on startup or in operation ? have you checked the apachectl script for amended paths etc ?

We generally install to /path/apache-version and symlink back to /path/apache .


Steve

stevencotton 04 December 2003 10:54 AM

Your first port of call is the Apache error_log, startup errors will be in there.

boxst 04 December 2003 11:00 AM

Hello

Thanks for your replies.

apachectl points to the correct directory, I get the error when I am trying to start up apache. The error_log file is pointing to the old directory. To which this user (obviously) doesn't have permission.

-=-=-=
I get the error:


fopen: Permission denied
httpd: could not open error log file /olddirectory/error_log.
apachectl start: httpd could not be started

-=-=-=


Steve.

stevencotton 04 December 2003 11:04 AM

Does that drectory exist? If it does, are you starting Apache as root?

boxst 04 December 2003 11:11 AM

Hello

The old directory still exists, but this new instance of Apache shouldn't be pointing to any files there....

Steve.

stevem2k 04 December 2003 11:23 AM

you have re-checked httpd.conf haven't you - that's where ErrorLog location is specified.


stevencotton 04 December 2003 11:24 AM

Have you made the modifications to the httpd.conf and made sure Apache is using the right config file? You can see the hard-coded locations by running 'httpd -V', look for the SERVER_CONFIG_FILE line. You can point Apache to another config file with 'httpd -f /path/to/httpd.conf'

boxst 04 December 2003 11:39 AM

Hello

Again, thanks for the replies.

Having run httpd -V, the problem is that HTTPD_ROOT points to the old apache installation directory. How can I change this? It appears to be compiled in?

Thanks,

Steve.

stevem2k 04 December 2003 11:54 AM

HTTPD_ROOT is set in conf.h source.

You may be able to avoid a recompile with httpd -f /path/to/httpd.conf

Steve

stevencotton 04 December 2003 11:55 AM

-f changes the location of httpd.conf, if you want to change SERVER_ROOT you pass it the new server root directory with the -d flag.

ajm 04 December 2003 02:40 PM

recompile it you lazy git! ;)

[Edited by ajm - 12/4/2003 2:41:05 PM]

boxst 04 December 2003 11:12 PM

Hello

Can't be done unfortunately. A recompile is the only option. Now to find the C++ compiler!

Thanks for your help,

Steve.

stevem2k 05 December 2003 12:08 AM

http://www.sunfreeware.com gcc3.3.2

Steve

stevencotton 05 December 2003 11:08 AM

Sorry, it _can_ be done :) You do not need to recompile Apache just to change the location of the executable and configuration :)

Edit: here's how!

You're probably using apachectl to start/stop Apache - apachectl is purely a wrapper around the httpd binary. That's what's in your rc.whatever directory right? You just need to change that to use httpd instead of apachectl. You can start just by running the httpd with command line parameters to the new location of the httpd.conf ('httpd -f /path/to/httpd.conf'), and inside there you specify your ServerRoot et al so no need to put anything else on the command line.

Your location to httpd.pid may be different:

'apachectl start' is the same as '/usr/local/wherever/httpd -f /path/to/new/httpd.conf'

'apachectl startssl' is the same as 'httpd -D SSL' or, to include the new location of the httpd.conf, 'httpd -f /path/to/new/httpd.conf -D SSL'

'apachectl stop' is the same as 'kill `cat /var/run/httpd.pid`'

'apachectl configtest' is equivalent to 'httpd -f /path/to/new/httpd.conf -t'.

'apachectl graceful' is the same as 'kill -USR1 `cat /var/run/httpd.pid`'

'apachectl restart' is the same as 'kill -HUP `cat /var/run/httpd.pid`'

It's as simple as that :)

Steve.


[Edited by stevencotton - 12/5/2003 11:22:00 AM]

boxst 05 December 2003 11:24 AM

Okay Mr. Cotton,

How?!

Here are my compiled in variables:

-=-=-

httpd -V

Server compiled with....
-D HAVE_MMAP
-D USE_MMAP_SCOREBOARD
-D USE_MMAP_FILES
-D USE_FCNTL_SERIALIZED_ACCEPT
-D HTTPD_ROOT="/bvu/bvportal/apache"
-D SUEXEC_BIN="/bvu/bvportal/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/httpd.scoreboard"
-D DEFAULT_LOCKFILE="logs/httpd.lock"
-D DEFAULT_XFERLOG="logs/access_log"
-D DEFAULT_ERRORLOG="logs/error_log"
-D TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
-D ACCESS_CONFIG_FILE="conf/access.conf"
-D RESOURCE_CONFIG_FILE="conf/srm.conf"
-=-=-

So the problem is that when I try to start Apache, it is trying to open the log file in the wrong location.

Steve.

stevencotton 05 December 2003 11:28 AM

Yup - your problem is apachectl is using the defaults. Bypass apachectl and make calls to httpd directly instead, passing your new httpd.conf location. If you want to, write a script called apachectl which wrappers httpd so you can still use it using the template in my post above.

boxst 05 December 2003 11:51 AM

Hello

Okay, that worked:

httpd -f /mydir/conf/httpd.conf -d /mydir

Although I can only do this as root, as I want it to bind to port 80.

Thanks for your help.

Steve.

stevencotton 05 December 2003 11:54 AM

Great stuff, yup only root can bind to ports < 1024.


All times are GMT +1. The time now is 05:02 PM.


© 2024 MH Sub I, LLC dba Internet Brands