阿帕奇重写规则NGINX的HHVM [英] Apache rewrite rule to NGINX for HHVM
问题描述
我们正在从Apache到NGINX及Hip Hop虚拟机(HHVM)移动。我似乎无法让我们重写规则一字排开,并在NGINX正常工作。这里是当前工作的apache的规则集:
We're moving from apache to NGINX and Hip Hop Virtual Machine (HHVM). I can't seem to get our rewrite rules lined up and working properly in NGINX. Here is the current working apache rule set:
RewriteEngine叙述在
的RewriteBase /
RewriteEngine On RewriteBase /
#send www.domain.com -> domain.com
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^(.*)$ http://domain.com%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule td/api(.*) http://dp.domain.com/api$1 [P,L]
RewriteRule ^.*$ /index.php [NC,L]
</IfModule>
下面是我目前尝试:
server {
server_name test.domain.com;
listen 80;
root /path/public_html;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /path/public_html/index.php;
include fastcgi_params;
}
}
推荐答案
究竟什么是你遇到和你使用的ZF版本的问题?下面的配置适用于ZF1.12。您可以测试配置,并通过调用下面的命令(在RHEL / CentOS的)调试它:
What exactly is the problem you're encountering and which version of ZF are you using? The following config works for ZF1.12. You can test the config and debug it by calling the following command (on RHEL/CentOS):
$ service nginx configtest
您还可以查看错误日志:
You can also check the error logs:
$ tail -f /var/log/nginx/error.log
的配置:
server {
listen 80 default;
server_name test.domain.com;
root /path/public_html;
index index.php index.html index.htm;
client_max_body_size 3M;
location / {
server_tokens off;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
location ~ /\.ht {
deny all;
}
}
这篇关于阿帕奇重写规则NGINX的HHVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!