我刚刚使用nginx + HHVM + Wordpress,但无法使其正常工作。 Apache + HHVM和nginx + PHP-FPM可以工作,但是当一起使用nginx和HHVM时,一些全局PHP变量是空的。
例如,我的主题中有一个名为nice_options
的全局。
尝试时:
global $nice_options;
echo '###';
print_r($nice_options);
print_r($_GLOBALS['nice_options']);
echo '###';
我明白了:######
。
我甚至尝试print_r($GLOBALS)
注意到,[nice_options]
为空,但在wp_object_cache
中完全可用。
我正在使用Ubuntu 14.04,nginx 1.6.0和HHVM 3.
/etc/nginx/nginx.conf
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/ etc / nginx / sites-available / chefgrill(我的域名)
server {
listen 80 default_server;
root /var/www/chefgrill.de/public_html;
access_log /var/www/chefgrill.de/logs/access.log;
error_log /var/www/chefgrill.de/logs/error.log;
index index.php;
server_name dev.chefgrill.de;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
location ~ /\.ht {
deny all;
}
include hhvm.conf;
}
/etc/nginx/hhvm.conf
location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 1000;
include fastcgi_params;
}