安装 gcc、gcc-c++
yum -y install gcc gcc-c++ kernel-devel
安装pcre库
yum -y install pcre pcre-devel
安装openssl
yum -y install openssl openssl-devel
下载 nginx
wget http://nginx.org/download/nginx-1.16.1.tar.gz
解压
tar -zxvf nginx-1.16.1.tar.gz
生成配置文件
cd nginx-1.16.1
./configure --prefix=/usr/local/nginx --with-http_ssl_module
编译和安装
make && make install
配置 https 服务
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name h5.woaikaifa.com;
ssl_certificate /usr/local/nginx/openssl/2789235_h5.woaikaifa.com.pem;
ssl_certificate_key /usr/local/nginx/openssl/2789235_h5.woaikaifa.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name h5.woaikaifa.com;
location / {
rewrite (.*) https://h5.woaikaifa.com$1 permanent;
}
}