php - Run Symfony app with Vagrant -
i try run symfony app vagrant, install vagrant, copy symfony app in vagrant folder (vagrantrasmus/clientproject) add in hosts 192.168.7.7 clientproject
, add in client.conf conf.d
server { server_name clientproject; root /vagrantrasmus/clientproject/web; location / { # try serve file directly, fallback app.php try_files $uri /app.php$is_args$args; } # dev # rule should placed on development environment # in production, don't include , don't deploy app_dev.php or config.php location ~ ^/(app_dev|config)\.php(/|$) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; # when using symlinks link document root # current version of application, should pass real # application path instead of path symlink php # fpm. # otherwise, php's opcache may not detect changes # php files (see https://github.com/zendtech/zendoptimizerplus/issues/126 # more information). fastcgi_param script_filename $realpath_root$fastcgi_script_name; fastcgi_param document_root $realpath_root; } # prod location ~ ^/app\.php(/|$) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; # when using symlinks link document root # current version of application, should pass real # application path instead of path symlink php # fpm. # otherwise, php's opcache may not detect changes # php files (see https://github.com/zendtech/zendoptimizerplus/issues/126 # more information). fastcgi_param script_filename $realpath_root$fastcgi_script_name; fastcgi_param document_root $realpath_root; # prevents uris include front controller. 404: # http://domain.tld/app.php/some-path # remove internal directive allow uris internal; } # return 404 other php files not matching front controller # prevents access other php files don't want accessible. location ~ \.php$ { return 404; } error_log /var/log/nginx/project_error.log; access_log /var/log/nginx/project_access.log; }
but, don't work, received 502 bad gateway
.
i change content of client.conf in
server { listen 80; server_name localhost; #root /var/www/default; root /var/www/default/clientproject/web index index.php index.html index.htm; access_log /var/log/nginx/default-access.log main; error_log /var/log/nginx/default-error.log; error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/default; } location / { #try_files $uri /app_dev.php$is_args$args; try_files $uri $uri/ @rewrite; } location @rewrite { rewrite ^(.*)$ /index.php; } location ~ \.php { include fastcgi_params; fastcgi_keep_conn on; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param path_info $fastcgi_path_info; fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/php-fpm.sock; } }
and have in logs
==> /var/log/nginx/default-error.log <== 2016/08/24 08:42:52 [error] 26472#0: *57 connect() unix:/var/run/php-fpm.sock failed (111: connection refused) while connecting upstream, client: 192.168.7.1, server: clientproject, request: "get /app_dev.php/translation http/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "clientproject" ==> /var/log/nginx/default-access.log <== 192.168.7.1 - - [24/aug/2016:08:42:52 +0000] "get /app_dev.php/translation http/1.1" 502 537 "-" "mozilla/5.0 (windows nt 10.0; wow64) applewebkit/537.36 (khtml, gecko) chrome/52.0.2743.116 safari/537.36" "-"
Comments
Post a Comment