HHVM 3.0/Hack with Nginx在拥有组成员身份时,无法访问Ubuntu13.10上具有770权限的目录中的文件
我已经nginx设置为在快速cgi模式下使用HipHop VM 3.0版。一些事实:HHVM 3.0/Hack with Nginx在拥有组成员身份时,无法访问Ubuntu13.10上具有770权限的目录中的文件,ubuntu,nginx,hiphop,hhvm,Ubuntu,Nginx,Hiphop,Hhvm,我已经nginx设置为在快速cgi模式下使用HipHop VM 3.0版。一些事实: 我在Ubuntu 13.10上运行 nginx和hhvm以用户身份运行www-data 用户www数据位于组foors nginx的服务器根目录是一个目录/srv/foo,其中有一个index.php文件 /srv/foo的集团所有权是集团foores /srv/foo权限设置为770 当我尝试查看此页面时,我得到一个404未找到,但hhvm或nginx日志中没有记录错误。但是,如果我将/srv/foo上的权限
www-data
李>
foors
/srv/foo
,其中有一个index.php
文件/srv/foo
的集团所有权是集团foores
/srv/foo
权限设置为770
/srv/foo
上的权限更改为775
,则hhvm
和nginx
会像预期的那样完美地为页面提供服务
此外,如果我将www数据用户的默认组更改为fooers组,则它可以使用770个权限。只有当它不是用户的默认组时,它才会失败
有什么问题?!?!?有人知道为什么当权限为770时,以用户www数据组身份运行的hhvm/nginx无法访问目录吗
为了确认我的心智健全并确保我的组和权限与我认为的一样,在启动服务后,我运行
$> ps -aux
我看到了一个hhvm进程和一个运行为www-data
的nginx进程:
www-data 3484 .... /usr/bin/hhvm --config /etc/hhvm/server.ini --user www-data --mode daemon -vPidFile=/var/run/hhvm/pid
www-data 3617 ... nginx: worker process
当我检查组时,我看到:
$> groups www-data
www-data : www-data fooers
当我检查目录时,我可以确认100%访问组和所有者:
$> ls -al
total 16
drwxr-xr-x 5 root root 4096 Mar 30 15:57 .
drwxr-xr-x 22 root root 4096 Mar 30 11:52 ..
drwxrwx--- 2 root fooers 4096 Mar 30 15:39 foo
如果我以www-data
用户身份检查文件内容,则允许我进入:
$> sudo -u www-data ls -al /srv/foo
total 12
drwxrwx--- 2 root fooers 4096 Mar 30 15:39 .
drwxr-xr-x 5 root root 4096 Mar 30 15:57 ..
-rw-rw-r-- 1 root fooers 38 Mar 30 15:39 index.php
如果我对一个不在Foores组中的用户尝试上述操作,它将失败
这是我的/etc/hhvm/server.ini
:
; php options
pid = /var/run/hhvm/pid
; hhvm specific
hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.mysql.typed_results = false
我真的希望这不是我忽略的愚蠢和明显的事情
以下是web根目录的my nginx位置块:
location ~ \.php$ {
root /srv/foo
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/foo$fastcgi_script_name;
include fastcgi_params;
}
请尝试更改配置文件,您的配置文件中没有SourceRoot。我的一些conf被start参数覆盖 请在此处查看它们:
/usr/bin/hhvm--config/etc/hhvm/server.hdf--user www-data--mode-daemon-vServer.Type=fastcgi-vServer.Port=9010
PidFile = /var/run/hhvm/pid
Server {
Port = 82
SourceRoot = /var/www/main/
DefaultDocument = index.php
}
#AdminServer {
# Port = 9088
# ThreadCount = 1
# Password = xxx
#}
Eval {
Jit = true
JitWarmupRequests = 5
}
Log {
Level = Error
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
UseLogFile = true
UseSyslog = false
File = /var/log/hhvm/error.log
Access {
* {
File = /var/log/hhvm/access.log
Format = %h %l %u % t \"%r\" %>s %b
}
}
}
#Repo {
# Central {
# Path = /var/run/hhvm.hhbc.sq3
# }
#}
#include "/usr/share/hhvm/hdf/static.mime-types.hdf"
StaticFile {
FilesMatch {
* {
pattern = .*\.(dll|exe)
headers {
* = Content-Disposition: attachment
}
}
}
Extensions : StaticMimeTypes
}
MySQL {
TypedResults = false
}
这似乎是HHVM的一个bug。我已经添加了一个票证来修复该项目。请发布您的/etc/hhvm/server.ini。我也有一个带有hhvm gastcgi的nginx,但是有了ps-aux,它看起来是这样的:
/usr/bin/hhvm--config/etc/hhvm/server.hdf--user www-data--mode-daemon-vServer.Type=fastcgi-vServer.Port=9010
@PKeidelps
有点中断。我正在ini
文件中将类型设置为fastcgi,将端口设置为9000。@Pkeidel另外,我只是在fastcgi模式下运行新的HHVM 3.0,没有HHVM fastcgi
包了。我想HHVM fastcgi包只创建了一个/etc/init.d/HHVM-fastcgi。您写的nginx web根是/srv/foo
。但是您的hhvm repo.central.path指向/var/run/hhvm/hhvm.hhbc
。因此,您必须chmod这个文件/目录路径,而不是/srv/foo/*。你试过了吗?当您进行nmap端口扫描时,您的端口9000
是否列为打开?这是旧的.hdf
中的。虽然它仍然支持,但从HHVM3.0开始,它将转换为我的帖子中显示的.ini
格式。哦,很抱歉。我的生产服务器仍然使用最新的2.X版本运行。在接下来的几天里,我也想试试3.0。当我运行(或不运行)时,我现在就告诉你。你真的在生产中使用HHVM吗?那很酷。URL?对不起,我不能显示。这是客户的内部页面,他们使用它来管理订单、客户等。服务器上也运行piwik,但piwik仪表板无法与hhvm一起工作。但是插入工作;)仪表板由另一个端口上的apache提供服务。