zoukankan      html  css  js  c++  java
  • PHP slim restfull框架nginx 配置

    http://docs.slimframework.com/ 下载地址这个东西很不错,照到官方的例子做

    <?php
    
    require 'vendor/autoload.php';
    
    $app = new SlimSlim();
    $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>

    这样再访问:

    就有值了

  • 相关阅读:
    C++实现base64编解码
    使用matplotlib绘制3D函数图像
    C++分治策略实现快速排序
    C++分治策略实现二分搜索
    C++生成随机数
    eBay 表结构
    mysql 流程函数
    无限极分类
    PHP 导出 Excell
    js
  • 原文地址:https://www.cnblogs.com/jackluo/p/3737924.html
Copyright © 2011-2022 走看看