PhalconEye / phalconeye

PhalconEye CMS Powered by Phalcon Framework
Other
413 stars 97 forks source link

path problem,when use Virtual host #11

Closed munggruel closed 11 years ago

munggruel commented 11 years ago

for example: app\modules\Core\View\adminpages\manage.volt

<img src="/public/img/admin/content/cols1_3.png" alt="3 columns" onclick="changeCurrentLayoutType('right,middle,left');"> should be

<img src="/img/admin/content/cols1_3.png" alt="3 columns" onclick="changeCurrentLayoutType('right,middle,left');">

delete "/public/"

lantian commented 11 years ago

I use virtual host too, but I have no problem with this. Give me you .htaccess and virtual host config content here, please. Maybe we need use volt's 'url' helper to adjust full path with baseURL parameter.

munggruel commented 11 years ago

httpd.conf add Include conf/extra/*.conf

virtual host: <VirtualHost *:80>

ServerAdmin admin@example.host
DocumentRoot "D:/MiniServer/www/htdocs/phalconeye/public"
DirectoryIndex index.php
ServerName dev.phalconeye.com
#ServerAlias www.example.host

<Directory "D:/MiniServer/www/htdocs/phalconeye/public">
    Options All
    AllowOverride All
    Allow from all
</Directory>

phalconeye/.htaccess:

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

phalconeye/public/.htaccess: AddDefaultCharset UTF-8

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
munggruel commented 11 years ago

for apache, I can't access public/img for nginx, I can't access any page except public/index.php nginx.conf add include extra/*.conf;

extra/phalconeye.conf: server { listen 80; server_name dev.phalconeye.com; set $root_path 'D:/MiniServer/www/htdocs/phalconeye/public'; root $root_path;

#access_log  /var/log/nginx/$host-access.log;
#error_log   /var/log/nginx/$host-error.log error;
access_log   logs/phalconeye_access.log main;
error_log    logs/phalconeye_error.log debug;

index index.php index.html index.htm;

try_files $uri $uri/ @rewrite;

location @rewrite {
    rewrite ^/(.*)$ /index.php?_url=$1;
}

location ~ \.php {
    # try_files    $uri =404;

    fastcgi_index  /index.php;
    fastcgi_pass   127.0.0.1:9000;

    include 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;
}

}

lantian commented 11 years ago

Hm, maybe problem in:

location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
    root $root_path;
}

This rule rewrite /img/someimg.png to root and apache rewrite rule then in /public/ dir...

And I didn't understand why u have nginx rewrite like this:

location @rewrite {
    rewrite ^/(.*)$ /index.php?_url=$1;
}

index.php not in root, it's in /public dir

P.S. Btw all links must be with baseURL parameter, so i will change them with 'url' helper, but this will not fix your problem...

lantian commented 11 years ago

Oh, i see, sorry $root_path is 'D:/MiniServer/www/htdocs/phalconeye/public'. Okay, i will check it manually

lantian commented 11 years ago

For apache i find your problem:

<Directory "D:/MiniServer/www/htdocs/phalconeye/public">

must be:

<Directory "D:/MiniServer/www/htdocs/phalconeye">

And above DocumentRoot, too

munggruel commented 11 years ago

My config come from phalcon official website: http://docs.phalconphp.com/en/latest/reference/nginx.html

http://docs.phalconphp.com/en/latest/reference/apache.html

lantian commented 11 years ago

For apache you can't access public dir because this dir is root in your config. For nginx - the same...

But you give me the right way... that application code must be hidden and public must be root. I will rework that.