死siua11 发表于 2018-11-13 06:19:01

Nginx负载均衡、ssl原理、生产ssl密钥对、Nginx配置ssl

  #报错unknown directive "ssl"
  # /usr/local/nginx/sbin/nginx -t
  nginx: unknown directive "ssl" in /usr/local/nginx/conf/vhost/ssl.conf:7
  nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
  #需要重新编译nginx, 加上--with-http_ssl_module
  #源码包查看
  # cd /usr/local/src/nginx-1.8.0/
  # ./configure --help |grep -i ssl
  --with-http_ssl_module             enable ngx_http_ssl_module
  --with-mail_ssl_module             enable ngx_mail_ssl_module
  --with-openssl=DIR               set path to OpenSSL library sources
  --with-openssl-opt=OPTIONS         set additional build options for OpenSSL
  #重新编译nginx
  # ./configure --prefix=/usr/local/nginx --with-http_ssl_module
  #make && make install
  #-t restart[重启]
  # /usr/local/nginx/sbin/nginx -t
  nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
  nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
  # /etc/init.d/nginx restart
  Restarting nginx (via systemctl):                        [确定]
  #查看监听端口
  # netstat -lntp
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address         Foreign Address         State       PID/Program name
  tcp      0      0 0.0.0.0:80            0.0.0.0:*               LISTEN      4622/nginx: master
  tcp      0      0 0.0.0.0:22            0.0.0.0:*               LISTEN      1000/sshd
  tcp      0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1371/master
  tcp      0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      4622/nginx: master
  tcp6       0      0 :::22                   :::*                  LISTEN      1000/sshd
  tcp6       0      0 ::1:25                  :::*                  LISTEN      1371/master
  tcp6       0      0 :::3306               :::*                  LISTEN      1329/mysqld

页: [1]
查看完整版本: Nginx负载均衡、ssl原理、生产ssl密钥对、Nginx配置ssl