82 lines
3.7 KiB
Plaintext
82 lines
3.7 KiB
Plaintext
# Разработка сайта 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
|
||
}
|