标签:测试 系统 输入密码 gen ati 网络服务 获取 address 双向
起初是在部署系统时,用扫描漏洞工具扫描系统,发现网站访问不安全,要求使用https安全认证访问web,而nginx支持https技术,所以取巧就在nginx配置了个https;在踩了一大堆的教程坑后,终于配置成功,然后记录下来,按照以下的教程,可以配置出https需要的网站证书认证。配置完成访问浏览器后,网站前面会出现红色的叉,这是因为在网络服务器上找不到对应的证书厂商,不妨碍使用。
这里以nginx1.16.1为例
[root@~]curl -O http://nginx.org/download/nginx-1.16.1.tar.gz
或者 wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@~] tar -zxvf nginx-1.16.1.tar.gz
[root@~] cd nginx-1.16.1
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-https_ssl_module
[root@ nginx-1.16.1]make
[root@~]cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
[root@~]/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module # 模块已加载
[root@~]openssl genrsa -des3 -out server.key 1024
kpy@hw
Generating RSA private key, 1024 bit long modulus
....++++++
.......................++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
Country Name (2 letter code) [XX]:CN # 国家缩写
State or Province Name (full name) []:GuangDong #省份
Locality Name (eg, city) [Default City]:GuangZhou # 市
Organization Name (eg, company) [Default Company Ltd]:lw666.cn # 公司名
Organizational Unit Name (eg, section) []: # 组织名,可以不填
Common Name (eg, your name or your server‘s hostname) []: #公共名,可以不填
Email Address []:123456@lw666.cn # 邮箱地址,可以不填
Please enter the following ‘extra‘ attributes
to be sent with your certificate request
A challenge password []: # 加强的密码,可以不填
An optional company name []: # 可以不填
[root@~]cp server.key server.key.org
[root@~]openssl rsa -in server.key.org -out server.key
Enter pass phrase for server.key.org: # 输入上面的密码
writing RSA key
[root@~]openssl x509 -req -days 180 -in server.csr -signkey server.key -out server.crt
Signature okbr/>subject=/C=CN/ST=GuangDong/L=GuangZhou/O=lwops.cn/emailAddress=123456@lw666.cn
Getting Private key
http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
# ssl on; nginx1.15版本之前需要加,之后的不用加
# 证书路径和密钥路径
标签:测试 系统 输入密码 gen ati 网络服务 获取 address 双向
原文地址:https://blog.51cto.com/14483703/2477954