PhalconPHP 教程的 Nginx 配置

Nginx configuration for PhalconPHP tutorial

我正在尝试使用 PhalconPHP 框架教程设置 ngnix,他们提供了以下结构:

教程/.htaccess:

RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/ [L]

tutorial/public/.htaccess:

AddDefaultCharset UTF-8
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/ [QSA,L]

另一个文件夹是 app,其中包含文件夹:controllersmodelsviews。现在本教程在 apache 上完美运行,但在 nginx 上,我尝试了不同的规则,但都不起作用。我的 ngnix 的基本配置是:
服务器配置

server {
   listen  80;
   server_name localhost;  
   root C:/nginx/html;  
   location /tutorial {  
     rewrite ^/tutorial/(.*)$ /tutorial/public/ break;  
     try_files $uri $uri/ /tutorial/public/index.php?q=$uri&$args;  
   }  
   location /tutorial {  
      root C:/nginx/html;  
      index index.php;  
      rewrite ^/tutorial/(/.*)$ /public break;  
      try_files $uri $uri/ /tutorial/public/index.php?$args;  
   }
}

谁能帮我设置本教程的位置规则 nginx.I 甚至在线将那些 .htaccess 规则转换为 nginx 规则,但我不知道我哪里错了。

您似乎在 nginx 中使用 Windows 并且想使用 phalcon
所以你可以安装 PHP - FastCGI on Windows Then using main PhalconPHP nginx config that included in docs here.
可能是这样的:

server {
    listen 80;

    server_name localhost;

    index index.php index.html index.htm;

    root C:/nginx/html/tutorial/public;

    try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite ^(.*)$ /index.php?_url=;
    }
    location ~ \.php$ {
       fastcgi_pass   127.0.0.1:9123;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       fastcgi_split_path_info       ^(.+\.php)(/.+)$;
       fastcgi_param PATH_INFO       $fastcgi_path_info;
       fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

       include        fastcgi_params;
    }


    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root C:/nginx/html/tutorial/public;
    }

    location ~ /\.ht {
        deny all;
    }
}

试试上面的配置。