為你的網站加上SSL,可以使用HTTPS進行訪問

來源:互聯網
上載者:User

標籤:進入   run   技術   oca   私密金鑰   dfs   檔案   cgi   htm   

首先,我們使用的是nginx

將網域名稱認證檔案1_www.domain.com_bundle.crt 、私密金鑰檔案2_www.domain.com.key儲存到同一個目錄,例如/usr/local/nginx/conf目錄下。

在ngxin配置中,添加如下:

server {        listen 443;        server_name www.domain.com; #填寫綁定認證的網域名稱        ssl on;        ssl_certificate 1_www.domain.com_bundle.crt;        ssl_certificate_key 2_www.domain.com.key;        ssl_session_timeout 5m;        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照這個協議配置        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照這個套件配置        ssl_prefer_server_ciphers on;        location / {            root   html; #網站目錄            index  index.html index.htm;        }    }

進入nginx 源碼包重新設定:

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --http-scgi-temp-path=/var/temp/nginx/scgi --add-module=/home/software/fastdfs-nginx-module/src

以上是fastdfs + ssl的配置,如果你不需要fastdfs,那麼只需要如下即可:

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module 
make
make install

OK,

使用 ./nginx -t 測試是否成功

然後重啟即可訪問;最後結果如下:

 

為你的網站加上SSL,可以使用HTTPS進行訪問

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.