PHP slim restfull框架nginx 配置
2014-05-19 23:08
597 查看
http://docs.slimframework.com/ 下载地址这个东西很不错,照到官方的例子做
访问localhost/index.php/hello/adaaa 怎么都报404错误
后面想了一下,要支持伪静态.
Nginx 设置是
Apache 设置是
这样再访问:
就有值了
<?php require 'vendor/autoload.php'; $app = new \Slim\Slim(); $app->get('/hello/:name', function ($name) { echo "Hello, $name"; }); $app->run();
访问localhost/index.php/hello/adaaa 怎么都报404错误
后面想了一下,要支持伪静态.
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>
这样再访问:
就有值了
相关文章推荐
- php 使用 restler 框架构建 restfull api
- 解决nginx配置伪静态 去除框架的Index.php
- php CI框架nginx 配置
- CI框架在 nginx 服务器上配置 rewrite 去掉 index.php 的方法:
- PHP CI框架下,如果配置NGINX(根目录和子目录两种模式)
- slim(PHP rest 框架 )简介
- nginx 配置 php 的 CI 框架的web
- Nginx配置PHP的Yii与CakePHP框架的rewrite规则示例
- PHP的Symfony和CodeIgniter框架的Nginx重写规则配置
- RHEL5下nginx+php+mysql+tomcat+memchached配置全过程
- FreeBSD下nginx并支持php配置详解
- Redhat+Nginx+PHP+Mysql安装配置
- nginx 0.6.3 安装与配置(linux,nginx,php-cgi)
- nginx 下php配置文件需要生效改如何重启?
- Centos 5.3 Nginx+php+mysql配置 独立的 Subversion (SVN)服务器
- nginx+PHP+PHP-FPM(FastCGI)在Ubuntu上的安装和配置
- 自动配置php、mysql、nginx的脚本
- nginx+PHP+PHP-FPM(FastCGI)在Ubuntu上的安装和配置
- Nginx安装配置(含PHP支持、虚拟主机、反向代理负载均衡)
- Nginx 0.7.x + PHP 5.2.10(FastCGI)搭建胜过Apache十倍的Web服务器 安装与配置(4)