1. 程式人生 > >配置Apache成為HTTPS伺服器

配置Apache成為HTTPS伺服器

環境:
ubutnu 17.10
apache2
php5.0

使能SSL模組:
命令:a2enmod ssl

新增conf檔
命令:cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/

default-ss.conf內容

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin [email protected]

        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf
# SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

文件內容不需要修改,就可以成為一個不受信任的https網站,新增可信證書後,可對外發布

重啟apache: apachectl restart 或者 /etc/init.d/apache2 restart

相關推薦

配置Apache成為HTTPS伺服器

環境: ubutnu 17.10 apache2 php5.0 使能SSL模組: 命令:a2enmod ssl 新增conf檔 命令:cp /etc/apache2/sites-available/default-ssl.conf /etc/

https----------如何在phpstudy環境下配置apachehttps訪問以及訪問http自動跳轉成https

寫入 rom virtual write rule 找到 engine rul str 1、首先在 httpd.conf裏面修改幾個地方   找到 #LoadModule ssl_module modules/mod_ssl.so 去掉前面的#   Include conf

Centos7配置Apache實現HTTPS

mar 密碼 wke 終端 image vat ges proc dea HTTP簡介 Web服務器在默認情況下使用HTTP,這是一個純文本的協議。正如其名稱所暗示的,純文本協議不會對傳輸中的數據進行任何形式的加密。而基於HTTP的Web服務器是非常容易配置,它在安全方面有

如何在Ubuntu 18.04上安裝和配置Apache 2 Web伺服器

什麼是Apache Web Server? Apache或Apache HTTP伺服器是一個免費的開源Web伺服器,由Apache軟體基金(Apache Software Foundation)開發和維護。它的受歡迎程度可以通過以下事實來判斷:全球約有46%的網站由Apache提供支援。 Apache允許網

配置Apache James郵件伺服器

Apache James是最好用的開源java郵件伺服器之一,在配置smtp服務過程中,有些步驟不對的話郵件就不能傳送到外網的其它郵件伺服器上了。0.啟動james,開啟james-2.2.0/apps/james/SAR-INF/config.xml檔案 1.transpo

Windows搭建Apache+SSL Https伺服器

因為看到網上的各種教程不全還有很多錯誤,自己繞了好多彎最後參考了官方文件,才最終解決,所以這裡綜合各方大神所寫的文章,改正和完善細節後再發一次。這裡不得不說一下,官方文件雖然是英文的平時還特別低調,顯得相當高冷,可是它卻是我們最靠譜,最堅強的後盾。 1.修

nodejs開發——express配置自簽名https伺服器

       在nodejs中使用express來搭建框架可以說是非常的簡單方便,但是一般預設建立的都是http伺服器,也就是隻能通過http協議進行訪問。如今https已經是發展趨勢,我們應該順應時代的潮流。在本篇文章中,我們將會來使用自簽名的方式建立證書,然後使用expr

騰訊雲Linux伺服器搭建(七) Apache+Tomcat+HTTPS加密的配置

       前面已經在一個主機上安裝了apache+git+openssl,實現了git伺服器的https驗證。還安裝了tomcat,在tomcat上架起了tomcat manager,Jenkins,和微信小程式的後臺程式。由於微信小程式必須走https,而且必須用預設埠

配置Apache支持HTTPS

apache https openssl ssl 1、演示環境:192.168.1.145:CentOS 6.9 x86_64,Apache服務器192.168.1.146:CentOS 7.4 x86_64,私建的CA服務器備註:Apache和CA可以位於同一臺服務器2、192.168.1.

Apache 配置多個HTTPS站點

Apache SSL HTTPS 工作中經常會遇到多個站點實現https訪問,並指向同一個網頁,本文將詳解如何在Centos 環境下配置Apache多站點實現HTTPS訪問。 準備工作 OS:CentOS release 6.8 (Final)Web:Apache 安裝Apache 1、安裝Apa

Apache 配置 http 轉 https

apache 配置 bsp iter ont pre write tee In ase <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{SERVER_POR

CentOS7.4 系統安裝配置LAMP(Apache+PHP5+MySQL)伺服器環境

準備篇: 1、配置防火牆,開啟80埠、3306埠 CentOS7是用firewalld管理防火牆,和以前iptables的方式有較大區別,網上文章很多,這裡就不詳述了。 安裝篇: 一、安裝Apache yum install httpd #根據提示,輸入Y安裝即可成功安裝 /etc

Centos 下配置 Apache 伺服器

1、修改yum安裝源為阿里安裝源 ①複製原有的原始檔 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bakup ②通過wget獲取阿里雲的原始檔 wget -O /etc/yum

Ubuntu 下配置 Apache 伺服器

1、前提準備工作 將原有的原始檔複製儲存 sudo cp /etc/apt/source.list /etc/apt/source.list.bak 開啟原始檔 sudo vim /etc/apt/source.list 將下列的複製到檔案中 deb http://mi

免費HTTPS伺服器配置

免費HTTPS伺服器配置 基於tomcat,需要為tomcat安裝apr等,找了很久找到了這麼一篇沒坑的部落格:https://blog.csdn.net/mn960mn/article/details/51602529,這裡面關於tomcat的配置已經夠了,我想說的主要是如何申請CA證

騰訊雲安裝配置Apache+MariaDB伺服器並解決SQLSTATE[HY000] [1130] Host t '*’ is not allowed to connect to this se問題

具體的安裝方式(超詳細,可直接複製命令執行):https://www.qcloud.com/community/article/321718001489545422 安裝完後會出現以下問題(如果是遠端連線的話): 問題:SQLSTATE[HY000] [1130] Host '***.**.**

在CentOS 7 1804 中 配置 Apache HTTP Server 將 http 自動跳轉之 https

相關連結: 在CentOS 7 1804 中 安裝 Apache HTTP Server 並 配置 騰訊雲 SSL 在CentOS 7 1804 中 安裝 Apache HTTP Server 並 配置 阿里雲 SSL 在CentOS 1804 中的 Tomcat 9 設定 SSL( h

ubuntu14.04配置apache https訪問(ssl證書來源阿里雲)

ubuntu14.04配置apache https訪問(ssl證書來源阿里雲) 針對ubuntu14.04 版本的配置,其他版本資料夾位置不一樣只能當做參考 首先去阿里雲上申請證書,成功後下載到一個apache版本證書 遠端連線linux桌面 cd /etc/apach

如何配置 Apache Web 伺服器

學習如何在 Apache 上託管你自己的網站,這是一個可靠、流行且易於配置的 Web 伺服器。 我託管自己的網站已經有很多年了。自從 20 多年前從 OS/2 切換到 Linux 以來,我一直將 Apache 作為我的伺服器軟體。Apache 是可靠、流行的,且基本的安裝配置也很容易。對於更復雜的設定(比如

Linux伺服器---配置apache支援php

apache支援php       php是最好用的伺服器語言了,Apache對php有很強大的支援     1、檢測是否安裝php,如果什麼資訊也沒有,那麼你就要自己安裝php了 [[ema