Ответы пользователя по тегу Одностраничное приложение
  • Как настроить сервер на работу двух отдельных приложений?

    мои конфиг nginx, может пригодится. Без докера, бэк на рельсах и фронт vue
    map $sent_http_content_type $expires {
      "text/html" epoch;
      "text/html; charset=utf-8" epoch;
      default off;
    }
    
    map $cookie_SESSION $logme {
        "" $perhaps;  # If the cookie is missing, we log if $perhaps
        default   0;
    }
    
    map $status $loggable {
        ~^[23]  0;
        default 1;
    }
    
    split_clients $request_id $perhaps {
        1%        1;  # $perhaps is true 1% of the time
        *         0;
    }
    
    server {
      listen 443 ssl http2;
      server_name .medicus72.ru;
    
      set $rails_api /home/medicus/medicus-api;
    
      root $rails_api/current/public;
    
      # listen [::]:443 ssl;
    
      gzip on;
      gzip_types text/plain application/xml text/css application/javascript;
      gzip_min_length 1000;
    
      try_files $uri @nuxt;
    
      location @nuxt {
        proxy_pass http://lombd.ru-central1.internal:4000; # set the adress of the Node.js instance here
    
        include proxy_params;
        access_log /home/medicus/medicus72.ru/shared/logs/$host.log main;
        access_log /home/medicus/medicus72.ru/shared/logs/sslparams.log sslparams if=$logme;
        expires $expires;
      }
    
      location ~ ^/(api|rails) {
        proxy_pass http://lombd.ru-central1.internal:4001;
    
        include proxy_params;
        access_log /home/medicus/medicus-api/shared/log/$host.log main;
      }
    
      location ~ ^/(assets|packs) {
        expires max;
        gzip_static on;
      }
    
      location ~ \.php$ { deny all; }
    
      ssl_certificate /etc/letsencrypt/live/prd.medicus72.ru/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/prd.medicus72.ru/privkey.pem;
      ssl_trusted_certificate /etc/letsencrypt/live/prd.medicus72.ru/chain.pem;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
      # include /etc/letsencrypt/options-ssl-nginx.conf;
    }
    Ответ написан
    Комментировать