tp5静态文件不能加载

来源:3-3 TP5神器-webserver-

慕粉15031226078

2019-04-01

老师你好,我的问题还是没有解决
图片描述
样式加载不了 而且还图片描述

写回答

2回答

慕粉15031226078

提问者

2019-04-01

server {

    #listen       80;

    server_name  thinkphp5.com;

    root         /usr/local/var/www/mycode/thinkphp5/public;

    access_log  off;

    location / {

        index  index.html index.htm index.php;

        #autoindex   on;

        #include     /usr/local/etc/nginx/php-fpm;

    }

    #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则

    if (!-e $request_filename) {

        #地址作为将参数rewrite到index.php上。

        #rewrite ^/(.*)$ /index.php/$1;

        #若是子目录则使用下面这句,将subdir改成目录名称即可。

        #rewrite ^/subdir/(.*)$ /subdir/index.php/$1;

        rewrite ^/(.*)$ /index.php?s=/$1 last;

        break;

    }


    location ~\.php$ {

        #try_files $uri =404;

        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        #fastcgi_param SCRIPT_NAME $fastcgi_script_name;

        fastcgi_index index.php;

        fastcgi_pass   127.0.0.1:9000;

        #fastcgi_pass unix:/run/php/php7.1-fpm.sock;

    }



    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {

        expires 30d;

        access_log off;

    }

    location ~ .*\.(js|css)?$ {

        expires 7d;

        access_log off;

    }

    location ~ /\.ht {

        deny all;

    }


}


0
1
singwa
我给您一个思路, nginx可以配置,当目录下存在文件 优先访问这个。 可以参考老师的免费课程:https://www.imooc.com/learn/330 这个课程的第三章
2019-04-01
共1条回复

singwa

2019-04-01

亲爱的同学,这个很可能是您的web服务器配置有问题。你可以从web服务器配置 那边查看下。

你是apache还是nginx呢?

0
4
singwa
回复
慕粉15031226078
客气, 问题解决了吗?
2019-04-03
共4条回复

Thinkphp5.0仿百度糯米开发多商家电商平台

【毕设】BAT大牛亲授ThinkPHP 5.0,实战中学透新技能,应用于工作

2439 学习 · 1712 问题

查看课程