thinkphp5.0部署在nginx服务器的一些疑难杂症

来源:互联网 发布:保险网络大学考试官网 编辑:程序博客网 时间:2024/06/06 03:24

配置文件

thinkphp框架需要把所有请求拦截到入口文件再进行具体的分发。框架中已经配置了apache服务器的拦截文件。nginx服务器需要修改default.conf配置`server {
listen 80;

set        $root    /data/site_mall/public;location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)${    root $root;}location / {    root    $root;    index    index.html index.php;    if ( -f $request_filename) {        break;    }    if ( !-e $request_filename) {        rewrite ^(.*)$ /index.php/$1 last;        break;    }}location ~ .+\.php($|/) {    //这里指定root的位置    set $script $uri;    set $path_info "";    if ($uri ~ "^(.+\.php)(/.+)") {        set $script $1;        set $path_info $2;    }    fastcgi_pass    127.0.0.1:9000;    fastcgi_index    index.php?IF_REWRITE=1;    fastcgi_param    PATH_INFO    $path_info;    fastcgi_param    SCRIPT_FILENAME    $root$fastcgi_script_name;    fastcgi_param    SCRIPT_NAME    $script;    include        fastcgi_params;}}`

ueditor配合使用的一些问题

ueditor默认创建图片的位置默认使用了nginx默认的网站目录,即使在对应的默认网站目录开通了权限后会遇到图片是上传成功,但是显示图片却显示出图片的文件名的问题。
这就是要在nginx配置的php解析中指定网站的目录位置。上图配置中的注释就是指定了网站的目录位置。

原创粉丝点击