dtkp51520 2014-09-23 09:04
浏览 94
已采纳

apro php5-fpm在chroot启用时出现404错误

I know this particular question has been asked many times but i don't see any solving answers.

I have a mod_proxy_fcgi + php5-fpm + apache 2.4 configured on UBUNTU 14 its working perfectly fine.

i wanted to make php-fpm chrooted (So users wont access other users resource in shared env) if config:

prefix = /var/www/html/example.com/public_html/ 
chroot = $prefix 
chdir = / 

After config: if i access php script in browser i get 404 error "File not found"

If i COMMENT this above chroot config then php works again without any errors!

  • 写回答

2条回答 默认 最新

  • dswqz24846 2014-09-23 10:12
    关注

    At Freenod Channel #php-fpm person named "Kiranos" helped me to solve the problem.

    My setup was: Apache 2.4.7 + mod_proxy_fcgi + php5-fpm on Ubuntu 14.04

    The problem was, i had TCP connection to php-fpm socket in vhost like

    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/example.net/public_html/$1
    

    and in php-fpm pool conf i had

    chroot = /var/www/html/example.net/public_html/
    

    Note: Since Apache 2.4.7 don't support unix socket connection i had to use TCP. While using TCP there is no need to mention complete doc path in ProxyPassMatch for chrooting.

    Wrong Conf in vHost:

    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/example.net/public_html/$1
    

    Correct Conf in vHost:

    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/$1
    

    After doing this chroot was working..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型