差異處
這裏顯示兩個版本的差異處。
| 下次修改 | 前次修改 | ||
|
apache [2016/09/09 14:12] jz 建立 |
apache [2017/02/28 00:32] (目前版本) jz |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | ====== Apache ====== | ||
| + | |||
| + | ===== Hide server info ===== | ||
| + | <code apache> | ||
| + | Header unset Server | ||
| + | |||
| + | ServerSignature Off | ||
| + | ServerTokens Prod | ||
| + | </code> | ||
| + | |||
| + | ===== Redirect ===== | ||
| + | |||
| + | Redirect with htaccess | ||
| + | <code apache> | ||
| + | # permanent | ||
| + | Redirect 301 /google http://www.google.com/ | ||
| + | # temporary | ||
| + | Redirect 302 /google http://www.google.com/ | ||
| + | # redirent home | ||
| + | RewriteEngine On | ||
| + | RedirectMatch 301 ~.+ http://example.com/$0 | ||
| + | </code> | ||
| + | |||
| + | User dir redirect | ||
| + | <code apache> | ||
| + | <IfModule mod_userdir.c> | ||
| + | UserDir http://example.com~*/ | ||
| + | </IfModule> | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== SSLEngine ===== | ||
| + | |||
| 如果出現以下, | 如果出現以下, | ||
| 行 7: | 行 40: | ||
| 表示 ssl module 沒有安裝或啟用 | 表示 ssl module 沒有安裝或啟用 | ||
| - | ====== CentOS ====== | + | ==== CentOS ==== |
| <code bash> | <code bash> | ||
| 行 20: | 行 53: | ||
| LoadModule ssl_module modules/mod_ssl.so | LoadModule ssl_module modules/mod_ssl.so | ||
| - | ===== Debian/Ubuntu/Suse ===== | + | ==== Debian/Ubuntu/Suse ==== |
| 啟用方式,以下指令會建立連結檔 | 啟用方式,以下指令會建立連結檔 | ||
| <code bash> | <code bash> | ||
| 行 27: | 行 61: | ||
| </code> | </code> | ||
| + | ===== Redirect to ssl if not a old browser ===== | ||
| + | <code apache> | ||
| + | # http://serverfault.com/questions/389806/redirect-to-ssl-only-if-browser-supports-sni | ||
| + | RewriteEngine on | ||
| + | RewriteCond %{HTTP_USER_AGENT} !MSIE\ [5-8] | ||
| + | RewriteCond %{HTTP_USER_AGENT} !Android.*(Mobile)?\ [0-3] | ||
| + | RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | ||
| + | </code> | ||
| + | |||
| + | ref: | ||
| + | |||
| + | http://unix.stackexchange.com/questions/124137/change-apache-httpd-server-http-header | ||
| + | https://donjajo.com/modify-apache-servertokens-custom-value-using-mod_security-module/ | ||
