nginx用yum安装做443加密网站

1.前期准备

关闭防火墙和selinux

[root@vip ~]# iptables -F && setenforce 0 && systemctl stop firewalld

2.安装依赖包

[root@vip ~]# yum -y install gcc pcre-devel openssl-devel

[root@vip ~]# yum -y install epel-release

安装nginx

[root@vip ~]# yum -y install nginx

设置nginx开机自启

[root@vip ~]# systemctl enable nginx

知识扩展:

nginx常用命令

[root@vip ~]# systemctl start nginx.service                 #启动nginx

[root@vip ~]# systemctl stop nginx             #停止nginx

[root@vip ~]# systemctl enable nginx        #开机自启

[root@vip ~]# systemctl restart nginx.service         #重启nginx

配置路径:/etc/nginx/

日志路径:/var/log/nginx

3.打开配置文件

[root@vip ~]# vim /etc/nginx/nginx.conf

    server {
        listen       443;
        server_name  localhost;
        ssl on;
        root         /usr/share/nginx/html;

        ssl_certificate "/root/3309085_cszc.top.pem";
        ssl_certificate_key "/root/3309085_cszc.top.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        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;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
                proxy_buffer_size  128k;
                proxy_buffers   32 32k;
                proxy_busy_buffers_size 128k;
        }

    }
}

4.然后启动nginx

[root@vip ~]# systemctl start nginx.service

启动成功之后打开浏览器输入:https://192.168.175.200/

总结:。。。。。。。。。。此处省略一万字

原文地址:https://www.cnblogs.com/zgqbky/p/12197027.html