Changes in Dockerfile and nginx conf
This commit is contained in:
1 parent
b3ae0298ee
commit
358eee6348
2 files changed
+24
-10
No files matched your search
+11
-6
@@ -1,16 +1,21 @@
|
||||
# Use the official nginx base image
|
||||
# Используем официальный образ nginx
|
||||
FROM nginx
|
||||
|
||||
# Copy the site files from the local /web folder to the container's /usr/share/nginx/html folder
|
||||
# Устанавливаем локаль UTF-8 (решает проблемы внутри контейнера)
|
||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
|
||||
|
||||
# Копируем файлы сайта
|
||||
COPY ./web /usr/share/nginx/html
|
||||
|
||||
# Copy the custom nginx config file
|
||||
# Копируем кастомный конфиг nginx
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Expose port 80 for HTTP traffic
|
||||
# Выставляем правильные разрешения (важно для контейнера!)
|
||||
RUN chmod -R 755 /usr/share/nginx/html && chown -R nginx:nginx /usr/share/nginx/html
|
||||
|
||||
# Открываем порты
|
||||
EXPOSE 80
|
||||
# Expose port 443 for HTTPs traffic
|
||||
EXPOSE 443
|
||||
|
||||
# Start the nginx server
|
||||
# Запускаем nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
+13
-4
@@ -5,8 +5,8 @@ error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 2048; # Увеличено для поддержки большего количества одновременных соединений
|
||||
multi_accept on; # Позволяет принимать несколько новых соединений за раз
|
||||
worker_connections 2048;
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
@@ -22,15 +22,18 @@ http {
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
|
||||
keepalive_timeout 30;
|
||||
client_max_body_size 10M;
|
||||
|
||||
gzip on; # Включает сжатие для ускорения загрузки
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_min_length 1000;
|
||||
gzip_comp_level 2;
|
||||
|
||||
charset utf-8;
|
||||
charset_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/x-javascript;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
@@ -45,6 +48,12 @@ http {
|
||||
autoindex_localtime on;
|
||||
}
|
||||
|
||||
location ~* \.(js)$ {
|
||||
types { application/javascript js; }
|
||||
charset utf-8;
|
||||
add_header Content-Type application/javascript;charset=utf-8;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
Reference in new issue
Block a user