菜单

安裝Nginx伺務器

  1. 建立一個目錄來儲存伺務器密鑰、證書和中間包(Intermediate bundle)。

Shell

复制代码
mkdir /etc/nginx/ssl
  1. 將你的SSL證書和證書捆綁檔案(Certificate bundle file),複製到位於 /etc/nginx/ssl的Nginx伺服器上。當產生證書請求(Certificate request)時,密鑰檔案早已在伺服器內。複製此密鑰檔案到**/etc/nginx/ssl**文件夾內。
  2. 導航到SSH中的 SSL文件夾

Shell

复制代码
cd /etc/nginx/ssl
  1. 使用concatenate命令,將你的SSL證書和**中間包(Intermediate bundle)**合併到檔案內。

Shell

复制代码
cat signed-cert.crt intermediate.crt ca.crt >> bundle.crt

注意:當使用concatenate命令時,證書需按以下順序列出,否則SSL無法在你的伺服器內正常工作。

  1. 打開你網域的 Nginx 配置文件

Shell

复制代码
vim /etc/nginx/conf.d/ssl-host.conf
  1. 更新配置文件以使用SSL證書。 之後,儲存你的配置文件。

Shell

复制代码
server {

listen 443 ssl;



server_name www.cinnox-demo.com;

ssl_certificate /etc/nginx/ssl/ bundle.crt;

ssl_certificate_key /etc/nginx/ssl/private.key;



root /usr/share/nginx/cinnox-demo/;

index index.html index.htm;

}
  1. 重新啟動Nginx伺服器

Shell

复制代码
systemctl restart nginx

Updated 5 months ago


上一个
安裝Apache伺服器
下一个
在WordPress建立的網站安裝懸浮圖標——加入即時聊天和網上通話功能與你的訪客聯繫
最近修改: 2025-12-04