Giter Site home page Giter Site logo

Comments (5)

icret avatar icret commented on July 17, 2024

谢谢提议,是我的疏忽下个版本将会修改!

from easyimages2.0.

kingchl avatar kingchl commented on July 17, 2024

在网站conf文件添加以下内容后无法显示图片,直接访问直链是403. 权限是 0755 root@xxx:/abcd# ls -ld EasyImages/ drwxr-xr-x 8 www-data www-data 4096 Jan 25 09:21 EasyImages/

#禁止运行php的目录 "i"是你的上传图片目录
location ~ /(i)/.*.(php|php5)?$ {
deny all;
#}

后面试着改成以下内容后又可以显示了 location ~ ^/(i)/.*\.(php|php5)?$ {

为啥我没遇到这个问题

from easyimages2.0.

icret avatar icret commented on July 17, 2024

在网站conf文件添加以下内容后无法显示图片,直接访问直链是403. 权限是 0755 root@xxx:/abcd# ls -ld EasyImages/ drwxr-xr-x 8 www-data www-data 4096 Jan 25 09:21 EasyImages/

#禁止运行php的目录 "i"是你的上传图片目录
location ~ /(i)/.*.(php|php5)?$ {
deny all;
#}

后面试着改成以下内容后又可以显示了 location ~ ^/(i)/.*\.(php|php5)?$ {

为啥我没遇到这个问题

可能你的压根没生效

from easyimages2.0.

kingchl avatar kingchl commented on July 17, 2024
server
{
    listen 80;
    server_name easyimage.*;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/easyimage;
    
    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #SSL-END
    
    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    #PHP-INFO-START  PHP引用配置,可以注释或修改
    include enable-php-73.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/easyimage.kingchl.cn.conf;
    #REWRITE-END
    
    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null; 
    }
    
    # 上传目录禁止运行`PHP`程序
    location ~ /(i)/.*.(php|php5)?$
    {
        deny all;
    }
    
    location ^~ /config/
    {
        deny all;
    }
    
    access_log  /www/wwwlogs/easyimage.kingchl.cn.log;
    error_log  /www/wwwlogs/easyimage.kingchl.cn.error.log;
}

我直接在宝塔的Nginx配置文件里插入这几句,这么做无法生效呀?

from easyimages2.0.

icret avatar icret commented on July 17, 2024
root /www/wwwroot/easyimage;

location ~* ^/(i|public)/.*\.(php|php5)$
   {
      deny all;
    }

放到 root /www/wwwroot/easyimage;后边才能生效,你可以尝试下你现在的配置

from easyimages2.0.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.