質問: debianvagrantボックスでphpおよびnginxを使用してセッションを書き込もうとしたときに、502 badgateway vagrantボックスと_debian 8.5_を、次のスタッフパッケージで使用しています。_tmux curl wget nginx php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-intl php7.0-mysql php7.0-memcached memcached php-mbstring php-xml mariadb-server nodejs git unzip zip_私の問題は、任意のディレクトリにセッションを書き込もうとすると(ログイン後など)、_502 bad gateway_エラーが発生することです。_/var/log/nginx/error.log_の内容は次のとおりです2016/07/18 21:31:59 [error] 15674#15674: *8 recv() failed (104: connection reset by peer) while reading response header from upstream, client: 192.168.60.1, serverデバッグログを有効にすると これが出力です 。問題は、ファイルがディレクトリに書き込まれ、内容も含まれているため、アクセス許可の問題ではないと思います。しかし、私はまだ502を取得します。私のvhostconf_## # you should look at the following url's in order to grasp a solid understanding # of nginx configuration files in order to fully unleash the power of nginx. # http://wiki.nginx.org/pitfalls # http://wiki.nginx.org/quickstart # http://wiki.nginx.org/configuration # # generally, you will want to move this file somewhere, and start with a clean # file but keep this around for reference. or just disable in sites-enabled. # # please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/project/www/web; index app_dev.php # important for virtualbox sendfile off; # make site accessible from http://www.project.dev/ server_name www.project.dev; location / { try_files $uri $uri/ /app_dev.php$is_args$args; } # pass the php scripts to fastcgi server listening on /var/run/php/php7.0-fpm.sock location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_cache off; fastcgi_index app_dev.php; fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_buffer_size 1024k; fastcgi_buffers 4 2048k; fastcgi_busy_buffers_size 2048k; } } _私の放浪者bootstrapスクリプト_#!/usr/bin/env bash projectname='project' projectpath="/var/www/$projectname/www" r_password=password u_password=secret echo "initial update of the box" apt-get update cp ${projectpath}/vagrant_ressources/locale.gen /etc/ locale-gen de_de.utf-8 echo -e 'lang=de_de.utf-8\nlc_all=de_de.utf-8' > /etc/default/locale timedatectl set-timezone europe/berlin mkdir -p ${projectpath}/static echo "adding dotdeb repository" cp ${projectpath}/vagrant_ressources/sources.list /etc/apt/ wget https://www.dotdeb.org/dotdeb.gpg apt-key add dotdeb.gpg apt-get update echo "installing php 7.0 tools and extra software (tmux, curl, wget, nginx, fpm, cli, curl, gd, intl)" apt-get install -y tmux curl wget nginx php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-intl php7.0-mysql php7.0-memcached memcached echo "installing laravel dependent stuff" apt-get install -y php-mbstring php-xml echo "creating user and setting permissions" adduser --disabled-login ${projectname} adduser www-data ${projectname} chown -rf ${projectname}:${projectname} ${projectpath} chmod 755 ${projectpath}/ chmod 750 ${projectpath}/web chmod 750 ${projectpath}/static echo "initializing database" debconf-set-selections <<< "mariadb-server-10.0 mysql-server/root_password password $r_password" debconf-set-selections <<< "mariadb-server-10.0 mysql-server/root_password_again password $r_password" apt-get install -y mariadb-server /etc/init.d/mysql restart # allow remote access (required to access from our private network host. note that this is completely insecure if used in any other way) mysql -u root -p${r_password} -e "grant all privileges on *.* to 'root'@'%' identified by '$r_password' with grant option; flush privileges;" mysql -u root -p${r_password} -e "create database $projectname character set utf8;" mysql -u root -p${r_password} -e "create user '$projectname'@'%' identified by '$u_password';" mysql -u root -p${r_password} -e "grant all privileges on $projectname.* to '$projectname'@'%';" echo "setting up nginx" cp ${projectpath}/vagrant_ressources/${projectname} /etc/nginx/sites-available/${projectname} ln -s /etc/nginx/sites-available/${projectname} /etc/nginx/sites-enabled/ rm -rf /etc/nginx/sites-available/default echo "setting up nodejs" curl --silent --location https://deb.nodesource.com/setup_0.12 | bash - apt-get install --yes nodejs npm install -g gulp echo "setting up composer" apt-get install -y git unzip zip php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php php composer-setup.php php -r "unlink('composer-setup.php');" mv composer.phar /usr/local/bin/composer echo "====================================================================================================" echo "installation finished. run composer install in your working dir: $projectpath" echo "====================================================================================================" service nginx restart _さらに情報が必要な場合は、お知らせします。聞いてください。[〜#〜]更新[〜#〜] debianからubuntuに切り替えたばかりですが、問題はまだ存在するため、debianの問題ではありません(symfonyからlaravelに切り替えたので、symfony/laravelの問題でもありません)。これは、おそらくvagrant、nfsである可能性があることを意味しますか?またはnginx正しくないことをしているlaravelを使用する場合、これはログです。_[2016-07-23 19:03:56] local.error: errorexception: file_put_contents(): exclusive locks are not supported for this stream in /var/www/project/www/vendor/laravel/framework/src/illuminate/filesy$ stack trace: #0 [internal function]: illuminate\foundation\bootstrap\handleexceptions->handleerror(2, 'file_put_conten...', '/var/www/pingpo...', 109, array) #1 /var/www/project/www/vendor/laravel/framework/src/illuminate/filesystem/filesystem.php(109): file_put_contents('/var/www/pingpo...', 'a:4:{s:6:"_toke...', 2) #2 /var/www/project/www/vendor/laravel/framework/src/illuminate/session/filesessionhandler.php(83): illuminate\filesystem\filesystem->put('/var/www/pingpo...', 'a:4:{s:6:"_toke...', true) #3 /var/www/project/www/vendor/laravel/framework/src/illuminate/session/store.php(262): illuminate\session\filesessionhandler->write('4fd3fb4a7820527...', 'a:4:{s:6:"_toke...') #4 /var/www/project/www/vendor/laravel/framework/src/illuminate/session/middleware/startsession.php(88): illuminate\session\store->save() #5 /var/www/project/www/vendor/laravel/framework/src/illuminate/foundation/http/kernel.php(155): illuminate\session\middleware\startsession->terminate(object(illuminate\http\request), object(i$ #6 /var/www/project/www/public/index.php(58): illuminate\foundation\http\kernel->terminate(object(illuminate\http\request), object(illuminate\http\response)) #7 {main} _どういうわけか、これはvagrantエラーであるに違いないと思います。なぜなら、_sudo chown -r project:project /var/www/project/www_を実行しようとすると、エラーが発生するからです。_chown: changing ownership of ‘{any file/folder}’: operation not permitted_
回答: 古い質問ですので、今までに整理していただければ幸いです。まだこれに直面している他の人のために、私はvagrantfileを次のように設定することで、file_put_contents(): exclusive locks are not supported for this streamの問題を修正することができました。config.vm.synced_folder ".", "/vagrant", :nfs => true, :nfs_version => 4, :nfs_udp => false, :mount_options => ['sec=sys'] vagrantfileを更新した後、vagrant reloadを実行することを忘れないでください。