檢視 Apache 的原始碼
←
Apache
跳至導覽
跳至搜尋
由於以下原因,您無權編輯此頁面:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
'''Apache'''是一套網頁伺服器軟體。 == 設定 == === Rewrite === 把mod_rewrite開起來(現在大多數的情況應該都會用到): <syntaxhighlight lang="shell-session"> $ sudo a2enmod rewrite $ sudo service apache2 restart </syntaxhighlight> === SSL === 先啟動啟動SSL模組: <syntaxhighlight lang="shell-session"> $ sudo a2enmod ssl $ sudo service apache2 restart </syntaxhighlight> ==== Cipher ==== 在<code>/etc/apache2/conf-available/sslciphersuite.conf</code>內設定: <pre> # SSLCipherSuite CHACHA20+ECDHE:AESGCM+ECDHE:AES+ECDHE:CAMELLIA+ECDHE:!ADH:!AECDH:!DSS:!ECDSA:!MD5:!SHA1 SSLHonorCipherOrder On </pre> 接著用<code>a2enconf sslciphersuite</code>啟動。 ==== SSL Stapling ==== 在<code>/etc/apache2/conf-available/sslstapling.conf</code>內設定: <pre> # SSLUseStapling On SSLStaplingCache "shmcb:logs/ssl_stapling(32768)" </pre> 接著用<code>a2enconf sslstapling</code>啟動。 === VirtualHost === 先啟動header模組: <syntaxhighlight lang="shell-session"> $ sudo a2enmod headers $ sudo service apache2 restart </syntaxhighlight> 這邊設定將HTTP導去HTTPS: <pre> <VirtualHost *:80> ServerName example.com:80 DocumentRoot /srv/example.com/public ErrorLog ${APACHE_LOG_DIR}/example.com-error.log CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined Redirect / https://example.com/ </VirtualHost> </pre> <pre> <VirtualHost *:80> ServerName www.example.com:80 DocumentRoot /srv/www.example.com/public ErrorLog ${APACHE_LOG_DIR}/www.example.com-error.log CustomLog ${APACHE_LOG_DIR}/www.example.com-access.log combined Redirect / https://www.example.com/ </VirtualHost> </pre> 以及HTTPS站台導去有<code>www</code>的網站: <pre> <VirtualHost *:443> Protocols h2 http/1.1 ServerName example.com:443 DocumentRoot /srv/example.com/public ErrorLog ${APACHE_LOG_DIR}/example.com_ssl-error.log CustomLog ${APACHE_LOG_DIR}/example.com_ssl-access.log combined SSLEngine on SSLCertificateFile /etc/dehydrated/certs/example.com/cert.pem SSLCertificateKeyFile /etc/dehydrated/certs/example.com/privkey.pem SSLCertificateChainFile /etc/dehydrated/certs/example.com/chain.pem Header always set Strict-Transport-Security "max-age=31536000" Redirect / https://www.example.com/ </VirtualHost> </pre> 最後是本體: <pre> <VirtualHost *:443> Protocols h2 http/1.1 ServerName www.example.com:443 DocumentRoot /srv/www.example.com/public ErrorLog ${APACHE_LOG_DIR}/www.example.com_ssl-error.log CustomLog ${APACHE_LOG_DIR}/www.example.com_ssl-access.log combined SSLEngine on SSLCertificateFile /etc/dehydrated/certs/www.example.com/cert.pem SSLCertificateKeyFile /etc/dehydrated/certs/www.example.com/privkey.pem SSLCertificateChainFile /etc/dehydrated/certs/www.example.com/chain.pem Header always set Strict-Transport-Security "max-age=31536000" </VirtualHost> </pre> == 外部連結 == * {{Official|https://httpd.apache.org/}} {{en}} [[Category:軟體]]
此頁面使用了以下模板:
Template:En
(
檢視原始碼
)
Template:En icon
(
檢視原始碼
)
Template:ISO 639 name en
(
檢視原始碼
)
Template:Lan
(
檢視原始碼
)
Template:Language icon
(
檢視原始碼
)
Template:Official
(
檢視原始碼
)
Template:Official website
(
檢視原始碼
)
Module:Arguments
(
檢視原始碼
)
Module:Lan
(
檢視原始碼
)
Module:Official website
(
檢視原始碼
)
Module:URL
(
檢視原始碼
)
返回到「
Apache
」。
導覽選單
個人工具
登入
命名空間
頁面
討論
臺灣正體
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
視圖
閱讀
檢視原始碼
檢視歷史
更多
搜尋
導覽
首頁
近期變更
隨機頁面
MediaWiki說明
工具
連結至此的頁面
相關變更
特殊頁面
頁面資訊