2014-04-20 3 views
1

Je migre une application Kohana 3.0.4 d'Apache vers NginX. Je rencontre des problèmes avec la configuration .htaccess. Le travail Nginx correctement que comme de l'URL interne:Migrer Kohana d'Apache vers NginX

http://myurlwithoutwww.net.ds/internalpage/anotherpage 

mais Nether la page d'accueil

http://myurlwithoutwww.net.ds/ 

Nether ceci:

http://myurlwithoutwww.net.ds/index.php 

œuvres. Les deux derniers affichent simplement un écran vide.

c'est le fichier htaccess d'où je suis en train de migrer:

AddType text/x-component .htc 
#Accept-Encoding: filter,deflate 
# Turn on URL rewriting 
RewriteEngine On 
AddDefaultCharset UTF-8 

# Installation directory 
RewriteBase/

RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+).([a-z]{2,3})$  [NC] 
RewriteRule ^(.*)$  http://www.%{HTTP_HOST}/$1   [L,R=301] 

# Protect hidden files from being viewed 
<Files .*> 
    Order Deny,Allow 
    Deny From All 
</Files> 

# ExpiresActive On 
# <FilesMatch \.(bmp|png|gif|jpe?g|html?|ico|doc|swf)$> 
#  ExpiresDefault "access plus 10 days" 
# </FilesMatch> 

FileETag none 

# Protect application and system files from being viewed 
RewriteRule ^async/?(.*)?     index.php?dispatcher=async&$1 [NC,L,QSA] 
RewriteRule ^(?:_application|_modules|_system)\b index.php/$0 [L] 

# Allow any files or directories that exist to be displayed directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# Rewrite all other URLs to index.php/URL 
RewriteRule .* index.php?kohana_uri=$0 [PT,L,QSA] 
#RewriteRule .* index.php/$0 [PT] 

Et cette ma configuration actuelle Nginx:

server { 
    listen  80; 
    server_name localhost; 

    #charset koi8-r; 

    #access_log logs/host.access.log main; 
    include /etc/nginx/aliases.conf; 
    root /var/www/webroot/ROOT; 
    index index.php; 

    location/{ 
    expires off; 
     try_files $uri $uri/ @kohana; 
    } 

    # Prevent access to hidden files 
    location ~ /\. { 
    deny all; 
    } 

    location @kohana { 
    rewrite ^/(.+)$ /index.php$request_uri last; 
    } 

    location ~* \.php { 

      #location ~ /\. { deny all; access_log off; log_not_found off; } 
     include /etc/nginx/fastcgi_params; 
     fastcgi_pass 127.0.0.1:9000; 
     fastcgi_param SCRIPT_FILENAME /var/www/webroot/ROOT/$fastcgi_script_name; 
    fastcgi_param KOHANA_ENV development; 
     fastcgi_param PATH_INFO $fastcgi_script_name; 
     fastcgi_param DOCUMENT_ROOT /var/www/webroot/ROOT; 
      fastcgi_index index.php; 
    } 

Répondre

0

essayer ci-dessous config, vérifiez également init bootstrap si elle a 'index_file' => FALSE.

server { 
    listen  80; 
    server_name *.domain.com; 

    client_max_body_size 20M; 

    access_log /home/user/public_html/site/log/access.log; 
    error_log /home/user/public_html/site/log/error.log; 

    root  /home/user/public_html/site/public/; 
    index  index.php; 

    location/{ 
       # don’t check $uri/, send to php for nice error message 
       try_files $uri /index.php?$query_string; 
    } 

    location = /index.php { 
     include  fastcgi.conf; 
     fastcgi_pass 127.0.0.1:9000; 
     fastcgi_index index.php; 
    } 
} 
0

Il est assez vieille question, mais peut-être vous trouverez utile, comme je le fais:

location/{ 
index index.html index.htm index.php; 
try_files $uri index.php; 
} 

location /kohana { 

rewrite ^(.+)$ /kohana/index.php?kohana_uri=$1 last; 
if (-f $request_filename) { 

        break; 
      } 
      if (!-e $request_filename) { 
        rewrite ^/kohana/(.+)$ /kohana/index.php?kohana_uri=$1 last; 
      } 
} 

I qui figure juste les sections principales de default.conf.