httpd.conf Help!

EliteTim

Verified User
Joined
Dec 21, 2006
Messages
6
Hey All,
I am having a problem with file "httpd.conf" in my root. When I first tried to open it, it gave me permission denied, but I chmod it to 754. Then I opened it using ./httpd.conf and what I got is that:

Code:
./httpd.conf: line 1: ServerType: command not found
./httpd.conf: line 2: ServerRoot: command not found
./httpd.conf: line 3: LockFile: command not found
./httpd.conf: line 4: PidFile: command not found
./httpd.conf: line 5: ScoreBoardFile: command not found
./httpd.conf: line 6: ResourceConfig: command not found
./httpd.conf: line 7: AccessConfig: command not found
./httpd.conf: line 9: Timeout: command not found
./httpd.conf: line 10: KeepAlive: command not found
./httpd.conf: line 11: MaxKeepAliveRequests: command not found
./httpd.conf: line 12: KeepAliveTimeout: command not found
./httpd.conf: line 13: MinSpareServers: command not found
./httpd.conf: line 14: MaxSpareServers: command not found
./httpd.conf: line 15: StartServers: command not found
./httpd.conf: line 16: MaxClients: command not found
./httpd.conf: line 17: MaxRequestsPerChild: command not found
./httpd.conf: line 24: LoadModule: command not found
./httpd.conf: line 25: syntax error near unexpected token `newline'
./httpd.conf: line 25: `<IfDefine HAVE_BANDWIDTH>'

All my purpose for editing httpd.conf is to decrease the number of the threads and connections apache allows.

(Because my httpd is receiving a lot of pids)

Can anybody please give me hand in it? Maybe a little instructions or somthing?

Much appreciated....
 
EliteTim said:
Hey All,
I am having a problem with file "httpd.conf" in my root. When I first tried to open it, it gave me permission denied, but I chmod it to 754. Then I opened it using ./httpd.conf and what I got is that:
./httpd.conf is not the way to edit it. That attempts to execute it as a shell script. Try using something like vi or nano to edit the file.
 
If you have no idea how to edit file in command line, try to edit it via DA CP in the admin panel / file editor.

In command line mode you need text editor program to edit text file. like notepad in windows system you can not simply type readme.txt in dos prompt right?

And then you will suck with the editor command eg. how to escape from vi
try nano or pico first if it available.
 
To clarify a bit: by chmodding exim.conf to 754 what you've done is told the system it's an executable file. It's not.

By running it as ./httpd.conf you've attempted to run it.

It won't run because it's not designed to run; it has no valid commands in it.

Just what are you trying to do?

Jeff
 
I didn't chmoded exim.conf, I didn't touch it. I am trying to decrease the number of the threads and connections that apache allows from httpd.conf file, because there are a lot of pids running in my httpd, and which is slowing down the server. But still don't know how to do that exactly.

I opened httpd.conf with the file editor from the CP, but i am not sure which line/code shall i modify to decrease the number of threads and onnections that apache allows
 
Last edited:
Open httpd.conf with a file editor like vi, nano or even the editor in DA

The settings you probably want to change are:

Timeout 300
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 5
MinSpareServers 5
MaxSpareServers 20
StartServers 8
MaxClients 450
MaxRequestsPerChild 1000
 
Yea I see those lines, but I am not sure exactly which one of them to edit :)

I don't want to mess up the server if I changed somthing which I mustn't change :)
 
maybe try google.com ?
you can find everything there

for example:
MaxClients and Max/MinSpareServers

Apache has several statements to configure the number of clients being handled and the number of child-processes it forks off to deal with those requests. If the machine running the Apache installation is not intended for anything but running Apache, it is generally a good idea to make these numbers as high as possible, but not so high that the machine starts paging memory out to its swap space.
MaxClients

MaxClients limits the number of children Apache creates to handle requests, and because each child only accepts one connection at a time, the total number of concurrent connections. Setting this too low has a disastrous effect on performance. While all clients are busy handling connections, new connections will be put in the TCP queue and eventually timeout, while the machine itself will seem perfectly responsive and fast. It is generally a good idea to set MaxClients as high as the machine can handle in terms of memory. Setting it too high will cause the machine to swap needlessly, which effectively kills performance. If the machine can handle the number of processes in memory, but can't handle the sheer number of requests, it is often not useful to lower MaxClients. Instead, tuning Apache elsewhere, throttling one or more virtualhosts or simply sharing the load with more or bigger servers is the way to go.
MaxSpareServers and MinSpareServers

MaxSpareServers and MinSpareServers control how many spare (unused) child-processes Apache will keep alive while waiting for more requests to put them to use. Each child-process consumes resources, so having MaxSpareServers set too high can cause resource problems. On the other hand, if the number of unused servers drops below MinSpareServers, Apache will fork new child-processes (at a variable rate with a maximum of 32 forks per second) until MinSpareServers is satisfied. Forking a new child can be an relatively expensive operation, depending on the underlying operating system, and if a sudden burst of requests use up all the spare servers, the clients will be waiting for this. And new requests will pile up in the mean time.

The best values for these are highly system specific, and can change frequently even for specific sites. Fortunately it is usually not critical to get them exactly right. MinSpareServers should be a number high enough to satisfy sudden bursts of requests, to give Apache enough time to create new children. MaxSpareServers should be a number high enough to cover the normal fluctuation in numbers of requests, but not the daily fluctuations.
StartServers

StartServers controls the number of child-processes that Apache forks before starting to accept connections. If this number is lower than MinSpareServers, Apache will start forking off children while accepting connections, until the number of idle servers is at least MinSpareServers (but starts killing them off if the number exceeds MaxSpareServers.) It is a good idea to set StartServers to the minimum amount of servers you need active to start requests. When frequently restarting Apache during peak hours it might be prudent to raise this number to an average peak number, as killing off children while the server is not busy is less of a performance hit than creating children while busy.
 
I got your point roelp :)
But what do you recommend for:

Code:
Processor Name AMD Sempron(tm) Processor 3100+ 
Vendor ID AuthenticAMD 
Processor Speed (MHz) 1804.629 
Total Memory 2010700 kB 
Free Memory 23180 kB 
Total Swap Memory 2031608 kB 
Free Swap Memory 2031596 kB

How much should I set:
- Timeout (300)
- KeepAlive On
- MaxKeepAliveRequests (500)
- KeepAliveTimeout (5)
- MinSpareServers (5)
- MaxSpareServers (20)
- StartServers (8)
- MaxClients (450)
- MaxRequestsPerChild (1000)

() is the default values

My major purpose from modifying this file "httpd.conf" is to decrease the number of running pids in httpd so as to make the server faster, rather than it's running slow now
 
Last edited:
Server specs do nothing unless we know how busy your server is. What's the average outbound bandwidth?

Sure you can make apache use less resources but if it's using so much now that it slows the server, then making it use less resources is going to cause people to end up with connection problems when they try to use the sites.

We use the default values and have no problems. You can read up on how apache works and decide which changes to make, but if your server is overloaded then it is.

Jeff
 
That's why Jeff I am asking here, because as you said, I don't want to end up with connection problems and running slow server. Here are the needed Stats:

Server Stats
Bandwidth (meg) = 5937.9
Disk Space (meg) = 226.63
Load Average = 0.12, 0.09, 0.09

Usage Stats for eth0
Received = 1.7 GiB
Transmitted = 3.1 GiB

What do you think is the best performance for my server to edit in httpd.conf?
 
With a server load that low, I wouldn't touch a thing.

In general http is more important than email. Why? Because if email is delayed a second or two or three no one notices, but if an http request is delayed people get discouraged and browse somewhere else.

Jeff
 
Back
Top