我正在尝试设置HHVM来执行我的PHP代码。我使用的是Apache,但我切换到了nginx,我几乎已经让它工作了。但是,当我尝试访问index.php
时,它会下载文件,而不是执行/服务它。这是我的配置,我在配置后运行了usr/share/hhvm/install_fastcgi
,随后重新启动了我的nginx服务。
server {
listen 80;
listen [::]:80;
root /var/www/domain.com/public_html;
index index.php index.html index.htm;
server_name domain.com www.domain.com;
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
}
}
有什么想法吗?
我修复了它。我只需要包含hhvm.conf
文件,然后做try_files
的事情。这是我的新配置:
server {
listen 80;
listen [::]:80;
root /var/www/domain.com/public_html;
index index.php index.html index.htm;
server_name domain.com www.domain.com;
include hhvm.conf;
location ~ .php$ {
try_files $uri $uri/ /index.php;
}
}