D
D
Danil Antoshkin2018-05-07 17:42:04
Nginx
Danil Antoshkin, 2018-05-07 17:42:04

How to optimize the site config?

At the moment it looks like this:

server {
    listen 80;
    listen [::]:80;

    # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
    return 301 https://$host$request_uri;
}

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name git.mauladen.ru www.git.mauladen.ru;

  # Настройки SSL
  ssl_certificate /etc/letsencrypt/live/mauladen.ru/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/mauladen.ru/privkey.pem;

  include /etc/letsencrypt/options-ssl-nginx.conf;


  location / {
      proxy_pass https://git.mauladen.ru:3000;
 }

}

server {
   listen 443 ssl http2;
   listen [::]:443 ssl http2;
   server_name mauladen.ru www.mauladen.ru;
   root /home/mauladen/mauladen.ru/www;
   index index.htm index.html;

  # Настройки SSL
  ssl_certificate /etc/letsencrypt/live/mauladen.ru/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/mauladen.ru/privkey.pem;

  include /etc/letsencrypt/options-ssl-nginx.conf;

  location / {
       # Перенаправление на 404 если нет нужного файла
       try_files $uri $uri/ =404;
  }
 }

There are repetitive moments and it makes me think a little that I'm doing something wrong

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2018-05-07
@TwerTrue

For configs, the rule is not applied - DRY

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question