Apache Tips Five

Source: Internet
Author: User
Tags http request modify domain domain name

1. How to make Apache listen on a specific port

Modify the httpd.conf inside the listen options, such as:

Listen 8000

is to make Apache listen on port 8000.

And if you want to specify both a listening port and a listening address, you can use:

Listen 192.170.2.1:80

Listen 192.170.2.5:8000

This allows Apache to simultaneously listen on the 192.170.2.1 80 port and the 192.170.2.5 8000 port.

Of course, you can also set in httpd.conf:

Port 80

This will achieve a similar effect.

How to limit the size of the message body of an HTTP request in 2.apache

Inside the httpd.conf set:

Limitrequestbody N

n is an integer and the unit is byte.

CGI scripts generally submit the contents of the form as the body of the message to the server for processing, so the size of the message body is now useful when using CGI. For example, use CGI to upload files if there are settings:

Limitrequestbody 102400

Then the upload file more than 100k time will be an error.

3. How to enable Apache to authenticate client domain

You can set it in httpd.conf:

Hostnamelookups on|off|double

If you are using on, then only a reverse search, if used double, then the reverse search after a positive resolution, only two of the results are consistent with each other, and off is not to verify the domain name.

It is recommended to use double for security purposes, and off is recommended for faster access.

4. How to set the duration of the session in Apache

In the apache1.2 version above, you can set the inside httpd.conf:

KeepAlive on

KeepAliveTimeout 15

This will limit the retention time of each session to 15 seconds. The use of session can make many requests can be sent through the same TCP connection, saving network resources and system resources.

5. How to make Apache monitor only in specific IP

Modify the httpd.conf and use it inside

Bindaddress 192.168.0.1

This allows Apache to only listen to external HTTP requests for 192.168.0.1. If you use:

Bindaddress *

Indicates that Apache listens for HTTP requests on all network interfaces.

Of course, with a firewall can also be achieved.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.