简体   繁体   English

php-fpm + bindfs无法正常工作

[英]php-fpm + bindfs not working

I'm trying to setup my local web server using vagrant. 我正在尝试使用流浪汉设置本地Web服务器。 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. 我的流浪者共享文件夹位于我的主文件夹(〜/ home / vagrant / www)中,我想使用bindfs在/ var / www中安装此文件夹。

These are the specs of my virtual machine: 这些是我的虚拟机的规格:

  • Apache/2.4.23 (Ubuntu) Apache / 2.4.23(Ubuntu)
  • PHP 7.0.12 PHP 7.0.12
  • Ubuntu 14.04 Ubuntu 14.04

I am using php-fpm to execute php scripts but after using bindfs, my site will always return File not found. 我正在使用php-fpm执行php脚本,但是在使用bindfs之后,我的站点将始终返回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? 有人可以帮助我吗?

I manage to successfully run php-fpm + bindfs in my virtual machine. 我设法在我的虚拟机中成功运行php-fpm + bindfs。 I just made sure that user who is running php-fpm and apache are the one I set in my bindfs command. 我只是确保正在运行php-fpm和apache的用户是我在bindfs命令中设置的用户。 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 . 我的apache由www-user运行,因此我将命令更改为sudo bindfs -o perms=0755,mirror-only=www-user,force-group=www-data,force-user=www-user /home/vagrant/www /var/www并确保apache也由www-user运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM