Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Apache Web Server

Thread Tools
 
Search this Thread
 
Old 04 December 2003, 10:39 AM
  #1  
boxst
Scooby Regular
Thread Starter
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Post

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.
Old 04 December 2003, 10:53 AM
  #2  
stevem2k
Scooby Regular
 
stevem2k's Avatar
 
Join Date: Sep 2001
Location: Kingston ( Surrey, not Jamaica )
Posts: 4,670
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 04 December 2003, 10:54 AM
  #3  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Your first port of call is the Apache error_log, startup errors will be in there.
Old 04 December 2003, 11:00 AM
  #4  
boxst
Scooby Regular
Thread Starter
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Post

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.
Old 04 December 2003, 11:04 AM
  #5  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Does that drectory exist? If it does, are you starting Apache as root?
Old 04 December 2003, 11:11 AM
  #6  
boxst
Scooby Regular
Thread Starter
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Post

Hello

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

Steve.
Old 04 December 2003, 11:23 AM
  #7  
stevem2k
Scooby Regular
 
stevem2k's Avatar
 
Join Date: Sep 2001
Location: Kingston ( Surrey, not Jamaica )
Posts: 4,670
Likes: 0
Received 0 Likes on 0 Posts
Post

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

Old 04 December 2003, 11:24 AM
  #8  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

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'
Old 04 December 2003, 11:39 AM
  #9  
boxst
Scooby Regular
Thread Starter
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Post

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.
Old 04 December 2003, 11:54 AM
  #10  
stevem2k
Scooby Regular
 
stevem2k's Avatar
 
Join Date: Sep 2001
Location: Kingston ( Surrey, not Jamaica )
Posts: 4,670
Likes: 0
Received 0 Likes on 0 Posts
Post

HTTPD_ROOT is set in conf.h source.

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

Steve
Old 04 December 2003, 11:55 AM
  #11  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

-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.
Old 04 December 2003, 02:40 PM
  #12  
ajm
Scooby Regular
 
ajm's Avatar
 
Join Date: Sep 2002
Location: The biosphere
Posts: 7,824
Likes: 0
Received 0 Likes on 0 Posts
Post

recompile it you lazy git!

[Edited by ajm - 12/4/2003 2:41:05 PM]
Old 04 December 2003, 11:12 PM
  #13  
boxst
Scooby Regular
Thread Starter
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Post

Hello

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

Thanks for your help,

Steve.
Old 05 December 2003, 12:08 AM
  #14  
stevem2k
Scooby Regular
 
stevem2k's Avatar
 
Join Date: Sep 2001
Location: Kingston ( Surrey, not Jamaica )
Posts: 4,670
Likes: 0
Received 0 Likes on 0 Posts
Post

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

Steve
Old 05 December 2003, 11:08 AM
  #15  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

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]
Old 05 December 2003, 11:24 AM
  #16  
boxst
Scooby Regular
Thread Starter
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Post

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.
Old 05 December 2003, 11:28 AM
  #17  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

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.
Old 05 December 2003, 11:51 AM
  #18  
boxst
Scooby Regular
Thread Starter
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Post

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.
Old 05 December 2003, 11:54 AM
  #19  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Great stuff, yup only root can bind to ports < 1024.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Rbon91
ScoobyNet General
49
21 November 2018 03:23 PM
Scott@ScoobySpares
Full Cars Breaking For Spares
55
05 August 2018 07:02 AM
south_scoob
ScoobyNet General
22
03 October 2015 01:05 PM
oilman
Trader Announcements
15
01 October 2015 11:55 AM
TimberTronics
Subaru
0
17 September 2015 08:46 PM



Quick Reply: Apache Web Server



All times are GMT +1. The time now is 06:10 PM.