【发布时间】:2014-03-02 05:10:55
【问题描述】:
我尝试通过测试INVO sample application来学习和配置phalcon
该教程似乎没有包含用于测试的 nginx 配置,因此我在测试示例应用程序时遇到了一些困难。
我使用nginx作为web服务器,我从here获取了nginx配置
这是我的 nginx 配置:
server {
listen 80;
server_name local.phalcon.dev;
access_log /Users/mylocal/www/log/phalcon.access.log;
error_log /Users/mylocal/www/log/phalcon.error.log;
index index.php index.html index.htm;
set $root_path '/Users/mylocal/www/phalcon/current';
root $root_path;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
看教程,相信结构是这样的:
webroot
invo
app
...
public
index.php
...
...
也就是说,webroot 是我的/Users/mylocal/www/phalcon/current
我应该可以通过这个网址http://local.phalcon.dev/invo访问它
这导致 403 被禁止,这是可以理解的,因为我们似乎应该将路径从 webroot/invo 重写为 webroot/invo/public
我在更改配置时做了一些试验和错误,但没有运气,有人可以帮我为该教程配置 nginx 配置吗? (这意味着从http://local.phalcon.dev/invo 访问它)
PS:
我可以通过将$root_path 更改为/Users/mylocal/www/phalcon/current/invoice/public 来访问它
在invo/public/index.php 中将$url->setBaseUri($config->application->baseUri); 更改为$url->setBaseUri('/');
但这意味着我是从网址http://local.phalcon.dev而不是http://local.phalcon.dev/invo访问的
【问题讨论】:
-
那么……你明白了吗?
-
@IanBytchek 还没有,我想从
http://local.phalcon.dev/invo访问它。我只能从http://local.phalcon.dev访问它,这不是我想要的