阿里云环境的搭建---小白篇

1:首先注册阿里云账号,并且购买对应的服务

2:然后可以看到对应的云服务器ECS实例,里面有公网IP和私网IP

image.png

3:然后点击 实例里面的管理按钮,进入页面,可以看到安全组,实例详情等,我们配置的端口就在安全组里面,可以新增安全组,也可以修改安全组,

image.png

4:还要重置实例的密码,获取连接服务器的账户和密码,使用ssh连接服务器

然后登录ssh ,配置jdk,tomcat,nginx等相关服务(可以用宝塔实现一键部署,没有试过)


image.png

5:下载ssl证书设置https 下载里面有对应的证书,我选择的是nginx 通过nginx代理tomcat

image.png
6:nginx 配置代理tomcat 配置https

events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;

#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  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;
upstream tomcats {
   server 47.92.0.42:8080;  #集群
}

server {
    listen       80;
    server_name  xianzhuhz.com;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;
    rewrite ^(.*)$ https://$host$1; #将所有HTTP请求通过rewrite指令重定向到HTTPS。
    location / {
        proxy_pass http://tomcats;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}


# HTTPS server
#
server {
    listen       443 ssl;
   server_name  xianzhuhz.com;

     ssl_certificate      ssl/www.xianzhuhz.com.pem;
     ssl_certificate_key  ssl/www.xianzhuhz.com.key;
    
     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
     ssl_session_cache    shared:SSL:1m;
     ssl_session_timeout  5m;
    # ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; 
     ssl_prefer_server_ciphers on;

     location / {
          proxy_pass  http://tomcats;
          index  index.html index.htm;
     }
}

}

7:tomcat 部署spring boot 项目 删掉原来的ROOT 把自己的项目名称改成root tomcat 的配置就可以不需要需改了
image.png

你可能感兴趣的:(阿里云环境的搭建---小白篇)