cakephp 3 nginx index.php url重写配置

时间:2016-12-18 01:37:58

标签: nginx cakephp-3.0

想知道我在/index.php中缺少什么来使用下面的配置:

全新安装:Ubuntu 16.04 / Nginx 1.10 / CakePHP 3.3.4

http://dev.test.com/ - 好

http://dev.test.com/pages/home - 好

http://dev.test.com/pages/test - 预期,缺少模板

http://dev.test.com/something - 期待,错误:无法找到SomethingController。

http://dev.test.com/index.php - 自index.php存在以来不好,错误:无法找到Index.phpController。

server {

    listen 80 default_server;
    listen [::]:80 default_server;

    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    ssl_certificate /etc/letsencrypt/live/dev.test.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/dev.test.com/privkey.pem;
    ssl_session_cache shared:SSL:20m;

    root /home/andras/sites/dev.test.com/public/webroot/;

    index index.php index.html index.htm index.nginx-debian.html;

    server_name dev.test.com;

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

    location ~ \.php$ {
            try_files $uri $uri/ =404;
            # include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            include /etc/nginx/fastcgi_params;
            fastcgi_index index.php;
            index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
            deny all;
    }

}

0 个答案:

没有答案