LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-03-2003, 05:04 PM   #1
1jamie
LQ Newbie
 
Registered: Aug 2003
Location: NZ
Distribution: redhat 9
Posts: 15

Rep: Reputation: 0
Exclamation Running APACHE through XINETD


Hi folks your help with the following would be much appreciated.

I've got an apache server up and running grandly, but it is seldom used. I want to switch the service off and have it started up through xinetd.

I've done some scouting about on the web looking for the kinds of e.g. server arguments I would need to put into the xinetd.conf file but I'm not having much luck so far. I tried xined.org but they have information for services like telnet, ssh, ftp etc...but not, alas, apache.

This is what I've put in to the xinetd file so far, with no success, to try and run apache from it:

service httpd

{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/httpd
log_on_success += DURATION USERID
log_on_failure += USERID ATTEMPT RECORD
}

Appreciate your help.

jamie (NZ)
 
Old 09-03-2003, 05:21 PM   #2
dubman
Member
 
Registered: Jan 2003
Distribution: Redhat 9, Fedora Core 1, Suse 8
Posts: 188

Rep: Reputation: 30
can't you just disable the apache server (for boot) with "#chkconfig httpd off" and launch the service manually by "#service httpd start" when you need it?

Hope this helps...
--dubman
 
Old 09-03-2003, 08:22 PM   #3
1jamie
LQ Newbie
 
Registered: Aug 2003
Location: NZ
Distribution: redhat 9
Posts: 15

Original Poster
Rep: Reputation: 0
Hi Dubman thanks for your help. I want the service to be off most of the time, but when my website gets a visit I want xinetd to start it automatically so that people can get in to it. That would mean I wouldn't have to leave it on 24/7 and I also wouldn't have to start it manually everythime someone wanted to access it.

Here's a part of the output from the command:

netstat --inet --all

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:http *:* LISTEN

And similarly for the command:

lsof -i |grep LISTEN

X 822 root 1u IPv4 1328 TCP *:x11 (LISTEN)
xinetd 1094 root 5u IPv4 7685 TCP *:ssh (LISTEN)
xinetd 1094 root 6u IPv4 7686 TCP *:http (LISTEN)

But when I try to access the webserver through a browser I get:

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

Any ideas?
 
Old 09-04-2003, 05:17 PM   #4
dubman
Member
 
Registered: Jan 2003
Distribution: Redhat 9, Fedora Core 1, Suse 8
Posts: 188

Rep: Reputation: 30
well, I dont think that is possible. If you want someone to be able to access your web server, port 80 will always need to be listening, which is what happens when you turn on the httpd service (apache). With that service disabled, port 80 will fail to respond and web traffic will get denied. I dont think there is a dynamic way to do what you need. Why don't you just leave apache running 24/7? If you are worried about security I would look into IPTables or perhaps setting up a DMZ. By design, when you host a web sever, security is much more lax.
 
Old 09-04-2003, 07:25 PM   #5
bastard23
Member
 
Registered: Mar 2003
Distribution: Debian
Posts: 275

Rep: Reputation: 30
1jamie

For apache 1.3, you need to set "ServerType inetd" from "standalone" in httpd.conf. The error is happening because apache is trying to bind port 80, which is already taken by xinetd. You should be able to change the user to "nobody" or whatever group that you want (preferable as a user that doesn't login). Apache only needs root to bind port 80 (I think, so experiment).

Actually, if you look at this apache page, it seems that 2.0 doesn't support inetd at all any more.

But, I agree with dubman. There really isn't any point to using xinetd for apache, except for access control. But apache already has good configuration for that. It also logs decently. You already have a complex setup with apache, why not use it?

Good Luck,
chris
 
Old 09-08-2003, 07:54 PM   #6
1jamie
LQ Newbie
 
Registered: Aug 2003
Location: NZ
Distribution: redhat 9
Posts: 15

Original Poster
Rep: Reputation: 0
Hi bastard23 thanks for your input! Your advice worked like a charm - I put the line ServerType inetd into http.conf and sure enough, xinetd starts the http service every time my server gets a (infrequent) call.

Thanks heaps

jamie (NZ)
 
Old 01-13-2007, 10:40 PM   #7
rhlnewbie
Member
 
Registered: Jan 2007
Posts: 39

Rep: Reputation: 15
servertype

I am having the exact same problem with apache and Idon't think I fixedthe httpd.conf file correctly. In fact the servertype line is not there.if possible could one of you post your httpd.conf file? or email it to me?
thanks for your help.
miles
P.S. I have redhat linux 9. from th shrike iso cd images. if that makes sense

Last edited by rhlnewbie; 01-13-2007 at 10:44 PM.
 
Old 01-14-2007, 04:05 PM   #8
1jamie
LQ Newbie
 
Registered: Aug 2003
Location: NZ
Distribution: redhat 9
Posts: 15

Original Poster
Rep: Reputation: 0
Have you tried to run your apache server not through xinetd? I would try that first. Also, do you need to run it from xinetd? I actually don't use this option anymore. There isn't a lot of benefit from it.

Jamie
 
Old 11-13-2009, 02:55 PM   #9
stevepalmateer
LQ Newbie
 
Registered: May 2009
Posts: 2

Rep: Reputation: 0
httpd.conf

Hello.

after all these years, I still want to use xinetd to start my httpd service.

Due to memory restrictions, I cannot have httpd running 24/7.

I've configured xinetd.conf with the appropriate service httpd { } lines...but httpd.conf does not have ServerType = standalone.

should I simply add ServerType = xinetd
???

I appreciate your help Jamie.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I querry services running within xinetd ? saneax Linux - Software 3 01-13-2007 10:49 PM
How do I know, which services within xinetd are running saneax Linux - Newbie 4 08-11-2004 07:47 AM
XINETD not running polo76 Linux - Newbie 0 09-08-2003 06:47 AM
Xinetd Running Amok - RH 8 RWild Linux - Networking 2 02-23-2003 01:48 PM
running samba worked, running it out of xinetd doesn't? system Linux - Networking 1 12-24-2001 03:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration