Cliff Richard Anfone Cliff Richard Anfone - 25 days ago 16
PHP Question

php-fpm + bindfs not working

I'm trying to setup my local web server using vagrant. My vagrant shared folder is in my home folder (~/home/vagrant/www) and I want to use bindfs to mount this folder inside /var/www.

These are the specs of my virtual machine:


  • Apache/2.4.23 (Ubuntu)

  • PHP 7.0.12

  • Ubuntu 14.04



I am using php-fpm to execute php scripts but after using bindfs, my site will always return File not found.

Also here is my virtualhost configuration:

<VirtualHost *:80>
ServerName project1.dev

## Vhost docroot
DocumentRoot "/var/www/project1/public"

## Directories, there should at least be a declaration for /var/www/project1/public

<Directory "/var/www/project1/public">
Options Indexes FollowSymlinks MultiViews
AllowOverride All
Require all granted

<FilesMatch "\.php$">
Require all granted
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>

</Directory>

## Logging
ErrorLog "/var/log/apache2/av_anhk5lpgjldb_error.log"
ServerSignature Off
CustomLog "/var/log/apache2/av_anhk5lpgjldb_access.log" combined

## Server aliases
ServerAlias www.project1.dev

## SetEnv/SetEnvIf for environment variables
SetEnv APP_ENV dev
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

## Custom fragment
</VirtualHost>


Anyone can help me?

Answer

I manage to successfully run php-fpm + bindfs in my virtual machine. I just made sure that user who is running php-fpm and apache are the one I set in my bindfs command. My apache is run by www-user so I change my command to sudo bindfs -o perms=0755,mirror-only=www-user,force-group=www-data,force-user=www-user /home/vagrant/www /var/www and made sure that apache is also run by www-user.

Comments