2016-10-27 4 views
0

그러나 시작 nginx를 실패하고 내 로그 보여줍니다 : 내가 잘못 뭐하는 거지nginx가 시작되지 않는 이유는 무엇입니까?

[emerg] 55#55: "server" directive is not allowed here in /etc/nginx/nginx.conf:1 

? 중요한지 확실하지 않지만 이것은 항만 컨테이너 안에 있습니다.

+0

설정을 보지 않고서는 불가능할 수도 있습니다 ... 아마도 당신의 서버 지시문을 잘못된 위치에서 처리 할 수 ​​있습니다. – Brad

답변

1

/etc/nginx/nginx.conf은 서버 설정을 저장할 장소가 아닙니다. 이 파일에는 실행되는 사용자 및 기타 전역 설정에 대한 정보가 들어 있어야합니다. 일반적으로는 다음과 같은 것들을 포함합니다 : 당신이 당신의 개별 서버 설정을 넣어해야

user www-data; 
worker_processes 4; 
pid /run/nginx.pid; 

events { 
    worker_connections 768; 
} 

http { 
    sendfile on; 
    tcp_nopush on; 
    tcp_nodelay on; 
    keepalive_timeout 65; 
    types_hash_max_size 2048; 
    server_tokens off; 
    client_max_body_size 500M; 

    include /etc/nginx/mime.types;  
    default_type application/octet-stream; 

    access_log /var/log/nginx/access.log; 
    error_log /var/log/nginx/error.log; 

    gzip on; 
    gzip_disable "msie6"; 

    include /etc/nginx/conf.d/*.conf; 
    include /etc/nginx/sites-enabled/*; 
} 

/etc/nginx/sites-enabled/입니다. 보시다시피 해당 폴더의 모든 파일은 nginx.conf 파일의 http 블록에 포함됩니다.

게시 한 샘플 구성을 /etc/nginx/sites-enabled/some-random-name.conf 안에 저장하고 nginx.conf 파일을 위에 게시 된 구성으로 복원하면 좋은 결과를 얻을 수 있습니다.

관련 문제