Browse Source

Изменения в конфигурационных файлах и файле сборки

OBT-SYSADM\tomishinets 6 years ago
parent
commit
548347c9bf
2 changed files with 10 additions and 16 deletions
  1. 3 1
      Dockerfile
  2. 7 15
      default.conf

+ 3 - 1
Dockerfile

@@ -1,14 +1,16 @@
 FROM centos:7.4.1708
 COPY nginx.repo /etc/yum.repos.d/nginx.repo
+ARG git_dir=pki
 RUN yum install -y epel-release \
     && yum install yum-utils python2-certbot-nginx openssl ca-certificates nginx -y \
     && yum install -y https://centos7.iuscommunity.org/ius-release.rpm \
     && yum install -y git2u \
     && mkdir -p /var/www/html/.well-known \
+    && mkdir -p /${git_dir} \
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log
 #COPY cli.ini /etc/letsencrypt/
 COPY default.conf /etc/nginx/conf.d/
-COPY pki/letsencrypt/ /etc/letsencrypt/
+COPY ${git_dir}/letsencrypt/ /${git_dir}/letsencrypt/
 EXPOSE 80
 CMD ["nginx", "-g", "daemon off;"]

+ 7 - 15
default.conf

@@ -1,17 +1,9 @@
 server {
-	listen 80;
-#	listen [::]:80 default_server;
-        location /.well-known {
-            root /var/www/html;
-        }
-
-	# Everything is a 404
-	location / {
-		return 404;
-	}
-
-	# You may need this to prevent return 404 recursion.
-	location = /404.html {
-		internal;
-	}
+					listen 80;
+        	location /.well-known {
+            	root /var/www/html;
+        	}
+					location / {
+		      		return 301 https://$host$request_uri;  # enforce https
+					}
 }