slim+nginx请求报 404

请求1  http://www.slim.com 正常

请求2 http://www.slim.com/users 报404

上面两个在路由文件已经配置了,为什么一个成功一个失败呢?

检查:发现请求2没有走到代码里面,感觉时服务器配置问题

网上查了一下时伪静态问题

nginx设置

root        /Users/jackluo/Works/php/rest;

    location / {
        root    /Users/jackluo/Works/php/rest;
        index   index.html index.php;
        try_files $uri $uri/ /index.php?$args;
    }

apache设置

【1】启动mod_rewrite——去掉#,#代表注释
LoadModule rewrite_module modules/mod_rewrite.so

【2】修改AllowOverride None为AllowOverride All
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride All
    Require all granted
</Directory>

重启,请求成功

发表评论