Nginx configuration HTTPS and self-signed certificate

Source: Internet
Author: User

Once iOS requires all requests to be HTTPS for security purposes, the HTTPS process is configured in the logging project.

# Generate an RSA key 
OpenSSL genrsa-des3-out xgj.key
 
# Copy a key file that does not require a password to enter
OpenSSL rsa-in xgj.key-out xgj_nopass. Key
 
# Generate a certificate request
$ openssl req-new-key xgj.key-out XGJ.CSR

Create CA certificate:
OpenSSL req-new-x509-key Xgj.key-o  UT ca.crt-days 3650
 
# Self-issued certificate
$ openssl x509-req-days 3650-in xgj.csr-signkey xgj.key-out xgj.crt
OpenSSL X509-req-days 3650-in xgj.csr-ca ca.crt-cakey xgj.key-cacreateserial-out xgj.crt


Configure the Nginx configuration certificate file in Nginx conf file

server {
    listen       default_server;
    server_name  localhost;   
    Access_log  /data/logs/access.log  main;    

    SSL on                  ;
    Ssl_certificate      /etc/nginx/conf.d/xgj.crt;
    Ssl_certificate_key  /etc/nginx/conf.d/xgj_nopass.key;
    #ssl_client_certificate  /etc/nginx/conf.d/ca.crt; #双向认证
#ssl_verify_client on; #双向认证
Location/api {proxy_pass http://127.0.0.1:189; Proxy_set_header x-real-ip $remote _addr; proxy_set_header X-forwarded-for $proxy _add_x_forwarded_for; }}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.