How to hide Nginx, Apache, and PHP versions

Source: Internet
Author: User
This article mainly introduces how to hide Nginx, Apache, and PHP versions to prevent targeted vulnerability attacks. For more information, see when hackers intrude into a server, first, click "Step On". Here "Step On" refers to understanding the details of some services running on the server, such as the version number. after hackers know the version number of the service, we can find some vulnerabilities in the corresponding version of the service to intrude and attack, so we need to hide these versions to avoid unnecessary problems.

Let's test it.

insoz:~ insoz$ curl -I http://127.0.0.1/phpinfo.phpHTTP/1.1 200 OKServer: nginx/1.5.0Date: Thu, 18 Jun 2015 02:39:32 GMTContent-Type: text/htmlConnection: keep-aliveVary: Accept-EncodingX-Powered-By: PHP/5.3.1

We can see that the nginx and php versions of our servers are exposed. let's look at the hidden methods.

First, let's look at how to hide the version number in nginx:
Add the following code to the nginx. conf configuration file:

server_tokens off;

How to hide the version number in apache:
Add the following code to the apache configuration file httpd. conf:

ServerTokens ProdServerSignature Off

Let's take a look at how to hide the version number in php:
Add the following code to the php configuration file php. ini:

expose_php = Off

Okay. after modification, restart the service. let's test it again:

insoz:~ insoz$ curl -I http://127.0.0.1//phpinfo.phpHTTP/1.1 200 OKServer: nginxDate: Thu, 18 Jun 2015 02:41:47 GMTContent-Type: text/htmlConnection: keep-aliveVary: Accept-Encoding

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.