1.创建服务器证书密钥文件 server.key: openssl genrsa -des3 -out server.key 2048 输入密码,确认密码,自己随便定义,但是要记住,后面会用到。 2.创建服务器证书的申请文件 server.csr openssl req -new -key server.key -out server.csr 输出内容为: Enter pass phrase for root.key: ← 输入前面创建的密码 Country Name (2 letter code) [AU]:CN ← 国家代号,中国输入CN State or Province Name (full name) [Some-State]:BeiJing ← 省的全名,拼音 Locality Name (eg, city) []:BeiJing ← 市的全名,拼音 Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名 Organizational Unit Name (eg, section) []: ← 可以不输入 Common Name (eg, YOUR name) []: ← 输入域名,如:iot.conet.com Email Address []:admin@mycompany.com ← 电子邮箱,可随意填 Please enter the following ‘extra’ attributes to be sent with your certificate request A challenge password []: ← 可以不输入 An optional company name []: ← 可以不输入 4.备份一份服务器密钥文件 cp server.key server.key.org 5.去除文件口令 openssl rsa -in server.key.org -out server.key 6.生成证书文件server.crt openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Sets the root directory for requests. For example, with the following configuration location /i/ { root /data/w3; }
Defines a replacement for the specified location. For example, with the following configuration location /i/ { alias /data/w3/images/; } 当访问/i/top.gif时,root是去/data/w3/i/top.gif请求文件,alias是去/data/w3/images/top.gif请求
# Create a self signed certificate, should the user need it openssl req -subj "/C=$COUNTRY/" -x509 -nodes -newkey rsa:2048 -keyout /etc/ssl/private/default-server.key -out /etc/ssl/certs/default-server.crt