1:首先注冊阿里云賬號誊稚,并且購買對應的服務
2:然后可以看到對應的云服務器ECS實例,里面有公網(wǎng)IP和私網(wǎng)IP
image.png
3:然后點擊 實例里面的管理按鈕,進入頁面杂彭,可以看到安全組县耽,實例詳情等,我們配置的端口就在安全組里面包帚,可以新增安全組渔期,也可以修改安全組,
image.png
4:還要重置實例的密碼渴邦,獲取連接服務器的賬戶和密碼疯趟,使用ssh連接服務器
然后登錄ssh ,配置jdk,tomcat,nginx等相關(guān)服務(可以用寶塔實現(xiàn)一鍵部署,沒有試過)
image.png
5:下載ssl證書設(shè)置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