mod: готово для запуска в docker для dev
This commit is contained in:
81
config/nginx/lpon--external-nginx.conf
Normal file
81
config/nginx/lpon--external-nginx.conf
Normal file
@@ -0,0 +1,81 @@
|
||||
# Разработка сайта LPON.RU
|
||||
# == Конфикурационный файл nginx cadpoint.conf
|
||||
|
||||
# Описываем апстрим-потоки которые должен подключить Nginx
|
||||
# Для каждого сайта надо настроить свйо поток, со своим уникальным именем.
|
||||
# Если будете настраивать несколько python (django) сайтов - измените название upstream
|
||||
|
||||
# конфигурируем сервер
|
||||
server {
|
||||
server_name lpon.ru; # доменное имя сайта
|
||||
listen 443 ssl; # managed by Certbot
|
||||
root /home/web/lpon-ru/public;
|
||||
location = / {
|
||||
try_files /index.html =404;
|
||||
# try_files /index.html;
|
||||
}
|
||||
ssl_certificate /etc/letsencrypt/live/lpon.ru/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/lpon.ru/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
|
||||
charset utf-8; # кодировка по умолчанию
|
||||
access_log /home/web/lpon-ru/logs/lpon-access.log; # логи с доступом
|
||||
error_log /home/web/lpon-ru/logs/lpon-error.log; # логи с ошибками
|
||||
client_max_body_size 100M; # максимальный объем файла для загрузки на сайт (max upload size)
|
||||
error_page 404 /404.html;
|
||||
error_page 500 /500.html;
|
||||
|
||||
location /media { alias /home/web/lpon-ru/public/media; } # Расположение media-файлов Django
|
||||
location /static { alias /home/web/lpon-ru/public/static; } # Расположение static-файлов Django
|
||||
|
||||
location /robots.txt { root /home/web/lpon-ru/public; } # Расположение robots.txt
|
||||
location /favicon.ico { root /home/web/lpon-ru/public; } # Расположение favicon.ico
|
||||
location /favicon.gif { root /home/web/lpon-ru/public; } # Расположение favicon
|
||||
location /favicon.png { root /home/web/lpon-ru/public; } # Расположение favicon
|
||||
# location /favicon.svg { root /home/web/lpon-ru/public; } # Расположение favicon
|
||||
# location /author.txt { root /home/web/lpon-ru/public; } # Расположение author.txt
|
||||
location = /404.html {
|
||||
root /home/web/lpon-ru/index.html;
|
||||
internal;
|
||||
}
|
||||
# location = /500.html {
|
||||
# root /home/web/cadpoint/cadpoint/templates/500.html;
|
||||
# internal;
|
||||
# }
|
||||
location ~ \.(html|htm|ico|svg|png|gif|jpg|jpeg)$ {
|
||||
root /home/web/lpon-ru/public; # Расположение статичных *.xml, *.html и *.txt
|
||||
}
|
||||
}
|
||||
|
||||
# переадресация с www на "без" www
|
||||
server {
|
||||
server_name www.lpon.ru;
|
||||
return 301 http://lpon.ru$request_uri;
|
||||
|
||||
listen 443 ssl; # managed by Certbot
|
||||
ssl_certificate /etc/letsencrypt/live/lpon.ru/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/lpon.ru/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
}
|
||||
|
||||
# переадресация с http на https
|
||||
server {
|
||||
if ($host = lpon.ru) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
server_name lpon.ru;
|
||||
listen 80;
|
||||
return 404; # managed by Certbot
|
||||
}
|
||||
|
||||
# переадресация с http на https для www
|
||||
server {
|
||||
if ($host = www.lpon.ru) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
server_name www.lpon.ru;
|
||||
listen 80;
|
||||
return 404; # managed by Certbot
|
||||
}
|
||||
50
config/nginx/lpon--internal-nginx.conf
Normal file
50
config/nginx/lpon--internal-nginx.conf
Normal file
@@ -0,0 +1,50 @@
|
||||
# --- ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ ---
|
||||
# sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
# keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
# MIME-типы и кодировка по умолчанию
|
||||
include /etc/nginx/mime.types;
|
||||
# default_type application/octet-stream;
|
||||
|
||||
# Настройки логов
|
||||
access_log /dev/stdout;
|
||||
error_log /dev/stderr warn;
|
||||
|
||||
# Настройки сжатия gzip
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_disable "msie6";
|
||||
gzip_vary on;
|
||||
gzip_min_length 512;
|
||||
gzip_types text/plain
|
||||
text/css
|
||||
application/json
|
||||
application/x-javascript
|
||||
text/xml application/xml
|
||||
application/xml+rss
|
||||
text/javascript
|
||||
application/javascript
|
||||
application/vnd.ms-fontobject
|
||||
application/x-font-ttf
|
||||
font/opentype
|
||||
image/svg+xml
|
||||
image/x-icon;
|
||||
|
||||
# --- КОНФИГУРАЦИЯ СЕРВЕРА ---
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user