How to hide the PHP version on a Linux Server

Source: Internet
Author: User

How to hide the PHP version on a Linux Server

In general, information leakage exists on most web Servers installed by default, one of which is PHP. PHP is now a popular server-side html embedded language ?). In today's challenging age, many attackers attempt to discover vulnerabilities on your server. Therefore, I will briefly describe how to hide PHP information on a Linux server.

Expose_php is enabled by default. Disable the "expose_php" parameter so that php can hide its version information.

  1. [root@CentOS66 ~]# vi /etc/php.ini

In your php. ini, locate the line containing expose_php and set On to Off:

  1. expose_php =Off

Before that, the web server header looks like this:

  1. [root@centos66 ~]# curl -I http://www.ehowstuff.com/
  1. HTTP/1.1200 OK
  2. Server: nginx
  3. Content-Type: text/html; charset=UTF-8
  4. Vary:Accept-Encoding
  5. X-Powered-By: PHP/5.3.3
  6. X-Pingback: http://www.ehowstuff.com/xmlrpc.php
  7. Date:Wed,11Feb201514:10:43 GMT
  8. X-Page-Speed:1.9.32.2-4321
  9. Cache-Control: max-age=0,no-cache

After changing and restarting the Web service, php will not display the version in the web Service header:

  1. HTTP/1.1200 OK
  2. Server: nginx
  3. Content-Type: text/html; charset=UTF-8
  4. Vary:Accept-Encoding
  5. X-Powered-By: PHP/5.3.3
  6. X-Pingback: http://www.ehowstuff.com/xmlrpc.php
  7. Date:Wed,11Feb201514:10:43 GMT
  8. X-Page-Speed:1.9.32.2-4321
  9. Cache-Control: max-age=0,no-cache

In addition to the PHP version, the Web server also exposes the version number by default. If you are using an Apache server, refer to this article to disable the Apache version display. If you are using an Nginx server, add it to the http segment.server_tokens off;Configuration. Please remember to restart related services for the above modifications.

Install LNMP in CentOS 6.3 (PHP 5.4, MyySQL5.6)

Nginx startup failure occurs during LNMP deployment.

Ubuntu install Nginx php5-fpm MySQL (LNMP environment setup)

Detailed php hd scanning PDF + CD source code + full set of teaching videos

Configure the php lnmp development environment in CentOS 6

PHP details: click here
PHP: click here

This article permanently updates the link address:

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.