Задать вопрос
@nezzard

Как корректно настроить nginx?

Добрый день, подскажите пожалуйста, как правильно настроить nginx proxy для nuxt js
Сделал по инструкции, но когда пытаюсь протестировать через https://developers.facebook.com/tools/debug или через https://httpstatus.io/
то получаю ошибку 500
Но сам сайт открывается
map $sent_http_content_type $expires {
    "text/html"                 epoch;
    "text/html; charset=utf-8"  epoch;
    default                     off;
}

server {
  listen 80;
  listen [::]:80;
  server_name ricemilkeco.com www.domain.com;
  return 301 https://domain.com$request_uri;
}

server {
    listen ip:443 ssl http2;
    listen [::]:443 ssl http2;
    server_name     domain.com www.domain.com;    # setup your domain here
    ssl_certificate      /home/admin/conf/web/ssl.domain.com.pem;
    ssl_certificate_key  /home/admin/conf/web/ssl.domain.com.key;

    

    gzip            on;
    gzip_types      text/plain application/xml text/css application/javascript;
    gzip_min_length 1000;

    location / {
        expires $expires;

        proxy_redirect                      off;
        proxy_set_header Host               $host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;
        proxy_read_timeout          1m;
        proxy_connect_timeout       1m;
        proxy_pass                          http://127.0.0.1:3000; # set the address of the Node.js instance here
    }

    location /api {
        expires $expires;

        proxy_redirect                      off;
        proxy_set_header Host               $host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;
        proxy_read_timeout          1m;
        proxy_connect_timeout       1m;
        proxy_pass                          http://127.0.0.1:4000/api;
    }
}
  • Вопрос задан
  • 102 просмотра
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ответы на вопрос 1
ky0
@ky0 Куратор тега Nginx
Миллиардер, филантроп, патологический лгун
как правильно настроить nginx proxy для nuxt js

Так же, как и для любого другого бэкенда - proxy_pass, проброс нужных заголовков и всё такое.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы