Задать вопрос
Ответы пользователя по тегу Nginx
  • Как верно настроить Nginx & Node + socket.io?

    @ofstudio
    У меня приложение на meteor.js — там у него внутри сокеты как раз. Настройки такие

    # =========================== live.wcs.life ===========================
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }
    
    server {
        server_name live.wcs.life www.live.wcs.life;
        listen 80;
        access_log /srv/www/logs/live.wcs.life.access.log;
        error_log /srv/www/logs/live.wcs.life.error.log;
        location / {
            proxy_pass http://127.0.0.1:8888;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade; # allow websockets
            proxy_set_header Connection $connection_upgrade;
            proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
    
            # This setting allows the browser to cache the application in a way compatible 
            # with Meteor on every applicaiton update the name of CSS and JS file is different,
            # so they can be cache infinitely (here: 30 days)
            # The root path (/) MUST NOT be cached
             if ($uri != '/') {
                 expires 30d;
             }    
        } 
    
    }
    Ответ написан
    Комментировать