[英]Apache rewrite rule to NGINX for HHVM
We're moving from apache to NGINX and Hip Hop Virtual Machine (HHVM). 我们正在从apache迁移到NGINX和Hip Hop虚拟机(HHVM)。 I can't seem to get our rewrite rules lined up and working properly in NGINX.
我似乎无法让我们的重写规则在NGINX中排好序并正常工作。 Here is the current working apache rule set:
这是当前工作的Apache规则集:
RewriteEngine On RewriteBase / 在RewriteBase上的RewriteEngine /
#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>
Here is what I have tried currently: 这是我目前尝试的内容:
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;
}
} }
What exactly is the problem you're encountering and which version of ZF are you using? 您遇到的问题到底是什么?您正在使用哪个版本的ZF? The following config works for ZF1.12.
以下配置适用于ZF1.12。 You can test the config and debug it by calling the following command (on RHEL/CentOS):
您可以通过调用以下命令(在RHEL / CentOS上)来测试配置并调试它:
$ service nginx configtest
You can also check the error logs: 您还可以检查错误日志:
$ tail -f /var/log/nginx/error.log
The config: 配置:
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;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.