Improve Apache Web Server Security: Use ServerTokens and ServerSignature to Disable Header改善Apache Web服務器安全:使用servertokens和serversignature禁用標題
When Apache HTTPD web server generates any web pages or error pages, some important information about the version and other details implemented on the system are displayed in th web site server header.當Apache的httpd Web服務器產生的任何網頁或錯誤網頁,一些重要的信息有關的版本和其他細節,實施該系統顯示在次網站服務器的標題。 For example, the information text may be like this:舉例來說,信息文本可能會是這樣的:
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b服務器: apache/1.3.37 ( UNIX的) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 frontpage/5.0.2.2635.sr1.2 mod_ssl/2.8.28 openssl/0.9.7a php-cgi/0.1b
Server: Apache/2.0.53 (Ubuntu) PHP/4.3.10-10ubuntu4 Server at xx.xx.xx.xx Port 80服務器: apache/2.0.53 ( Ubuntu的) php/4.3.10-10ubuntu4服務器上xx.xx.xx.xx端口80
The line in the server header expose important version and variant information about the Linux operating system and Apache software used on the machine, indirectly expose the possible security holes that are existed to the hackers, or at least make malicious attackers easier to identify your system for available attack points.該線在服務器上的標題,揭露重要的版本和變體的資料, Linux操作系統和Apache軟件使用的機器,間接揭露可能的安全漏洞是存在的黑客,或者至少使惡意攻擊者更容易識別您的系統現有的攻擊點。
To ensure that the Apache HTTP web server does not broadcast this message to the whole world publicly and fix possible security issue, modify these two directives ServerTokes and ServerSignature in httpd.conf configuration file.以確保Apache的HTTP Web服務器不播出這個訊息,以整個世界的公開和修復可能的安全問題,修改這兩個指令servertokes和serversignature在httpd.conf配置文件。
- Login as root user or perform a sudo to the web server.以root身份登錄的用戶或執行sudo的到Web服務器。
- Open and edit httpd.conf or apache2.conf (in Apache 2) with vi or other text editor.打開並修改httpd.conf文件或apache2.conf (在Apache 2 )與六或其他文本編輯器。 The Apache configuration normally located in /etc/httpd/conf/ or /etc/apache2/ or /etc/apache/ (for Apache1.3) depending on which Unix you’re using. Apache的配置通常位於在/ etc /的httpd /設置/或/ etc/apache2 /或/ etc /阿帕奇/ ( apache1.3 )根據其中的UNIX您使用。
- Locate the line with ServerTokens .找到符合servertokens 。 You can perform a search by typing “/ServerTokes” and hit Enter.您可以執行搜索中鍵入“ / servertokes ”和回車鍵。
- In Apache 1.3, you will likely to see a line starts with #ServerTokes Full In this case, remove or delete the # character (by pressing d key).在Apache 1.3的,您可能會看到一條線開始# servertokes充分在這種情況下,移除或刪除#字符(按d鍵) 。 Also modify the Full to become Prod (press r key to replace one character, or R to replace multiple characters), so that the line becomes ServerTokens Prod .還修改了充分成為產品(按R鍵,以取代一個字符,或R ,以取代多個字符) ,使該線成為servertokens產品 。 In Apache 2.0 or 2.2, the line normally does not exist.在Apache 2.0或2.2 ,該行通常是不存在的。 So the search will fail.因此,搜索將失敗。 In this case, go to the bottom of config file, and add the new line with the following text.在這種情況下,去底部的config檔案,並添加新的符合下列文字。 You can add new line by pressing o key.您可以添加新線緊迫o的關鍵。
ServerTokens Prod servertokens產品
- Next, search for ServerSignature.未來,搜索為serversignature 。 In Apache13, the line should just above the line of ServerTokens.在apache13 ,該行應略高於線servertokens 。 Edit the line so that it looks like this, and in Apache2 which doesn’t already have this line, add in at new one.編輯路線,以便它看起來是這個樣子,並在Apache2中不已經有這條線,加上在新一。
ServerSignature Off serversignature小康
- By now the Apache configuration file should have this two directives set as below:現在Apache的配置文件應該有這兩項指令定為如下:
ServerSignature Off serversignature小康
ServerTokens Prod servertokens產品The first line “ServerSignature Off” instructs Apache not to display a trailing footer line under server-generated documents (error messages, mod_proxy ftp directory listings, mod_info output, and etc) which displays server version number, ServerName of the serving virtual host, email setting, and creates a “mailto:” reference to the ServerAdmin of the referenced document.第一行“ serversignature小康”指示的Apache不顯示一個尾隨頁腳線下的服務器所產生的文件(錯誤訊息, mod_proxy FTP目錄列表, mod_info輸出,等) ,其中顯示服務器版本號,服務器的虛擬主機服務,電子郵件設置,並創建一個“的mailto : ”提到了serveradmin所引用的文件。
The second line “ServerTokens Prod” configures Apache to return only Apache as product in the server response header on very page request, suppressing OS, major and minor version info.第二行“ servertokens產品”配置的Apache只返回Apache的產品在服務器的響應頭就非常的頁面請求,抑制操作系統,主要和次要版本信息。
- Save and close the config file by pressing Shift-Colon, and then type wq keys, and hit Enter.保存並關閉配置文件由緊迫的轉移結腸,然後鍵入wq鍵,回車鍵。
- Restart Apache.重新啟動Apache的。 Typical command is service httpd restart or /etc/init.d/apache2 restart .典型的命令是服務的httpd重新啟動或/ etc/init.d/apache2重新啟動 。
- Now, you will get only the Apache in the server response header:現在,你會得到的唯一的Apache在服務器的響應標題:
Server: Apache服務器:阿帕奇
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 . 。
Related Articles相關文章
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 4安裝Web服務器在FreeBSD的6.0與2.2的Apache , MySQL 5.0的和PHP 5 -第4部分
- Apache Status (whm-server-status) in cPanel WebHost Manager Returns Blank Page Apache的地位(的WHM服務器的地位)在網頁主機的cPanel經理回報的空白頁
- Easily Set Up Web Server with XAMPP很容易成立的Web伺服器與xampp
- Remove and Uninstall or Disable ModSecurity (mod_security)刪除和卸載或禁用modsecurity ( mod_security )
- Starting Apache HTTPD Failed Due to Cannot Open or No Such mod_bwlimited, mod_log_bytes or mod_bandwidth Files開始的Apache的httpd失敗,由於無法打開,或沒有這樣的mod_bwlimited , mod_log_bytes或mod_bandwidth檔案
- cPanel WHM Failed to Receive Status Information From Apache Error的cPanel的WHM沒有收到狀態信息從Apache的錯誤
- winnt_accept: Asynchronous AcceptEx failed Error in Apache Log winnt_accept :異步acceptex失敗錯誤在Apache日誌
- Apache Warn NameVirtualHost *:80 Has No VirtualHosts Error When Start阿帕奇警告namevirtualhost * : 80沒有virtualhosts時發生錯誤開始
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 2安裝Web服務器在Windows XP的Apache2 , php5和mysql4 -第2部分
- Auto Shutdown and Restart Apache HTTPD Service Daemon at Preset Time自動關機和重新啟動的Apache的httpd服務的守護進程在預設時間


















