Xubuntu 14.04 시스템의 로컬 디렉토리에 Heroku PHP 프로젝트가 있습니다.우분투에서 Foreman과 함께 Heroku PHP 프로젝트를 로컬에서 실행할 때 권한이 올바르지 않습니다.
Heroku에서 배포하기 전에 개발/테스트하기 위해 로컬로 실행하고 싶습니다.
우선 프로젝트 디렉토리에 cd를 시도하고 foreman start web
을 실행했습니다.
일부 누락 된 패키지와 PHP 버전에 관련된 오류가 있었다 그래서 나는 한 다음
1). 사용자 정의 PPA에서 설치된 최신 PHP 버전 (PPA : 드레이/PHP5) :
php --version
PHP 5.5.18-1+deb.sury.org~trusty+1 (cli) (built: Oct 17 2014 15:20:47)
.
2). php5-fpm
바이너리에 대한 심볼릭 링크를 생성 :
sudo ln -s /usr/sbin/php5-fpm /usr/local/bin/php-fpm
3). nginx 설치
4).
web: vendor/bin/heroku-php-nginx /web
다음, 내가 사용하여 서버를 시작하려고 해요 : foreman start web
명령을 나는 다음과 같은 출력 받고 있어요 : 분명히, 그것은 '할 수
02:38:23 web.1 | started with pid 15815
02:38:23 web.1 | Booting on port 5000...
02:38:23 web.1 | DOCUMENT_ROOT changed to '/web/'
02:38:24 web.1 | Starting php-fpm...
02:38:24 web.1 | Starting nginx...
02:38:24 web.1 | [06-Nov-2014 02:38:24] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
02:38:24 web.1 | [06-Nov-2014 02:38:24] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
02:38:26 web.1 | nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
02:38:26 web.1 | 2014/11/06 02:38:26 [warn] 15897#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
02:38:26 web.1 | 2014/11/06 02:38:26 [emerg] 15897#0: open() "/var/log/nginx/access.log" failed (13: Permission denied)
02:38:26 web.1 | Process exited unexpectedly: nginx
02:38:26 web.1 | Going down, terminating child processes...
02:38:26 web.1 | vendor/bin/heroku-php-nginx: line 282: 15891 Terminated tail -qF -n 0 "${logs[@]}"
02:38:26 web.1 | 15892 | strip_fpm_child_said 1>&2
02:38:26 web.1 | exited with code 1
02:38:26 system | sending SIGTERM to all processes
을 Procfile 변경 루트 사용자가 소유 한 로그 파일에 액세스 할 수 없기 때문에 시작하지 마십시오.
다음으로, sudo는 사용하여 시작하려고 해요 : sudo foreman start web
를 다음과 같은 출력을 얻기 : 그것은 그 Nginx에 서비스가 실행되지 같이하는 것처럼
02:43:29 web.1 | started with pid 16153
02:43:30 web.1 | Booting on port 5000...
02:43:30 web.1 | DOCUMENT_ROOT changed to '/web/'
02:43:30 web.1 | Starting php-fpm...
02:43:30 web.1 | Starting nginx...
02:43:32 web.1 | nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
02:43:32 web.1 | nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
02:43:32 web.1 | nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
02:43:32 web.1 | nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
02:43:33 web.1 | nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
02:43:33 web.1 | nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
02:43:33 web.1 | nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
02:43:33 web.1 | nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
02:43:34 web.1 | nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
02:43:34 web.1 | nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
02:43:34 web.1 | nginx: [emerg] still could not bind()
02:43:34 web.1 | Process exited unexpectedly: nginx
02:43:34 web.1 | Going down, terminating child processes...
02:43:34 web.1 | vendor/bin/heroku-php-nginx: line 282: 16229 Terminated tail -qF -n 0 "${logs[@]}"
02:43:34 web.1 | 16230 | strip_fpm_child_said 1>&2
02:43:34 web.1 | exited with code 1
02:43:34 system | sending SIGTERM to all processes
보인다. 왜 그런가요?
sudo service nginx stop
을 사용하여 웹 서버를 끈 다음 다시 시도하십시오.
이번에는 오류 메시지가없고 서버가 실행중인 것 같습니다.
그러나 브라우저에서 웹 페이지를로드 할 때 HTTP가 수신되고 있습니다. 502 불량 게이트웨이 오류.
2014/11/06 02:45:44 [crit] 16342#0: *1 connect() to unix:/tmp/heroku.fcgi.5000.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET/HTTP/1.1", upstream: "fastcgi://unix:/tmp/heroku.fcgi.5000.sock:", host: "localhost:5000"
: 그의 nginx는 FastCGI를 소켓 파일을 액세스 할 수 없습니다 볼 수의 nginx 오류 로그에서
소켓 파일은 root
이고, nginx는 www-data
입니다.
이유는 무엇입니까?이 문제를 해결하려면 어떻게해야합니까? 루트가 아닌 내 사용자로부터 Heroku를 로컬로 실행할 수 있습니까?
해당 로그 파일에 대해 어떤 사용 권한을 설정 했습니까? –
chmod 666이 트릭을하는 것처럼 보였습니다. –
다른 사람들이 이것을 보게되면 https://berezovskyi.me/2015/02/deploying-sample-silex-app-to-heroku/의 끝에 수정 사항이 있습니다 : 다른 터미널을 병렬로 열고'sudo chmod 0667/tmp/heroku.fcgi.5000.sock' –