openssl req -new -key ca.key -out ca.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:CN State or Province Name (full name) []:Shanghai Locality Name (eg, city) [Default City]:Shanghai Organization Name (eg, company) [Default Company Ltd]:Issuer Co., Ltd Organizational Unit Name (eg, section) []:Issuer Section Common Name (eg, your name or your server's hostname) []:localhost Email Address []:
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
生成CA证书ca.crt
1 2 3 4
openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt Signature ok subject=C = CN, ST = Shanghai, L = Shanghai, O = "Issuer Co., Ltd", OU = Issuer Section, CN = localhost Getting Private key
生成服务器证书
生成服务器端私钥server.key
1 2 3 4 5
openssl genrsa -out server.key 2048 Generating RSA private key, 2048 bit long modulus (2 primes) .........+++++ ...............................................................................................+++++ e is 65537 (0x010001)
openssl req -new -key server.key -out server.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:CN State or Province Name (full name) []:Shanghai Locality Name (eg, city) [Default City]:Shanghai Organization Name (eg, company) [Default Company Ltd]:My Company Organizational Unit Name (eg, section) []:My Section Common Name (eg, your name or your server's hostname) []:localhost Email Address []:
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt Signature ok subject=C = CN, ST = Shanghai, L = Shanghai, O = My Company, OU = My Section, CN = localhost Getting CA Private Key
checking for OS + Linux 5.0.0-31-generic x86_64 checking for C compiler ... not found
./configure: error: C compiler cc is not found
安装C编译器以解决
1
yum install -y gcc
找不到PCRE library
1 2 3 4
./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.
安装pcre-devel库
1
yum install -y pcre-devel
找不到OpenSSL library
1 2 3 4
./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=<path> option.