2012-06-07 6 views
12

Con nginx/0.7.65 Ricevo questo errore sulla linea 4. Perché non riconosce server?direttiva sconosciuta "server" in /etc/nginx/nginx.conf:4

#### CHAT_FRONT #### 

server { 
    listen 7000 default deferred; 
    server_name example.com; 
    root /home/deployer/apps/chat_front/current/public; 

    location ^~ /assets/ { 
    gzip_static on; 
    expires max; 
    add_header Cache-Control public; 
    } 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

#### CHAT_STORE #### 

server { 
    listen 7002 default deferred; 
    server_name store.example.com; 
    root /home/deployer/apps/chat_store/current/public; 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

#### LOGIN #### 

server { 
    listen 7004 default deferred; 
    server_name login.example.com; 
    root /home/deployer/apps/login/current/public; 

    location ^~ /assets/ { 
    gzip_static on; 
    expires max; 
    add_header Cache-Control public; 
    } 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

#### PERMISSIONS #### 

server { 
    listen 7006 default deferred; 
    server_name permissions.example.com; 
    root /home/deployer/apps/permissions/current/public; 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

#### SEARCH #### 

server { 
    listen 7008 default deferred; 
    server_name search.example.com; 
    root /home/deployer/apps/search/current/public; 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

#### ANALYTICS #### 

server { 
    listen 7010 default deferred; 
    server_name analytics.example.com; 
    root /home/deployer/apps/analytics/current/public; 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

risposta

23

La direttiva server devono essere contenuti nel contesto del modulo http. Inoltre, ti manca il modulo eventi di livello superiore, che ha un'impostazione obbligatoria, e un mucchio di strofe che devono essere nel modulo http della tua configurazione. Mentre nginx documentation non è particolarmente utile per creare config da zero, ci sono working examples lì.

Fonte: nginx documentation on server directive

+1

Ci sono altre impostazioni all'interno della direttiva http che dovrò fare o semplicemente avvolgerla? – Chris

+3

ora ho la sezione "no" eventi nella configurazione' – Chris

+1

http://wiki.nginx.org/FullExample prova questo. Il modulo Eventi è usato per dire a nginx come gestire le connessioni (per esempio, quante connessioni un lavoratore può tenere contemporaneamente - in effetti, è l'unica stanza obbligatoria da 'eventi'). Un po 'più di aiuto può essere trovato su http://wiki.nginx.org/Configuration –

7

Aggiunta di una voce di livello superiore ha ottenuto il problema:

events { } 
0

ho riscritto il file * .conf e ha funzionato.

Problemi correlati