changed COPY path again :(

This commit is contained in:
AHMZA
2021-12-08 23:08:16 +00:00
parent c50efd625b
commit 25a27184fe
2 changed files with 60 additions and 36 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
FROM nginx:alpine FROM nginx:alpine
COPY public /var/www COPY ./public /var/www
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["nginx","-g","daemon off;"] ENTRYPOINT ["nginx","-g","daemon off;"]
+59 -35
View File
@@ -1,37 +1,61 @@
events {} # auto detects a good number of processes to run
http { worker_processes auto;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $upstream_addr '
'"$http_referer" "$http_user_agent"';
server { #Provides the configuration file context in which the directives that affect connection processing are specified.
listen 80; events {
access_log /var/log/nginx/access.log compression; # Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
root /var/www; # Tells the worker to accept multiple connections at a time
index index.html index.htm; multi_accept on;
}
location / {
try_files $uri $uri/ /index.html;
} http {
# what times to include
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { include /etc/nginx/mime.types;
expires 1M; # what is the default one
access_log off; default_type application/octet-stream;
add_header Cache-Control "public";
} # Sets the path, format, and configuration for a buffered log write
log_format compression '$remote_addr - $remote_user [$time_local] '
location ~* \.(?:css|js)$ { '"$request" $status $upstream_addr '
try_files $uri =404; '"$http_referer" "$http_user_agent"';
expires 1y;
access_log off; server {
add_header Cache-Control "public"; # listen on port 80
} listen 80;
# save logs here
location ~ ^.+\..+$ { access_log /var/log/nginx/access.log compression;
try_files $uri =404;
} # where the root here
} root /var/www;
# what file to server as index
index index.html index.htm;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to redirecting to index.html
try_files $uri $uri/ /index.html;
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# Javascript and CSS files
location ~* \.(?:css|js)$ {
try_files $uri =404;
expires 1y;
access_log off;
add_header Cache-Control "public";
}
# Any route containing a file extension (e.g. /devicesfile.js)
location ~ ^.+\..+$ {
try_files $uri =404;
}
}
} }