[Ali cloud server deployment node item (g)] configuration on the server https

Other configurations on the server can see my other articles

1, into the console -SSL certificate

Here Insert Picture Description

2, choose to buy a certificate

Here Insert Picture Description

3. Select a purchase, I chose free

Here Insert Picture Description

4, returned after the purchase is completed "Certificate console" application and completion of information, wait for the audit, the audit is successful

Here Insert Picture Description

5, nginx configuration - Download

Here Insert Picture Description
After downloading get two files as shown
Here Insert Picture Description

6, these two files uploaded to the server / jane-soft / https / directory

7, and then configure nginx.conf, the official website tutorial

// by nginx -t view the file directory on linux

8. Appendix

  • nginx.conf
# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       8080 ssl;
        server_name  localhost;
        root         /jane-code/clock-out/dist;

        ssl_certificate      /jane-soft/https/2426128_www.zhangxiaojuan.club.pem;
        ssl_certificate_key  /jane-soft/https/2426128_www.zhangxiaojuan.club.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

	    location /api/ {
                proxy_pass http://localhost:4000/api/;
        }

        location / {
       		try_files $uri $uri/ @router;
		index  index.html index.htm;
	    }

        location @router{
            rewrite ^.*$/index.html last;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

        server {
            listen       8081 ssl;
            server_name  localhost;
            root         /jane-code/clock-out/visitor/dist;

            ssl_certificate      /jane-soft/https/2426128_www.zhangxiaojuan.club.pem;
            ssl_certificate_key  /jane-soft/https/2426128_www.zhangxiaojuan.club.key;

            ssl_session_cache    shared:SSL:1m;
            ssl_session_timeout  5m;

            ssl_ciphers  HIGH:!aNULL:!MD5;
            ssl_prefer_server_ciphers  on;

            # Load configuration files for the default server block.
            include /etc/nginx/default.d/*.conf;

    	    location /api/ {
                    proxy_pass http://localhost:4001/api/;
            }

            location / {
           		try_files $uri $uri/ @router;
    		index  index.html index.htm;
    	    }

    	    location @router{
    		    rewrite ^.*$/index.html last;
    	    }

            error_page 404 /404.html;
                location = /40x.html {
            }

            error_page 500 502 503 504 /50x.html;
                location = /50x.html {
            }
        }





}


Guess you like

Origin blog.csdn.net/sinat_36146776/article/details/94748556
Recommended