Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configuration skills of Apache

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "Apache configuration skills". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. How to set the request waiting time

Set it in httpd.conf:

TimeOut n

Where n is an integer and the unit is seconds.

Setting this TimeOut applies to three situations:

2. The total time it takes to receive an get request

The time between TCP packets that receive a post and put request

Response (ack) interval in TCP packet transmission

3. How to make apache listen on a specific port

Modify the options for Listen in httpd.conf, for example:

Listen 8000

Is to make apache listen on port 8000

If you want to specify both the listening port and the listening address, you can use:

Listen 192.170.2.1:80

Listen 192.170.2.5:8000

This allows apache to listen on port 80 at 192.170.2.1 and port 8000 at 192.170.2.5.

4. How to set the maximum number of idle processes for apache

Modify the httpd.conf and set it in it:

MaxSpareServers n

Where n is an integer. In this way, when the idle process exceeds n, the Apache main process will kill the redundant idle process and keep the idle process at n, saving system resources. It is necessary to adjust this parameter at a site where apache is very busy, but it is not a good idea to set this parameter to most at any time.

You can also set:

MinSpareServers n

To limit the minimum number of idle processes to speed up the response.

5. How to set the number of sub-service processes at startup by apache

Set it in httpd.conf:

StartServers 5

After starting apache, there are five idle child processes waiting to accept the request.

You can also refer to MinSpareServers and MaxSpareServers settings.

6. How to set the maximum number of requests per connection in apache

Set it in httpd.conf:

MaxKeepAliveRequests 100

This ensures that in a connection, if the number of simultaneous requests reaches 100, the new request for the connection will not be responded to, and that the system resources will not be heavily occupied by a connection. However, in the actual configuration, it is required to increase this value as much as possible to obtain higher system performance.

7. How to set the duration of session in apache

In versions above apache1.2, you can set it in httpd.conf:

KeepAlive on

KeepAliveTimeout 15

This limits the hold time of each session to 15 seconds. The use of session enables many requests to be sent through the same tcp connection, saving network resources and system resources.

8. How to make apache verify the domain name of the client?

You can set it in httpd.conf:

HostnameLookups on | off | double

If you use on, you can only do a reverse check, and if you use double, then you will have to do a forward resolution after the reverse check, and only two results match each other, while off does not perform domain name verification.

For security, it is recommended to use double; to speed up access, it is recommended to use off.

9. How to make apache listen only in a specific ip

Modify httpd.conf to use in it

BindAddress 192.168.0.1

This allows apache to listen only for external http requests to 192.168.0.1. If you use:

BindAddress *

This indicates that apache listens for http requests on all network interfaces.

Of course, it can also be achieved with a firewall.

This is the end of the content of "Apache configuration skills". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report