一、Nginx安装
安装的时候需要注意加上 --with-http_ssl_module,因为http_ssl_module不属于Nginx的基本模块。Nginx安装方法:./configure --user=username --group=groupname --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_modulemake && make install二、生成证书
1 $ cd /usr/local/nginx/conf2 $ openssl genrsa -des3 -out server.key 10243 $ openssl req -new -key server.key -out server.csr4 $ cp server.key server.key.org5 $ openssl rsa -in server.key.org -out server.key6 $ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt复制代码三、修改Nginx配置:server{ listen 443;server_name test.sina.com.cn;ssl on;ssl_certificate /usr/local/nginx/conf/server.crt;ssl_certificate_key /usr/local/nginx/conf/server.key;}