科哈纳3.2+;php fpm+;nginx 404

科哈纳3.2+;php fpm+;nginx 404,php,nginx,kohana,Php,Nginx,Kohana,我有一个旧的kohana应用程序,我正试图把它放在我的VPS上,但似乎无法让它工作。我花了几个小时在谷歌上搜索并查看缓存的论坛答案。我都试过了,似乎什么都不管用。诚然,我不知道如何处理nginx。我的本地版本的应用程序可以与apache配合使用。我离取消我的linode帐户和共享主机只差一步了!请说服我离开这个窗台 我的VPS使用php5 fpm和nginx1.4.6运行Ubuntu14.04 LTS。我正在为我的用户目录中的所有内容提供服务 My nginx站点可用文件: server {

我有一个旧的kohana应用程序,我正试图把它放在我的VPS上,但似乎无法让它工作。我花了几个小时在谷歌上搜索并查看缓存的论坛答案。我都试过了,似乎什么都不管用。诚然,我不知道如何处理nginx。我的本地版本的应用程序可以与apache配合使用。我离取消我的linode帐户和共享主机只差一步了!请说服我离开这个窗台

我的VPS使用php5 fpm和nginx1.4.6运行Ubuntu14.04 LTS。我正在为我的用户目录中的所有内容提供服务

My nginx站点可用文件:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/gabreal/Sites/public;
    index index.html index.htm index.php;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
        try_files $uri $uri/ @kohana =404;
    }

    error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        # With php5-fpm:
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location @kohana {
        rewrite ^/(.+)$ /index.php$request_uri last;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    location ~ /\.ht {
        deny all;
    }
}
我的Kohana应用程序位于如下目录中:

├──/home/gabreal/Sites/public/
│   ├── horizons/
│   │   ├── grader/ (aka the kohana application)
│   │   │   ├── index.php
│   │   │   ├── application/
│   │   │   ├── system/
当我通过访问
http://example.com/horizons/grader
加载kohana引导文件并调用所有重定向。例如,我的默认路由会将您重定向到起始页。如果您未登录,请转到“用户/登录”。url设置正确。转到上面的url,浏览器将重定向到
http://example.com/horizons/grader/user/login
但是我得到了nginx 404页面

因此,不知何故,
controller/action
模式不适用于此nginx设置

请为你在这个世界上所爱的一切而帮助我

更新

仅供参考,我安装了phpmyadmin,它工作正常。但是我还是不能让科哈纳工作

更新2


我重新安装了kohana,并尝试设置一些基本控制器。只有默认控制器的工作方式与我的应用程序相同。因此,转到我的应用程序的基本url总是有效的,但是直接转到任何/controller/action/id类型的资源会在新安装和现有应用程序上出现nginx 404错误。

您使用的nginx配置不再被认为是将PHP执行返回给FPM的正确方法。以下示例(于2020年更新),基于您的原始部分和稍微修改的部分,是一种更好的方法,应该适合您

upstream php {
    #this should match value of "listen" directive in php-fpm pool
    server unix:/var/run/php5-fpm.sock;
}

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/gabreal/Sites/public;
    index index.html index.htm index.php;

    server_name localhost;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_pass php;
        #The following parameter can be also included in fastcgi_params file
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

请注意,为了简洁起见,我没有包括404和50x处理程序以及
.ht
-文件保护器。您可以从问题中的示例中重新输入这些内容。

您正在使用的nginx配置不再被认为是将PHP执行传递回FPM的正确方式。以下示例(于2020年更新),基于您的原始部分和稍微修改的部分,是一种更好的方法,应该适合您

upstream php {
    #this should match value of "listen" directive in php-fpm pool
    server unix:/var/run/php5-fpm.sock;
}

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/gabreal/Sites/public;
    index index.html index.htm index.php;

    server_name localhost;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_pass php;
        #The following parameter can be also included in fastcgi_params file
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

请注意,为了简洁起见,我没有包括404和50x处理程序以及
.ht
-文件保护器。您可以从问题中的示例中重新输入这些内容。

您正在使用的nginx配置不再被认为是将PHP执行传递回FPM的正确方式。以下示例(于2020年更新),基于您的原始部分和稍微修改的部分,是一种更好的方法,应该适合您

upstream php {
    #this should match value of "listen" directive in php-fpm pool
    server unix:/var/run/php5-fpm.sock;
}

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/gabreal/Sites/public;
    index index.html index.htm index.php;

    server_name localhost;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_pass php;
        #The following parameter can be also included in fastcgi_params file
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

请注意,为了简洁起见,我没有包括404和50x处理程序以及
.ht
-文件保护器。您可以从问题中的示例中重新输入这些内容。

您正在使用的nginx配置不再被认为是将PHP执行传递回FPM的正确方式。以下示例(于2020年更新),基于您的原始部分和稍微修改的部分,是一种更好的方法,应该适合您

upstream php {
    #this should match value of "listen" directive in php-fpm pool
    server unix:/var/run/php5-fpm.sock;
}

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/gabreal/Sites/public;
    index index.html index.htm index.php;

    server_name localhost;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_pass php;
        #The following parameter can be also included in fastcgi_params file
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}


请注意,为了简洁起见,我没有包括404和50x处理程序以及
.ht
-文件保护器。您可以从问题中的示例中将它们放回原处。

如果您喜欢Apache,您可以在Linode上安装Apache。Linode(以及类似的VPS主机)的全部要点是,您可以做任何您想做的事情。如果您喜欢Apache,您可以在Linode上安装Apache。Linode(以及类似的VPS主机)的全部要点是,您可以做任何您想做的事情。如果您喜欢Apache,您可以在Linode上安装Apache。Linode(以及类似的VPS主机)的全部要点是,您可以做任何您想做的事情。如果您喜欢Apache,您可以在Linode上安装Apache。Linode(和类似的VPS主机)的全部要点是,你可以做任何你想做的事情。不过我想试试nginx。如果我这样做,我会看看你的配置文件是否有效。谢谢你的详细回答。
fastcgi\u通过php的是什么做什么?据称,只应该有一个Unix套接字(在最后一个块中使用)、一个IP地址+端口或一个
php
似乎不是一个有效的选项…@gwynethlewelyn 5.5年前,有人发现了一个复制粘贴错误!“我正在修好它,@MosheKatz,谢谢!我只是好奇我是否有“错误”版本的
nginx
。我正在拼命地试着开始工作(最新版本-项目中断5年后重新启动!)-它基于Kohana,据称在PHP7.4下运行良好,但大部分是用Apache测试的。我曾经让它工作得很好(5年前!),但不知何故,有一些复杂的Kohana特定配置我还没有弄明白…我在ubuntu 12.04上使用apache,因为我对它很熟悉。不过我想试试nginx。如果我这样做,我会看看你的配置文件是否有效。谢谢你的详细回答。
fastcgi\u通过php的是什么做什么?据称,只应该有一个Unix套接字(在最后一个块中使用)、一个IP地址+端口或一个
php
似乎不是一个有效的选项…@gwynethlewelyn 5.5年前,有人发现了一个复制粘贴错误!“我正在修好它,@MosheKatz,谢谢!我只是好奇我是否有“错误”版本的
nginx
。我拼命想开始工作(最新版本-项目中断5年后重新启动!)-它基于Kohana,