Ningx 80 端口 配置文件
server {
    #监听端口
    listen       80;
    #域名
    server_name  www.abc.com abc.com;
    #首页默认index.html文件  
    index index.html index.htm index.php;
    #项目路径
    root  /apps/www/html;
    #访问不带www的,默认跳转到www
    if ($http_host !~ "^www.abc.com$") {
        rewrite ^(.*) http://www.abc.com$1 permanent;
    }
    #图片放盗链
    location ~* \.(gif|jpg|png|bmp|zip|pdf)$ {
        valid_referers none blocked *.abc.com;
        if ($invalid_referer) {
                return 403;
         }      
    }    
    #nginx 缓存文件7天
    location ~ .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg)$
    {
        expires      7d;
    }   
    #缓存css js
    location ~ .*\.(?:js|css)$
    {
        expires      7d;
    }   
    #隐藏index.php
    location / {
        if (!-e  $request_filename) {
                rewrite  ^/(.*)$  /index.php/$1  last;
                break;
        }       

       index  index.php;

    }  
    #解析php 文件
    location ~ \.php {

       fastcgi_pass   127.0.0.1:9000;

        fastcgi_index  index.php;

        set $real_script_name $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                set $real_script_name $1;
                set $path_info $2;
        }
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        fastcgi_param PATH_INFO $path_info;
        include        fastcgi_params;
    }
80 端口 和 443 端口并存,(http和https共用)
server {
    listen       80;
    listen       443 ssl;
    server_name  www.abc.com;
    index index.html index.htm index.php;
    root  /apps/web/www;

    client_max_body_size 20m;

    #ssl on;
    #nginx秘钥
    ssl_certificate   /etc/nginx/ssl/abc.pem;
    ssl_certificate_key  /etc/nginx/ssl/abc.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    #禁止浏览器地址访问svn文件
    location ~ ^(.*)\/\.svn\/  {
        return 404;
    }
    #隐藏index.php
    location / {
        index  index.php index.html index.htm;
        #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
        if (!-e $request_filename)
        {
            #地址作为将参数rewrite到index.php上。
            rewrite ^/(.*)$ /index.php?s=$1;
            #若是子目录则使用下面这句,将subdir改成目录名称即可。
            #rewrite ^/admin/(.*)$ /admin/index.php?s=$1;
        }
    }
    #解析php
    location ~ \.php {

       fastcgi_pass   127.0.0.1:9000;

        fastcgi_index  index.php;

        set $real_script_name $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                set $real_script_name $1;
                set $path_info $2;
        }
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        fastcgi_param PATH_INFO $path_info;
        include        fastcgi_params;
        fastcgi_read_timeout 3600;
    }
}

解决 laravel-admin between datetime 假如数据库是时间戳int类型无法筛选。

laravel-admin默认的between->datetime(),查询默认是datetime类型,但是假如数据库是时间戳类型就会报错,又不想改底层文件的话可以试试加自定义筛选功能...

阅读全文

php解析英文语句,自动分解。

参考:https://www.php.net/manual/en/function.str-split.php 最近碰到一个问题,客户的英文地址太长,超出接口api字段长度,所以需要解析下语句分解发送。 ...

阅读全文

记录一个laravel-excel导出表格值为0导出excel显示空的解决方法。

最近在使用laravel-excel导出表格的时候,发现假如字段值为0的情况下,导出的excel中直接显示为空,找到一个方法解决,如下. 在laravel-excel的config配置中...

阅读全文

评论已经关闭。