目的:不想讓網頁頁面出現這樣子的錯誤訊息

Not Found

The requested URL /123 was not found on this server.
Apache/2.0.52 (CentOS) Server at 10.10.10.135 Port 80

關閉apache版本,vi /etc/httpd/conf/httpd.conf

ServerTokens OS # 找到這一行,將“OS”改為“Prod”
# 改為
ServerTokens Prod #  在出現錯誤頁的時候不顯示服務器操作繫統的名稱
ServerSignature On # 找到這一行,將“On”改為“Off”
# 改為
ServerSignature Off # 在錯誤頁中不顯示Apache的版本

關閉php版本,vi /etc/php.ini

expose_php = On

# 改為

expose_php = Off

重啟apache

service httpd restart

測試 (在Linux console底下使用HEAD指令)

HEAD http://ssorc.tw/index.html

HEAD http://ssorc.tw/index.php

使用前

200 OK
Connection: close
Date: Tue, 08 Feb 2011 04:11:00 GMT
Accept-Ranges: bytes
ETag: “7091f-4-83ab2bc0”
Server: Apache/2.0.52 (CentOS)
Content-Length: 4
Content-Type: text/html; charset=UTF-8
Last-Modified: Tue, 08 Feb 2011 04:09:27 GMT
Client-Date: Tue, 08 Feb 2011 04:10:46 GMT
Client-Peer: 10.10.10.135:80
Client-Response-Num: 1

200 OK
Connection: close
Date: Tue, 08 Feb 2011 04:11:01 GMT
Server: Apache/2.0.52 (CentOS)
Content-Type: text/html; charset=UTF-8
Client-Date: Tue, 08 Feb 2011 04:10:48 GMT
Client-Peer: 10.10.10.135:80
Client-Response-Num: 1
X-Powered-By: PHP/4.3.9

使用後

200 OK
Connection: close
Date: Tue, 08 Feb 2011 04:09:59 GMT
Accept-Ranges: bytes
ETag: “7091f-4-83ab2bc0”
Server: Apache
Content-Length: 4
Content-Type: text/html; charset=UTF-8
Last-Modified: Tue, 08 Feb 2011 04:09:27 GMT
Client-Date: Tue, 08 Feb 2011 04:09:49 GMT
Client-Peer: 10.10.10.135:80
Client-Response-Num: 1

200 OK
Connection: close
Date: Tue, 08 Feb 2011 04:10:16 GMT
Server: Apache
Content-Type: text/html; charset=UTF-8
Client-Date: Tue, 08 Feb 2011 04:10:03 GMT
Client-Peer: 10.10.10.135:80
Client-Response-Num: 1

網頁頁面訊息只有

Not Found

The requested URL /123 was not found on this server.

Related posts 相關文章
apache httpd 2.4.58 有些安全性更新
More...
WordPress 6.3 以後可能不支援 PHP 5,最低需求為 PHP 7.4
More...
你的 WordPress 升級到 PHP 8 了嗎
More...
你看 WordPress 也建議至少 PHP 7.4+ 了
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。