Blog

  • discuz邮件设置

    站长->邮件设置->设置

    通过 SOCKET 连接 SMTP 服务器发送(支持 ESMTP 验证)

    SMTP 服务器

    ssl://smtp.gmail.com

    端口465

     
    同时,在Ucenter后台的邮件设置中进行同样的设置

  • python开启debug模式

    两种方式:

    app.debug = Ture
    app.run

    或者是

    app.run(debug = True)
  • apache开启gzip压缩和浏览器缓存功能

    http://witmax.cn/apache-deflate-expires.html

    1、开启gzip压缩

    开启gzip功能能大大降低网络传输的带宽,从而提高网页加载速度;一般对纯文本内容可压缩到原大小的40%。

    (1) 编辑Apache配置文件httpd.conf,查找下面这一行

    #LoadModule deflate_module modules/mod_deflate.so

    删除前面的#;如没有就查找LoadModule位置,加入上述行
    (2) 在httpd.conf末尾增加以下内容:

    <ifmodule mod_deflate.c>
    DeflateCompressionLevel 9
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
    AddOutputFilter DEFLATE css js
    </ifmodule>

    具体配置内容可参考mod_deflate模块手册。

    (3) 重启Apache服务

    2、开启浏览器缓存功能

    开启浏览器缓存后,在内容未过期前,浏览器不会重复从服务器提取数据文件,从而减少网页内容传输,提高网页打开速度。

    (1) 编辑Apache配置文件httpd.conf,查找下面这一行

    #LoadModule expires_module modules/mod_expires.so

    删除前面的#;如没有就查找LoadModule位置,加入上述行

    (2) 在httpd.conf末尾增加以下内容:

    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 12 month"
    ExpiresByType text/html "access plus 12 months"
    ExpiresByType text/css "access plus 12 months"
    ExpiresByType image/gif "access plus 12 months"
    ExpiresByType image/jpeg "access plus 12 months"
    ExpiresByType image/jpg "access plus 12 months"
    ExpiresByType image/png "access plus 12 months"
    EXpiresByType application/x-shockwave-flash "access plus 12 months"
    EXpiresByType application/x-javascript "access plus 12 months"
    ExpiresByType video/x-flv "access plus 12 months"
    </IfModule>

    具体配置内容可参考mod_expires模块手册。

    (3) 重启Apache服务

  • apache/nginx某目录abc强制https访问

    apache

    把如下代码写一个.htaccess,丢到/abc/里面

    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^(.*)?$ https://%{SERVER_NAME}/abc/$1 [L,R]

    nginx

    配置文件里写

    location /abc/ {
     if ( $scheme = 'http' ) {
     rewrite ^(.*)$ https://$host$1 permanent;
     }
    }
  • 解决WHMCS的PDF账单中文字体乱码

    whmcs 版本 512 发的邮件附件里有PDF账单

    显示中文的地方全为  ???

    需要设置3个地方

    1.logo

    把logo制作成logo.png(250*90会比较好看),放入 目录/images/,之后生成的账单会自动加上logo.

    2.公司地址或标语等文字

    在后台General Settings->Pay To Text填写

    3.中文显示问题

    参考:http://www.yinzhili.com/2009/08/using-tcpdf-to-generate-pdf-in-chinese.html

    原理是利用tcpdf这个php程序来生成pdf,但是默认没有中文字库,现在要把中文字库的三个文件droidsansfallback.ctg.z droidsansfallback.php droidsansfallback.z 放入到目录/includes/fonts/下,然后回到whmcs设置字库General Settings->Invoices->TCPDF Font Family->Custom->droidsansfallback

    有好心网友放出了droidsansfallback字库载地址:http://download.csdn.net/download/huyuchengus/2455138

    之后就可以完整的生成pdf账单了

  • 大学生,四不像

    毕业一个多月了,怎么才能走出这种无耐

    发现自己做不了的事情太多太多了

    没有什么故事