{"id":338107,"date":"2022-09-08T15:00:28","date_gmt":"2022-09-08T15:00:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338107"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338107","title":{"rendered":"<span>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Nginx, Let&#8217;s Encrypt \u0438 Docker Compose<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/9db\/8d0\/49b\/9db8d049bfb611643dba9b509d1457fd.jpg\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9db\/8d0\/49b\/9db8d049bfb611643dba9b509d1457fd.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0412 \u0441\u0432\u043e\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0437\u0430\u0447\u0435\u043c \u0438 \u043f\u043e\u0447\u0435\u043c\u0443.<\/p>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c Telegram \u0431\u043e\u0442\u0430. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u0442\u0443\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e? \u041d\u0443 \u0440\u0430\u0437 \u043d\u0430\u0434\u043e, \u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0439, \u0433\u0434\u0435 \u0442\u0443\u0442 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438? \u041d\u043e \u0432\u043e\u0442 \u0431\u0435\u0434\u0430, \u0440\u0430\u043d\u0435\u0435 \u044f \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u0430\u0441\u0430\u0435\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0442\u0430\u043a \u043a\u0430\u043a Telegram API \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 HTTPS \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c. \u0423\u0432\u044b \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043b\u0433\u0438\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0430 \u0431\u044b \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u0435\u043f\u043b\u043e\u044f \u0437\u0430\u0442\u044f\u043d\u0443\u043b\u0441\u044f \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e \u043a\u0443\u0441\u043e\u0447\u043a\u0430\u043c. \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0432\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0430\u043c \u0432\u0440\u0435\u043c\u044f \u0438 \u0431\u043e\u043d\u0443\u0441\u043e\u043c 2000 \u0440\u0443\u0431\u043b\u0435\u0439 \u0437\u0430 SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442)<\/p>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0437\u0434\u0435\u0441\u044c \u2014 <a href=\"https:\/\/github.com\/Mark1708\/spring-boot-deploy-with-nginx-example\" rel=\"noopener noreferrer nofollow\">\u0442\u044b\u043a<\/a>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u0434\u0435\u043b\u0430\u043b 3 \u0432\u0435\u0442\u043a\u0438, \u043e \u0441\u043c\u044b\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u043f\u043e\u0439\u043c\u0435\u0442\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f)<\/p>\n<p>\u0418 \u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440<\/h3>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 Ubuntu \u043e\u0442 Timeweb.<\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0435\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Docker \u0438 Docker Compose<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c git \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/p>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043c\u043e\u0433\u0443 \u043f\u043e\u0437\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043a\u0430\u043a \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<\/blockquote>\n<h3>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u044f \u0441\u0434\u0435\u043b\u0430\u043b <a href=\"https:\/\/github.com\/Mark1708\/simple-spring-boot-app\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0441\u0442\u043e\u0435 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a> \u0438 \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0435 H2, \u0430 PostgreSQL + Flyway.<\/p>\n<pre><code class=\"bash\">mkdir spring-boot-deploy-with-nginx-example cd spring-boot-deploy-with-nginx-example\/ git clone git@github.com:Mark1708\/simple-spring-boot-app.git test-deploy<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Dockerfile. \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u0435\u0437 multistage, \u043d\u043e \u043d\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u0438 \u043d\u0435 \u043d\u0430\u0434\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"bash\">FROM maven:3.6.3-jdk-11 AS builder COPY .\/ .\/ RUN mvn clean package -DskipTests FROM openjdk:11.0.7-jdk-slim COPY --from=builder \/target\/simple-spring-boot-app-0.0.1-SNAPSHOT.jar \/app.jar EXPOSE 8080 ENTRYPOINT [\"java\",\"-jar\",\"\/app.jar\"]<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440<\/h3>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c Nginx, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438 \u0434\u0432\u0438\u043d\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e:  <code>mkdir -p nginx\/conf.d<\/code><\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b \u0447\u0435\u0440\u0435\u0437 vim:  <code>vim nginx\/conf.d\/app.conf<\/code><\/p>\n<blockquote>\n<p>\u041d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e vim \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0434\u0435\u043f\u043b\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0451 \u043c\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c<\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0438\u0441\u044c:<\/p>\n<p>&#8212; <code>:set paste<\/code> <em>\u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0435\u0437 \u0430\u0432\u0442\u043e \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432<\/em><\/p>\n<p>&#8212; <code>:set number<\/code> <em>\u0434\u043b\u044f \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u043e\u043a<\/em><\/p>\n<\/blockquote>\n<p>\u0418 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0431\u043b\u043e\u043a:<\/p>\n<pre><code class=\"nginx\">server {  listen 80;  listen [::]:80;   charset utf-8;  access_log off;   root \/var\/www\/html;  server_name domen.ru www.domen.ru;   location \/ {      proxy_pass http:\/\/simple-spring-boot-app:8080;      proxy_set_header Host $host:$server_port;      proxy_set_header X-Forwarded-Host $server_name;      proxy_set_header X-Real-IP $remote_addr;      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  }   location \/static {      access_log   off;      expires      30d;       alias \/simple-spring-boot-app\/static;  }   location ~ \/.well-known\/acme-challenge {      allow all;      root \/var\/www\/html;  } }<\/code><\/pre>\n<blockquote>\n<p>\u0418 \u0434\u0430, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c <code>domen.ru<\/code> \u043d\u0430 \u0432\u0430\u0448 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0434\u043e\u043c\u0435\u043d, \u043b\u0438\u0431\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0435\u0433\u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0438 \u043d\u0435 \u043f\u0430\u0440\u0438\u0442\u044c\u0441\u044f?<\/p>\n<\/blockquote>\n<h3>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439?? <\/p>\n<p>\u041f\u043e\u043a\u0430 \u043d\u0438\u043a\u0442\u043e \u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432 \u0444\u0430\u0439\u043b init.sql \u0432 \u043f\u0430\u043f\u043a\u0435 init.<\/p>\n<p><code>mkdir init &amp;&amp; vim init.sql<\/code><\/p>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 <\/em>\u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<em> <\/em>SQL.<\/p>\n<pre><code class=\"pgsql\">CREATE USER myuser WITH PASSWORD 'pass'; CREATE DATABASE app; GRANT ALL PRIVILEGES ON DATABASE app TO myuser;<\/code><\/pre>\n<h3>\u041a\u0443\u0434\u0430 \u043d\u0430\u043c \u0431\u0435\u0437 Docker Compose?<\/h3>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0438\u043a\u0443\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c \u043c\u044b \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f! \u0418 \u0434\u0430, \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u0435\u043b\u044c\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0441\u0442\u0435\u0433\u043d\u0438\u0442\u0435\u0441\u044c?<\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b docker-compose.yml: <code>vim docker-compose.yml<\/code><\/p>\n<p>\u0418 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435\u043c\u0443 &#171;\u041a\u0430\u043a \u0430\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u043e\u0442\u0434\u043e\u0445\u043d\u0443\u043b \u043b\u0435\u0442\u043e\u043c&#187;<\/p>\n<pre><code class=\"yaml\">version: '3'   services:   nginx:     container_name: nginx     image: nginx:1.13     restart: always     ports:       - 80:80     volumes:       - .\/nginx\/conf.d:\/etc\/nginx\/conf.d       - web-root:\/var\/www\/html       - certbot-etc:\/etc\/letsencrypt       - certbot-var:\/var\/lib\/letsencrypt     networks:       - app-network        certbot:     image: certbot\/certbot     depends_on:       - nginx     container_name: certbot     volumes:       - certbot-etc:\/etc\/letsencrypt       - certbot-var:\/var\/lib\/letsencrypt       - web-root:\/var\/www\/html     command: certonly --webroot --webroot-path=\/var\/www\/html --email pochta@gmail.com --agree-tos --no-eff-email --staging -d domen.ru -d www.domen.ru    postgresql:     container_name: postgresql     image: postgres:12.2-alpine     environment:       POSTGRES_USER: ${POSTGRES_USER}       POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}     ports:       - \"5432:5432\"     restart: always     volumes:       - .\/init:\/docker-entrypoint-initdb.d\/     networks:       - app-network        app:     container_name: simple-spring-boot-app     build:       context: .\/simple-spring-boot-app       dockerfile: Dockerfile     environment:       - \"DB_HOST=postgresql\"       - \"POSTGRES_USER=${POSTGRES_USER}\"       - \"POSTGRES_PASSWORD=${POSTGRES_PASSWORD}\"       - \"SERVER_PORT=8080\"     expose:       - \"8080\"     depends_on:       - nginx       - postgresql     restart: always     networks:       - app-network  volumes:   certbot-etc:   certbot-var:   web-root:          networks:   app-network:     driver: bridge<\/code><\/pre>\n<blockquote>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f <code>domen.ru<\/code> \u043d\u0430 \u0432\u0430\u0448\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0447\u0442\u0443. <strong>PS: \u0441\u0442\u0440\u043e\u043a\u0430 27<\/strong><\/p>\n<\/blockquote>\n<p> \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0435, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0437\u0430 \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u0435 \u0443 \u0432\u0430\u0441 \u0442\u0432\u0435\u0440\u0434\u0430\u044f \u043f\u044f\u0442\u0435\u0440\u043a\u0430!<\/p>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 4 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044f\u0441\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0438\u0445 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e. \u0418\u043c\u0435\u043d\u043d\u043e <code>certbot<\/code> \u0432\u0430\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c 2000 \u20bd \u0432 \u0433\u043e\u0434, \u0437\u0430 \u0447\u0442\u043e \u043d\u0438\u0437\u043a\u0438\u0439 \u043f\u043e\u043a\u043b\u043e\u043d <a href=\"https:\/\/letsencrypt.org\/\" rel=\"noopener noreferrer nofollow\"><em>Let\u2019s Encrypt<\/em><\/a><em>.<\/em><\/p>\n<p>\u0418 \u0434\u0430, \u0447\u0443\u0442\u044c \u043d\u0435 \u0437\u0430\u0431\u044b\u043b. \u041c\u044b \u0436\u0435 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u043e \u0432\u0441\u0451 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e? <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0447\u0443\u0434\u0435\u0441\u043d\u044b\u0439 \u0444\u0430\u0439\u043b .env.<\/p>\n<p><code>vim .env<\/code> <\/p>\n<p> \u0418 \u043f\u0438\u0448\u0435\u043c \u0442\u0443\u0434\u0430 \u0441\u0432\u043e\u0439 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"bash\"># db POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres<\/code><\/pre>\n<h2>\u041d\u0430 \u0441\u0442\u0430\u0440\u0442, \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u0430\u0440\u0448!<\/h2>\n<blockquote>\n<p>\u0421 \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u043d\u0435\u0442!<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0432\u0435\u0441\u0435\u043b\u044c\u0435<\/p>\n<\/blockquote>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u044f docker \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u043d\u0430 \u0435\u0433\u043e \u044f\u0437\u044b\u043a\u0435:<\/p>\n<p><code>docker-compose up -d --build<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u043f\u043e \u043f\u043b\u0430\u043d\u0443, \u0442\u043e \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 &#8212; <em>&#171;http:\/\/domen.ru\/person&#187;<\/em>, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0410 \u0432\u0432\u0435\u0434\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>docker-compose ps -a<\/code> \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u0442\u0430\u0442\u0443\u0441 <code>UP<\/code> \u0443 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043a\u0440\u043e\u043c\u0435 <code>certbot<\/code>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 <code>Exit 0<\/code>.<\/p>\n<blockquote>\n<p>\u041c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b \u043e\u0448\u0438\u0431\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0438 \u0438\u043b\u0438 \u043d\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u043e\u044e \u043f\u0440\u043e\u0441\u044c\u0431\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0438\u043b\u0438 \u043f\u043e\u0447\u0442\u0443 \u043d\u0430 \u0441\u0432\u043e\u0438.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043b\u043e\u0433\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b &#8212; <code>docker-compose logs service_name<\/code><\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0438 \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043a\u0440\u043e\u043c\u0430 Docker. \u0412\u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0438\u0441\u044c:<\/p>\n<p>1. <code>docker system df - total info<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c<\/p>\n<p>2. <code>docker container ls -a \/ docker rm &lt;container_id><\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \/ \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c<\/p>\n<p>3. <code>docker image ls -a \/ docker rmi &lt;image_id><\/code>  &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0438\u043c\u0435\u0434\u0436\u0438 \/ \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c<\/p>\n<p>4. <code>docker system prune<\/code> &#8212; \u0441\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u0434 \u043d\u043e\u043b\u0438\u043a \u0432\u0441\u0435, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0432 \u0434\u043e\u043a\u0435\u0440\u0435<\/p>\n<\/blockquote>\n<p>\u0414\u043b\u044f \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0431\u044f\u0442 \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0431\u044b\u043b\u0438 \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432\u0430\u0448\u0438 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430:<\/p>\n<p><code>docker-compose exec nginx ls -la \/etc\/letsencrypt\/live<\/code><\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0444\u0430\u0439\u043b\u044b: <code>README<\/code> \u0438 <code>domen.ru<\/code><\/p>\n<\/blockquote>\n<h2>\u0412\u043f\u0435\u0440\u0435\u0434, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043f\u0435\u0440\u0435\u0434<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439, \u043f\u043e\u043c\u0435\u043d\u044f\u0432 \u043f\u0430\u0440\u0443 \u0431\u0443\u043a\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u0438: <code>vim docker-compose.yml<\/code><\/p>\n<pre><code class=\"yaml\">...   certbot:     image: certbot\/certbot     depends_on:       - nginx     container_name: certbot     volumes:       - certbot-etc:\/etc\/letsencrypt       - certbot-var:\/var\/lib\/letsencrypt       - web-root:\/var\/www\/html     command: certonly --webroot --webroot-path=\/var\/www\/html --email pochta@gmail.com --agree-tos --no-eff-email --force-renewal -d domen.ru -d www.domen.ru ...<\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u043c <code>--staging<\/code> \u043d\u0430 <code>--force-renewal<\/code><\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c <code>certbot<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b &#8212; <code>docker-compose up --force-recreate --no-deps certbot<\/code><\/p>\n<p>\u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c.<\/p>\n<h2>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e<\/h2>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u0438 \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0435 5 \u0431\u0443\u043a\u0432 HTTPS!<\/p>\n<ol>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c nginx: <code>docker-compose stop nginx<\/code><\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u043a\u043b\u044e\u0447\u0430 Diffie-Hellman: <code>mkdir dhparam<\/code><\/p>\n<\/li>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u044e\u0447: <\/p>\n<p><code>sudo openssl dhparam -out \/home\/myuser\/spring-boot-deploy-with-nginx-example\/dhparam\/dhparam-2048.pem 2048<\/code><\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 nginx: <code>vim nginx\/conf.d\/app.conf<\/code><\/p>\n<pre><code class=\"nginx\">server {         listen 80;         listen [::]:80;         server_name domen.ru www.domen.ru;          location ~ \/.well-known\/acme-challenge {           allow all;           root \/var\/www\/html;         }          location \/ {                 rewrite ^ https:\/\/$host$request_uri? permanent;         } }  server {         listen 443 ssl http2;         listen [::]:443 ssl http2;         server_name domen.ru www.domen.ru;          server_tokens off;          ssl_certificate \/etc\/letsencrypt\/live\/domen.ru\/fullchain.pem;         ssl_certificate_key \/etc\/letsencrypt\/live\/domen.ru\/privkey.pem;          ssl_buffer_size 8k;          ssl_dhparam \/etc\/ssl\/certs\/dhparam-2048.pem;          ssl_protocols TLSv1.2 TLSv1.1 TLSv1;         ssl_prefer_server_ciphers on;          ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;          ssl_ecdh_curve secp384r1;         ssl_session_tickets off;          ssl_stapling on;         ssl_stapling_verify on;         resolver 8.8.8.8;          location \/ {                 try_files $uri @simple-spring-boot-app;         }          location @simple-spring-boot-app {                 proxy_pass http:\/\/simple-spring-boot-app:8080;                 add_header X-Frame-Options \"SAMEORIGIN\" always;                 add_header X-XSS-Protection \"1; mode=block\" always;                 add_header X-Content-Type-Options \"nosniff\" always;                 add_header Referrer-Policy \"no-referrer-when-downgrade\" always;                 add_header Content-Security-Policy \"default-src * data: 'unsafe-eval' 'unsafe-inline'\" always;                 # add_header Strict-Transport-Security \"max-age=31536000; includeSubDomains; preload\" always;                 # enable strict transport security only if you understand the implications         }          root \/var\/www\/html;         index index.html index.htm index.nginx-debian.html; }<\/code><\/pre>\n<blockquote>\n<p>\u0412\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u044e\u0449\u0438\u0435, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u043c\u0435\u043d\u044f\u0442\u044c <code>domen.ru<\/code> \u043d\u0430 \u0441\u0432\u043e\u0439 \u0434\u043e\u043c\u0435\u043d)<\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u0412\u043d\u043e\u0441\u0438\u043c \u043f\u0430\u0440\u0443 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 docker-compose.yml: <code>vim docker-compose.yml<\/code><\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0440\u0442 <code>443<\/code> \u0438 \u0442\u043e\u043c  <code>dhparam<\/code><\/p>\n<pre><code class=\"yaml\">... nginx:     container_name: nginx     image: nginx:1.13     restart: always     ports:       - 80:80       - 443:443  # &lt;======     volumes:       - .\/nginx\/conf.d:\/etc\/nginx\/conf.d       - web-root:\/var\/www\/html       - certbot-etc:\/etc\/letsencrypt       - certbot-var:\/var\/lib\/letsencrypt       - dhparam:\/etc\/ssl\/certs   # &lt;======     networks:       - app-network ...   volumes:   certbot-etc:   certbot-var:   web-root:   dhparam:   # &lt;======     driver: local     driver_opts:       type: none       device: \/home\/myuser\/spring-boot-deploy-with-nginx-example\/dhparam\/       o: bind<\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0432\u043e\u0442 \u043e\u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0432\u044b\u0434\u043e\u0445\u043d\u0438\u0442\u0435 \u0438 \u043d\u0430\u043b\u044c\u0451\u0442\u0435 \u0441\u0435\u0431\u0435 \u0447\u0435\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043a\u0440\u0435\u043f\u0447\u0435 <em>(\u044f \u043f\u0440\u043e \u0447\u0430\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u043e)<\/em>, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c<\/p>\n<p><code>docker-compose up -d --force-recreate --no-deps nginx<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u044e!!! \u0422\u0435\u043f\u0435\u0440\u044c \u0441 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043e\u0447\u043a\u0435 &#8212;<em>&#171;https:\/\/domen.ru\/person&#187;<\/em><\/p>\n<h3>\u0422\u043e, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0441\u0442\u0430\u043b\u0438 \u0433\u0443\u0440\u0443 \u043f\u043e \u0434\u0435\u043f\u043b\u043e\u044e<\/h3>\n<ol>\n<li>\n<p><strong>SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b<\/strong> \u043e\u0442 <code>Certbot<\/code> \u0448\u0442\u0443\u043a\u0430 \u043d\u0435 \u0432\u0435\u0447\u043d\u0430\u044f. \u0418\u0445 \u043d\u0430\u0434\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0435 <strong>90 \u0434\u043d\u0435\u0439<\/strong>, \u0430 \u043b\u0443\u0447\u0448\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0435 60 \u0434\u043d\u0435\u0439<\/p>\n<\/li>\n<li>\n<p><code>Certbot<\/code> \u043f\u0430\u0440\u0435\u043d\u0435\u043a \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u0449\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u043b\u044e\u0431\u0438\u0442 \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c <strong>5 \u0440\u0430\u0437 \u0432 \u043d\u0435\u0434\u0435\u043b\u044e<\/strong> <em>(\u043f\u0440\u0438\u0448\u0435\u043b \u043a \u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u044b\u0442\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c \u043f\u043e\u043a\u0430 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0432 \u0447\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0430, \u0430 \u043f\u0440\u043e 5 \u0434\u043d\u0435\u0439 \u0432\u044b\u0447\u0438\u0442\u0430\u043b \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u0435\u0439 \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430)<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>cron<\/code> \u0438\u043b\u0438 <code>systemd<\/code> \u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  \/usr\/local\/bin\/docker-compose -f \/home\/myuser\/spring-boot-deploy-with-nginx-example\/docker-compose.yml run certbot renew --dry-run \\ &amp;&amp; \/usr\/local\/bin\/docker-compose -f \/home\/myuser\/spring-boot-deploy-with-nginx-example\/docker-compose.yml kill -s SIGHUP nginx<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u0430 \u0434\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0433\u0443\u0440\u0443, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0435\u043b \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0430<\/p>\n<\/li>\n<\/ol>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043b\u0430 \u0432\u0430\u043c \u0432\u0440\u0435\u043c\u044f, \u0430 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u043f\u043e\u0434\u043d\u044f\u043b\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435!)<\/p>\n<p>\u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043e\u043f\u044b\u0442, \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f, \u0430 \u043d\u0435 \u0441\u0443\u0445\u0438\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u0432 README \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435.<\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0441\u043e\u0432\u0435\u0442\u0430\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u0430 \u0442\u0435\u043c\u0430 \u0432 \u043d\u043e\u0432\u0438\u043d\u043a\u0443 \u0438 \u0443\u0432\u0435\u0440\u0435\u043d \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f. <\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u043e \u0440\u0443\u043a\u0438 \u0434\u043e\u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/687210\/\"> https:\/\/habr.com\/ru\/post\/687210\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0412 \u0441\u0432\u043e\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0437\u0430\u0447\u0435\u043c \u0438 \u043f\u043e\u0447\u0435\u043c\u0443.<\/p>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c Telegram \u0431\u043e\u0442\u0430. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u0442\u0443\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e? \u041d\u0443 \u0440\u0430\u0437 \u043d\u0430\u0434\u043e, \u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0439, \u0433\u0434\u0435 \u0442\u0443\u0442 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438? \u041d\u043e \u0432\u043e\u0442 \u0431\u0435\u0434\u0430, \u0440\u0430\u043d\u0435\u0435 \u044f \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u0430\u0441\u0430\u0435\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0442\u0430\u043a \u043a\u0430\u043a Telegram API \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 HTTPS \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c. \u0423\u0432\u044b \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043b\u0433\u0438\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0430 \u0431\u044b \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u0435\u043f\u043b\u043e\u044f \u0437\u0430\u0442\u044f\u043d\u0443\u043b\u0441\u044f \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e \u043a\u0443\u0441\u043e\u0447\u043a\u0430\u043c. \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0432\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0430\u043c \u0432\u0440\u0435\u043c\u044f \u0438 \u0431\u043e\u043d\u0443\u0441\u043e\u043c 2000 \u0440\u0443\u0431\u043b\u0435\u0439 \u0437\u0430 SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442)<\/p>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0437\u0434\u0435\u0441\u044c \u2014 <a href=\"https:\/\/github.com\/Mark1708\/spring-boot-deploy-with-nginx-example\" rel=\"noopener noreferrer nofollow\">\u0442\u044b\u043a<\/a>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u0434\u0435\u043b\u0430\u043b 3 \u0432\u0435\u0442\u043a\u0438, \u043e \u0441\u043c\u044b\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u043f\u043e\u0439\u043c\u0435\u0442\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f)<\/p>\n<p>\u0418 \u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440<\/h3>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 Ubuntu \u043e\u0442 Timeweb.<\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0435\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Docker \u0438 Docker Compose<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c git \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/p>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043c\u043e\u0433\u0443 \u043f\u043e\u0437\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043a\u0430\u043a \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<\/blockquote>\n<h3>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u044f \u0441\u0434\u0435\u043b\u0430\u043b <a href=\"https:\/\/github.com\/Mark1708\/simple-spring-boot-app\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0441\u0442\u043e\u0435 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a> \u0438 \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0435 H2, \u0430 PostgreSQL + Flyway.<\/p>\n<pre><code class=\"bash\">mkdir spring-boot-deploy-with-nginx-example cd spring-boot-deploy-with-nginx-example\/ git clone git@github.com:Mark1708\/simple-spring-boot-app.git test-deploy<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Dockerfile. \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u0435\u0437 multistage, \u043d\u043e \u043d\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u0438 \u043d\u0435 \u043d\u0430\u0434\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"bash\">FROM maven:3.6.3-jdk-11 AS builder COPY .\/ .\/ RUN mvn clean package -DskipTests FROM openjdk:11.0.7-jdk-slim COPY --from=builder \/target\/simple-spring-boot-app-0.0.1-SNAPSHOT.jar \/app.jar EXPOSE 8080 ENTRYPOINT [\"java\",\"-jar\",\"\/app.jar\"]<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440<\/h3>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c Nginx, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438 \u0434\u0432\u0438\u043d\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e:  <code>mkdir -p nginx\/conf.d<\/code><\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b \u0447\u0435\u0440\u0435\u0437 vim:  <code>vim nginx\/conf.d\/app.conf<\/code><\/p>\n<blockquote>\n<p>\u041d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e vim \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0434\u0435\u043f\u043b\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0451 \u043c\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c<\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0438\u0441\u044c:<\/p>\n<p>&#8212; <code>:set paste<\/code> <em>\u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0435\u0437 \u0430\u0432\u0442\u043e \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432<\/em><\/p>\n<p>&#8212; <code>:set number<\/code> <em>\u0434\u043b\u044f \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u043e\u043a<\/em><\/p>\n<\/blockquote>\n<p>\u0418 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0431\u043b\u043e\u043a:<\/p>\n<pre><code class=\"nginx\">server {  listen 80;  listen [::]:80;   charset utf-8;  access_log off;   root \/var\/www\/html;  server_name domen.ru www.domen.ru;   location \/ {      proxy_pass http:\/\/simple-spring-boot-app:8080;      proxy_set_header Host $host:$server_port;      proxy_set_header X-Forwarded-Host $server_name;      proxy_set_header X-Real-IP $remote_addr;      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  }   location \/static {      access_log   off;      expires      30d;       alias \/simple-spring-boot-app\/static;  }   location ~ \/.well-known\/acme-challenge {      allow all;      root \/var\/www\/html;  } }<\/code><\/pre>\n<blockquote>\n<p>\u0418 \u0434\u0430, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c <code>domen.ru<\/code> \u043d\u0430 \u0432\u0430\u0448 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0434\u043e\u043c\u0435\u043d, \u043b\u0438\u0431\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0435\u0433\u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0438 \u043d\u0435 \u043f\u0430\u0440\u0438\u0442\u044c\u0441\u044f?<\/p>\n<\/blockquote>\n<h3>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439?? <\/p>\n<p>\u041f\u043e\u043a\u0430 \u043d\u0438\u043a\u0442\u043e \u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432 \u0444\u0430\u0439\u043b init.sql \u0432 \u043f\u0430\u043f\u043a\u0435 init.<\/p>\n<p><code>mkdir init &amp;&amp; vim init.sql<\/code><\/p>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 <\/em>\u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<em> <\/em>SQL.<\/p>\n<pre><code class=\"pgsql\">CREATE USER myuser WITH PASSWORD 'pass'; CREATE DATABASE app; GRANT ALL PRIVILEGES ON DATABASE app TO myuser;<\/code><\/pre>\n<h3>\u041a\u0443\u0434\u0430 \u043d\u0430\u043c \u0431\u0435\u0437 Docker Compose?<\/h3>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0438\u043a\u0443\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c \u043c\u044b \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f! \u0418 \u0434\u0430, \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u0435\u043b\u044c\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0441\u0442\u0435\u0433\u043d\u0438\u0442\u0435\u0441\u044c?<\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b docker-compose.yml: <code>vim docker-compose.yml<\/code><\/p>\n<p>\u0418 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435\u043c\u0443 &#171;\u041a\u0430\u043a \u0430\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u043e\u0442\u0434\u043e\u0445\u043d\u0443\u043b \u043b\u0435\u0442\u043e\u043c&#187;<\/p>\n<pre><code class=\"yaml\">version: '3'   services:   nginx:     container_name: nginx     image: nginx:1.13     restart: always     ports:       - 80:80     volumes:       - .\/nginx\/conf.d:\/etc\/nginx\/conf.d       - web-root:\/var\/www\/html       - certbot-etc:\/etc\/letsencrypt       - certbot-var:\/var\/lib\/letsencrypt     networks:       - app-network        certbot:     image: certbot\/certbot     depends_on:       - nginx     container_name: certbot     volumes:       - certbot-etc:\/etc\/letsencrypt       - certbot-var:\/var\/lib\/letsencrypt       - web-root:\/var\/www\/html     command: certonly --webroot --webroot-path=\/var\/www\/html --email pochta@gmail.com --agree-tos --no-eff-email --staging -d domen.ru -d www.domen.ru    postgresql:     container_name: postgresql     image: postgres:12.2-alpine     environment:       POSTGRES_USER: ${POSTGRES_USER}       POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}     ports:       - \"5432:5432\"     restart: always     volumes:       - .\/init:\/docker-entrypoint-initdb.d\/     networks:       - app-network        app:     container_name: simple-spring-boot-app     build:       context: .\/simple-spring-boot-app       dockerfile: Dockerfile     environment:       - \"DB_HOST=postgresql\"       - \"POSTGRES_USER=${POSTGRES_USER}\"       - \"POSTGRES_PASSWORD=${POSTGRES_PASSWORD}\"       - \"SERVER_PORT=8080\"     expose:       - \"8080\"     depends_on:       - nginx       - postgresql     restart: always     networks:       - app-network  volumes:   certbot-etc:   certbot-var:   web-root:          networks:   app-network:     driver: bridge<\/code><\/pre>\n<blockquote>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f <code>domen.ru<\/code> \u043d\u0430 \u0432\u0430\u0448\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0447\u0442\u0443. <strong>PS: \u0441\u0442\u0440\u043e\u043a\u0430 27<\/strong><\/p>\n<\/blockquote>\n<p> \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0435, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0437\u0430 \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u0435 \u0443 \u0432\u0430\u0441 \u0442\u0432\u0435\u0440\u0434\u0430\u044f \u043f\u044f\u0442\u0435\u0440\u043a\u0430!<\/p>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 4 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044f\u0441\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0438\u0445 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e. \u0418\u043c\u0435\u043d\u043d\u043e <code>certbot<\/code> \u0432\u0430\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c 2000 \u20bd \u0432 \u0433\u043e\u0434, \u0437\u0430 \u0447\u0442\u043e \u043d\u0438\u0437\u043a\u0438\u0439 \u043f\u043e\u043a\u043b\u043e\u043d <a href=\"https:\/\/letsencrypt.org\/\" rel=\"noopener noreferrer nofollow\"><em>Let\u2019s Encrypt<\/em><\/a><em>.<\/em><\/p>\n<p>\u0418 \u0434\u0430, \u0447\u0443\u0442\u044c \u043d\u0435 \u0437\u0430\u0431\u044b\u043b. \u041c\u044b \u0436\u0435 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u043e \u0432\u0441\u0451 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e? <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0447\u0443\u0434\u0435\u0441\u043d\u044b\u0439 \u0444\u0430\u0439\u043b .env.<\/p>\n<p><code>vim .env<\/code> <\/p>\n<p> \u0418 \u043f\u0438\u0448\u0435\u043c \u0442\u0443\u0434\u0430 \u0441\u0432\u043e\u0439 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"bash\"># db POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres<\/code><\/pre>\n<h2>\u041d\u0430 \u0441\u0442\u0430\u0440\u0442, \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u0430\u0440\u0448!<\/h2>\n<blockquote>\n<p>\u0421 \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u043d\u0435\u0442!<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0432\u0435\u0441\u0435\u043b\u044c\u0435<\/p>\n<\/blockquote>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u044f docker \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u043d\u0430 \u0435\u0433\u043e \u044f\u0437\u044b\u043a\u0435:<\/p>\n<p><code>docker-compose up -d --build<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u043f\u043e \u043f\u043b\u0430\u043d\u0443, \u0442\u043e \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 &#8212; <em>&#171;http:\/\/domen.ru\/person&#187;<\/em>, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0410 \u0432\u0432\u0435\u0434\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>docker-compose ps -a<\/code> \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u0442\u0430\u0442\u0443\u0441 <code>UP<\/code> \u0443 \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043a\u0440\u043e\u043c\u0435 <code>certbot<\/code>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 <code>Exit 0<\/code>.<\/p>\n<blockquote>\n<p>\u041c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b \u043e\u0448\u0438\u0431\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0438 \u0438\u043b\u0438 \u043d\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u043e\u044e \u043f\u0440\u043e\u0441\u044c\u0431\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0438\u043b\u0438 \u043f\u043e\u0447\u0442\u0443 \u043d\u0430 \u0441\u0432\u043e\u0438.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043b\u043e\u0433\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b &#8212; <code>docker-compose logs service_name<\/code><\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0438 \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043a\u0440\u043e\u043c\u0430 Docker. \u0412\u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0438\u0441\u044c:<\/p>\n<p>1. <code>docker system df - total info<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c<\/p>\n<p>2. <code>docker container ls -a \/ docker rm &lt;container_id><\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \/ \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c<\/p>\n<p>3. <code>docker image ls -a \/ docker rmi &lt;image_id><\/code>  &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0438\u043c\u0435\u0434\u0436\u0438 \/ \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c<\/p>\n<p>4. <code>docker system prune<\/code> &#8212; \u0441\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u0434 \u043d\u043e\u043b\u0438\u043a \u0432\u0441\u0435, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0432 \u0434\u043e\u043a\u0435\u0440\u0435<\/p>\n<\/blockquote>\n<p>\u0414\u043b\u044f \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0431\u044f\u0442 \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0431\u044b\u043b\u0438 \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432\u0430\u0448\u0438 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430:<\/p>\n<p><code>docker-compose exec nginx ls -la \/etc\/letsencrypt\/live<\/code><\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0444\u0430\u0439\u043b\u044b: <code>README<\/code> \u0438 <code>domen.ru<\/code><\/p>\n<\/blockquote>\n<h2>\u0412\u043f\u0435\u0440\u0435\u0434, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043f\u0435\u0440\u0435\u0434<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439, \u043f\u043e\u043c\u0435\u043d\u044f\u0432 \u043f\u0430\u0440\u0443 \u0431\u0443\u043a\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043e\u0447\u0438\u043d\u0435\u043d\u0438\u0438: <code>vim docker-compose.yml<\/code><\/p>\n<pre><code class=\"yaml\">...   certbot:     image: certbot\/certbot     depends_on:       - nginx     container_name: certbot     volumes:       - certbot-etc:\/etc\/letsencrypt       - certbot-var:\/var\/lib\/letsencrypt       - web-root:\/var\/www\/html     command: certonly --webroot --webroot-path=\/var\/www\/html --email pochta@gmail.com --agree-tos --no-eff-email --force-renewal -d domen.ru -d www.domen.ru ...<\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u043c <code>--staging<\/code> \u043d\u0430 <code>--force-renewal<\/code><\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c <code>certbot<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b &#8212; <code>docker-compose up --force-recreate --no-deps certbot<\/code><\/p>\n<p>\u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c.<\/p>\n<h2>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e<\/h2>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u0438 \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0435 5 \u0431\u0443\u043a\u0432 HTTPS!<\/p>\n<ol>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c nginx: <code>docker-compose stop nginx<\/code><\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u043a\u043b\u044e\u0447\u0430 Diffie-Hellman: <code>mkdir dhparam<\/code><\/p>\n<\/li>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u044e\u0447: <\/p>\n<p><code>sudo openssl dhparam -out \/home\/myuser\/spring-boot-deploy-with-nginx-example\/dhparam\/dhparam-2048.pem 2048<\/code><\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 nginx: <code>vim nginx\/conf.d\/app.conf<\/code><\/p>\n<pre><code class=\"nginx\">server {         listen 80;         listen [::]:80;         server_name domen.ru www.domen.ru;          location ~ \/.well-known\/acme-challenge {           allow all;           root \/var\/www\/html;         }          location \/ {                 rewrite ^ https:\/\/$host$request_uri? permanent;         } }  server {         listen 443 ssl http2;         listen [::]:443 ssl http2;         server_name domen.ru www.domen.ru;          server_tokens off;          ssl_certificate \/etc\/letsencrypt\/live\/domen.ru\/fullchain.pem;         ssl_certificate_key \/etc\/letsencrypt\/live\/domen.ru\/privkey.pem;          ssl_buffer_size 8k;          ssl_dhparam \/etc\/ssl\/certs\/dhparam-2048.pem;          ssl_protocols TLSv1.2 TLSv1.1 TLSv1;         ssl_prefer_server_ciphers on;          ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;          ssl_ecdh_curve secp384r1;         ssl_session_tickets off;          ssl_stapling on;         ssl_stapling_verify on;         resolver 8.8.8.8;          location \/ {                 try_files $uri @simple-spring-boot-app;         }          location @simple-spring-boot-app {                 proxy_pass http:\/\/simple-spring-boot-app:8080;                 add_header X-Frame-Options \"SAMEORIGIN\" always;                 add_header X-XSS-Protection \"1; mode=block\" always;                 add_header<\/code><\/pre>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-338107","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338107"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338107\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}