service:apache
差異處
這裏顯示兩個版本的差異處。
| 下次修改 | 前次修改 | ||
| service:apache [2007/02/05 22:54] – 建立 wenpei | service:apache [2011/06/20 17:29] (目前版本) – GoAccess wenpei | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | ====== Apache2 + SSL ====== | ||
| + | http:// | ||
| + | |||
| + | ==== 安裝套件 ==== | ||
| + | # apt-get install apache2 | ||
| + | # apt-get install openssl ssl-cert | ||
| + | # apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi php5 | ||
| + | |||
| + | ==== 產生 certificate file ==== | ||
| + | # openssl req $@ -new -x509 -days 365 -nodes -out / | ||
| + | # chmod 600 / | ||
| + | |||
| + | < | ||
| + | Country Name (2 letter code) [AU]:TW | ||
| + | State or Province Name (full name) [Some-State]: | ||
| + | Locality Name (eg, city) []:Taoyuan | ||
| + | Organization Name (eg, company) [Internet Widgits Pty Ltd]:SARS TW | ||
| + | Organizational Unit Name (eg, section) []:wiki | ||
| + | Common Name (eg, YOUR name) []: | ||
| + | Email Address []: | ||
| + | </ | ||
| + | |||
| + | ==== 開啟port ==== | ||
| + | 確認 / | ||
| + | < | ||
| + | Listen 80 | ||
| + | |||
| + | < | ||
| + | Listen 443 | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== 修改 / | ||
| + | 加入列幾行(實際上此例是直接複製本 port 80的部份, | ||
| + | < | ||
| + | NameVirtualHost *:443 | ||
| + | |||
| + | < | ||
| + | ServerAdmin webmaster@localhost | ||
| + | |||
| + | SSLEngine on | ||
| + | SSLCertificateFile / | ||
| + | |||
| + | DocumentRoot /var/www/ | ||
| + | < | ||
| + | Options FollowSymLinks | ||
| + | AllowOverride None | ||
| + | </ | ||
| + | < | ||
| + | Options Indexes FollowSymLinks MultiViews | ||
| + | AllowOverride None | ||
| + | Order allow,deny | ||
| + | allow from all | ||
| + | # This directive allows us to have apache2’s default start page | ||
| + | # in / | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | ScriptAlias /cgi-bin/ / | ||
| + | < | ||
| + | AllowOverride None | ||
| + | Options ExecCGI -MultiViews +SymLinksIfOwnerMatch | ||
| + | Order allow,deny | ||
| + | Allow from all | ||
| + | </ | ||
| + | |||
| + | ErrorLog / | ||
| + | |||
| + | # Possible values include: debug, info, notice, warn, error, crit, | ||
| + | # alert, emerg. | ||
| + | LogLevel warn | ||
| + | |||
| + | CustomLog / | ||
| + | ServerSignature On | ||
| + | |||
| + | Alias /doc/ “/ | ||
| + | < | ||
| + | Options Indexes MultiViews FollowSymLinks | ||
| + | AllowOverride None | ||
| + | Order deny,allow | ||
| + | Deny from all | ||
| + | Allow from 127.0.0.0/ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== 設定 https 的目錄路徑 ==== | ||
| + | 設定 http.conf | ||
| + | < | ||
| + | |||
| + | < | ||
| + | # Inside the subarea any Intranet access is allowed | ||
| + | # but from the Internet only HTTPS + Strong-Cipher + Password | ||
| + | # or the alternative HTTPS + Strong-Cipher + Client-Certificate | ||
| + | |||
| + | # If HTTPS is used, make sure a strong cipher is used. | ||
| + | # Additionally allow client certs as alternative to basic auth. | ||
| + | SSLVerifyClient optional | ||
| + | SSLVerifyDepth 1 | ||
| + | SSLOptions +FakeBasicAuth +StrictRequire | ||
| + | SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128 | ||
| + | |||
| + | # Force clients from the Internet to use HTTPS | ||
| + | RewriteEngine on | ||
| + | RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.[0-9]+$ | ||
| + | RewriteCond %{HTTPS} !=on | ||
| + | RewriteRule .* - [F] | ||
| + | |||
| + | # Allow Network Access and/or Basic Auth | ||
| + | #Satisfy any | ||
| + | |||
| + | # Network Access Control | ||
| + | Order allow,deny | ||
| + | Allow from all | ||
| + | #Allow from 192.168.1.0/ | ||
| + | |||
| + | # HTTP Basic Authentication | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== enable ssl & rewrite.load modules ==== | ||
| + | (建立softlink,mods-enabled -> mods-available) | ||
| + | # a2enmod ssl | ||
| + | 需要啟動apache2 | ||
| + | |||
| + | ===== 自動導向 https ===== | ||
| + | RewriteEngine On | ||
| + | RewriteCond %{SERVER_PORT} !^443$ | ||
| + | RewriteRule ^(.*)$ https:// | ||
| + | |||
| + | ====== Log 分析 ====== | ||
| + | ===== GoAccess===== | ||
| + | http:// | ||
| + | |||
| + | http:// | ||
| + | |||
| ====== 使用Apache自動判別語系 ====== | ====== 使用Apache自動判別語系 ====== | ||
| http:// | http:// | ||
service/apache.1170687266.txt.gz · 上一次變更: (外部編輯)
