более корректный пример

1 parent fd8a8226
Pipeline #1985 for 660be5af skipped in 0 seconds
Showing 1 changed file with 27 additions and 10 deletions
server { server {
# слушаем порты и настраиваем SSL:
listen 80; listen 80;
server_name ggg.ashmanov.com;
server_tokens off;
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
# запросы acme-challenge
location ~ ^/\.well-known/acme-challenge/([a-zA-Z0-9_-]*)$ {
default_type "text/plain";
alias /var/cache/acme/challenges/$1;
}
# остальные запросы
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443 ssl; listen 443 ssl;
server_name ggg.ashmanov.com;
server_tokens off;
access_log /var/log/nginx/gitlab_ssl_access.log;
error_log /var/log/nginx/gitlab_ssl_error.log;
# сертификаты для сервера
ssl_certificate /var/cache/acme/site.crt; ssl_certificate /var/cache/acme/site.crt;
ssl_certificate_key /var/cache/acme/site.key; ssl_certificate_key /var/cache/acme/site.key;
...@@ -12,14 +34,9 @@ server { ...@@ -12,14 +34,9 @@ server {
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY; add_header X-Frame-Options DENY;
# запросы acme-challenge if ($http_host != $server_name) {
location ~ ^/\.well-known/acme-challenge/([a-zA-Z0-9_-]*)$ { return 301 https://$server_name$request_uri;
default_type "text/plain";
alias /var/cache/acme/challenges/$1;
} }
# редирект на https include gitlab.conf;
if ($scheme != https) {
rewrite ^ https://$http_host$request_uri permanent;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!