zoukankan      html  css  js  c++  java
  • lnmp支持thinkphp

    lnmp环境配置好后,直接把thinkphp放到相应的目录里进行解析,是不行的,thinkphp默认是用apache的,相应目录下有个.htacess是关于apache重写的,lnmp是用nginx,不适用,需要修改nginx 配置文件里的server{}里面的

    server {
    listen 80;
    server_name domain;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }

    location / {

    root /opt/nginx/html/domain/;
    index index.php index.html index.htm ;
    if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php/$1 last;
    break;
    }
    }

    location ~ .+.php($|/) {
    set $script $uri;
    set $path_info "/";
    if ($uri ~ "^(.+.php)(/.+)") {
    set $script $1;
    set $path_info $2;
    }

    root /opt/nginx/html/domain/;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php?IF_REWRITE=1;
    include /opt/nginx/conf/fastcgi_params;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param SCRIPT_FILENAME $document_root/$script;
    fastcgi_param SCRIPT_NAME $script;
    }

    其中,在location / { }里面要指定root 的目录,网上看到有些人没写,结果就403了,同样的,location ~ .php$ {}里面也要添加root 位置

  • 相关阅读:
    使用IDEA整合SSM框架
    宏任务与微任务
    setTimeout的实现及其问题
    JS的闭合(Closure)
    this详解
    JS的作用域和作用域链
    JS的执行上下文
    JS内存机制
    抽象工厂模式(c++实现)
    迭代器模式(c++实现)
  • 原文地址:https://www.cnblogs.com/2myroad/p/3842830.html
Copyright © 2011-2022 走看看