2016-08-16 2 views
0

나는 내 레일 프로젝트에서의 Nginx의 마지막 안정 버전 (1.10)레일, Nginx에 배포 넣지 않는 응용 프로그램

를 설치 한 나는 nginx.conf 파일을 만든 : 내가 통해 내 레일 응용 프로그램을 배포해야

upstream puma_myapp { 
    server unix:///var/www/myapp/shared/tmp/sockets/myapp.sock; 
} 

server { 
    listen 80 default_server deferred; 
    # server_name example.com; 

    root /var/www/myapp/current/public; 
    access_log /var/www/myapp/current/log/nginx.access.log; 
    error_log /var/www/myapp/current/log/nginx.error.log info; 

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

    try_files $uri/index.html $uri @puma; 
    location @puma { 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header Host $http_host; 
    proxy_redirect off; 

    proxy_pass http://puma_myapp; 
    } 

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

을 카피 스트라 노. 그것은 내 응용을 deamonized.

/etc/nginx에는 sites-enabled 폴더가 없습니다. 왜 이런 일이, 내 페이지 주소를 열면

sudo service nginx restart 

, 나는 아직도의 nginx의 기본 페이지를 얻을 : 다음

sudo ln -nfs "/var/www/myapp/current/config/nginx.conf" "/etc/nginx/sites-enabled/myapp" 

내가 내 nginx를 다시 시작 : 그때 내가 이것을 쓴이 폴더를 만들었습니다?

puma.rb 파일은 다음과 같습니다

2016/08/16 10:07:01 [error] 10157#10157: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 178.88.194.6, server: localhost, $ 
2016/08/16 10:14:49 [error] 10157#10157: *3 open() "/usr/share/nginx/html/phpMyAdmin/scripts/setup.php" failed (2: No such file or directory), client: 203.110.167.86, $ 
2016/08/16 10:14:55 [error] 10157#10157: *4 open() "/usr/share/nginx/html/pma/scripts/setup.php" failed (2: No such file or directory), client: 203.110.167.86, server:$ 
2016/08/16 10:15:00 [error] 10157#10157: *5 open() "/usr/share/nginx/html/myadmin/scripts/setup.php" failed (2: No such file or directory), client: 203.110.167.86, ser$ 
2016/08/16 10:36:20 [error] 26599#26599: *1 open() "/usr/share/nginx/html/admin" failed (2: No such file or directory), client: 178.88.194.6, server: localhost, reques$ 
2016/08/16 10:42:11 [error] 27962#27962: *1 open() "/usr/share/nginx/html/admin" failed (2: No such file or directory), client: 178.88.194.6, server: localhost, reques$ 
+0

'puma.rb'도 게시 할 수 있습니까? – slowjack2k

+0

이제'sites-enabled' 폴더가 없다는 작은 힌트를 알게되었습니다. 어떤 운영 체제를 사용합니까? 패키지 관리자를 통해 nginx를 설치 했습니까? 'sites-enabled'가 종료되지 않으면 nginx가'sites-enabled' 내에 configs를 포함하지 않고 nginx.conf 내에'include/etc/nginx/sites-enabled/*;'를 추가해야 함을 의미 할 수 있습니다 – slowjack2k

+0

unicorn puma.rb 파일에서'bind' 대신'listen'을 사용 해보십시오. 퓨마 에러 로그의 결과는 무엇입니까? '/ var/log/nginx/error.log' 또는 위에서 지정한 다른 로그에서 nginx에 오류가 있습니까? – yekta

답변

1

sites-enabled 디렉토리는 데비안 패키지 특정 기능입니다. 다른 nginx 패키지를 설치하거나 사용자가 직접 빌드 한 경우 nginx.conf에는 include /etc/nginx/sites-en‌​a‌​bled/*; 지시문이 포함되어 있지 않으며이 디렉토리의 구성 파일은 포함되어 있지 않습니다.

+0

나는 시스템 패키지에서 직접 설치하는 것이 최선의 방법이라고 덧붙일 것이다. a)이 같은 이상한 문제에 부딪치지 말고, b) 보안 업데이트를 최신 상태로 유지하는 것이 더 쉬워 져야한다. nginx. – yekta

1

puma.rb 내에서 바인드 소켓이 질문 업데이트 후 nginx.conf

편집 내에서 소켓과 일치하지 않습니다

#!/usr/bin/env puma 

directory '/var/www/myapp/current' 
rackup "/var/www/myapp/current/config.ru" 
environment 'production' 

pidfile "/var/www/myapp/shared/tmp/pids/puma.pid" 
state_path "/var/www/myapp/shared/tmp/pids/puma.state" 
stdout_redirect '/var/www/myapp/current/log/puma.error.log', '/var/www/myapp/current/log/puma.access.log', true 



threads 4,16 

bind 'unix:///var/www/myapp/shared/tmp/sockets/myapp.sock 

workers 0 

var/log/nginx/error.log 파일이 표시됩니다 :

PMA? plesk를 사용하여 시스템을 관리하는 것 같습니다. plesk은 많은 것을 생성합니다. plesk가 configs를 원하는 곳에서 확인해야합니다.

+0

좋아요, nginx.conf의 경우'unix : /var/www/myapp/shared/tmp/sockets/myapp.sock;'로 충분해야합니다. '/'를 추가 할 때 이것이 문제가되는지 나는 모른다. 'puma.error.log' 또는'nginx.error.log info'가 정보를 제공합니까? – slowjack2k

+0

'puma.error.log'는 악마 화 된 메시지를 보여줍니다. 흥미로운 점은'nginx.error.log' 파일이 없다는 것입니다. 그것은 nginx가'sites-enabled' 폴더를 무시하는 것과 같습니다. 다른 VPS에서 제대로 작동하는 NGINX 1.4 버전이 있었지만,이 버전에서 1.10 버전이 위치하면 이런 일이 발생합니다. –

+1

설정이 포함되지 않았을 것입니다. – slowjack2k