Home > Backend Development > PHP Tutorial > How to hide the version numbers of Nginx or Apache and PHP, nginxapache_PHP tutorial

How to hide the version numbers of Nginx or Apache and PHP, nginxapache_PHP tutorial

WBOY
Release: 2016-07-12 09:01:49
Original
972 people have browsed it

How to hide the version numbers of Nginx or Apache and PHP, nginxapache

When hackers invade a server, they will first "step in", and the "step in" here refers to It is to understand the details of some services running in the server, such as version number. When hackers know the version number of the corresponding service, they can find some vulnerabilities in the corresponding version of the service to invade and attack, so we need to hide these version numbers. to avoid unnecessary problems

Let’s test it out

insoz:~ insoz$ curl -I http://127.0.0.1/phpinfo.php
HTTP/1.1 200 OK
Server: nginx/1.5.0
Date: Thu, 18 Jun 2015 02:39:32 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.3.1
Copy after login

You can see that our server nginx and php versions are exposed. Let’s look at the hidden methods

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

server_tokens off;
Copy after login

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

ServerTokens Prod
ServerSignature Off
Copy after login

Let’s look at how to hide the version number in php:
In the php configuration file php.ini, add the following code

expose_php = Off
Copy after login

Okay, after the modification is completed, restart the service and let’s test it again:

insoz:~ insoz$ curl -I http://127.0.0.1//phpinfo.php
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 18 Jun 2015 02:41:47 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
Copy after login

Articles you may be interested in:

  • Nginx, Apache, Lighttpd prohibit directory execution php configuration example
  • View nginx apache mysql php compilation parameters under Linux
  • How to hide http header version information in nginx/apache/php
  • How to prevent web pages from being referenced by iframes in PHP, Nginx and Apache

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1087543.htmlTechArticleHow to hide the version numbers of Nginx or Apache and PHP, nginxapache When hackers invade a server, they will first " "Step in", the "step in" here refers to understanding something running on the server...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template