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 位置

  • 相关阅读:
    python分析文本文件/json
    python中文件操作
    python异常处理
    socket网络模块
    层模型--固定定位
    层模型--相对定位
    层模型--绝对定位
    什么是层模型?
    浮动模型
    流动模型/a标签换行问题
  • 原文地址:https://www.cnblogs.com/2myroad/p/3842830.html
Copyright © 2011-2022 走看看