我努力學習,並通過測試INVO sample application爾康PHP「INVO示例應用程序」使用nginx的
看來,本教程不包括nginx的配置進行測試,讓我得到了一些困難,以測試樣品配置爾康應用。
我使用nginx的作爲Web服務器,我把nginx的配置從here
這裏是我的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
,我應該能夠以這樣的URL來訪問它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
和改變$url->setBaseUri($config->application->baseUri);
成$url->setBaseUri('/');
在invo/public/index.php
但這意味着我從url訪問它http://local.phalcon.dev
不是http://local.phalcon.dev/invo
所以...你有沒有想通? –
@IanBytchek還沒有,我想從'http:// local.phalcon.dev/invo'訪問它,我只能從'http://local.phalcon訪問它.dev'這不是我想要的 – ivantedja