在宝塔面板安装php5.6的ffmpeg-php扩展

感谢瓜老板。

环境:宝塔面板,php5.6

过程:

1.git clone https://github.com/nilsringersma/ffmpeg-php # 下载ffmpeg-php的相关文件

2.cd ffmpeg-php # 转到 ffmpeg-php 的目录

3./www/server/php/56/bin/phpize # 运行 phpize

4../configure --with-php-config=/www/server/php/56/bin/php-config --enable-skip-gd-check # 配置
ffmpeg-php-1.png

5.make # 编译

6.make install # 安装
ffmpeg-php-2.png

7.在软件管理,php5.6的设置窗口里,打开配置文件,在末尾加上:extension=/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/ffmpeg.so
ffmpeg-php-3.png

8.重载php5.6后,在phpinfo中,可以看到ffmpeg的相关信息
ffmpeg-php-4.png

参考:

在 web.py 中用阿里云的免费证书设置https访问

网友发帖问,所以有此实践。

环境:Debian9,python2.7

过程:

1.pip install web.py # 安装 web.py,本例版本是 web.py-0.39
webpy-1.png

2.pip install pyOpenSSL # 还需安装这个包
webpy-2.png

3.vi test.py # 创建测试文件,内容如下:(请替换相应的ssl证书存储路径)

import web
from web.wsgiserver import CherryPyWSGIServer

CherryPyWSGIServer.ssl_certificate = "/root/swas.anqun.org.pem"
CherryPyWSGIServer.ssl_private_key = "/root/swas.anqun.org.key"

urls = ("/.*", "hello")
app = web.application(urls, globals())

class hello:
    def GET(self):
        return 'Hello, world!'

if __name__ == "__main__":
    app.run()

webpy-3.png

4.python test.py # 运行测试,默认在8080端口上
webpy-4.png

5.在浏览器里访问,如本例,https://swas.anqun.org:8080,正常
webpy-5.png

参考:http://webpy.org/cookbook/ssl

在IIS 7 里添加 .7z 文件 MIME类型

环境:Windows 2008 R2

过程:

图1:在浏览器地址栏里输入完整的.7z文件网址,提示404 - 找不到文件或目录
iis-mime-7z-0.png

图2:在IIS站点管理界面,打开 “MIME 类型”
iis-mime-7z-1.png

图3:点击“添加”,增加文件扩展名为.7z,MIME类型为 application/octet-stream
iis-mime-7z-2.png

图4:保存设置后。再在浏览器里访问.7z文件网址,浏览器会弹框提示保存到哪了
iis-mime-7z-3.png

参考:

替换typecho默认模板中外部的http文件链接为https

新版本的浏览器,对包含http文件链接的站点访问,不显示绿色的。使用谷歌浏览器访问本博客,会在地址栏右端显示“不运行不安全的脚本”。通过浏览器自带的F12调试工具,知道是外部的一个css和两个js脚本文件引用地址(cdn.staticfile.org)是http,并不是https开头的。

操作:

1.转到typecho文件目录,执行 grep -rnw './' -e 'cdn.staticfile.org' 查看到http网址引用,在 usr/themes/default/header.php 中
typecho-js-https-1.png

2.sed -i 's/http:\/\/cdn.staticfile.org/https:\/\/cdn.staticfile.org/g' usr/themes/default/header.php 用https替换http
typecho-js-https-2.png

3.再次在浏览器测试,谷歌浏览器显示网页是https的,正常

参考:

在Debian 9系统里安装dante socks5

sock5方便公司管理业务,如外网的访问。

环境:debian 9, dante 1.4.1

过程:

1.apt update # 更新软件仓库
2.apt-get install dante-server # 安装dante服务端
danted-1.png
3.vi /etc/danted.conf # 编辑danted的配置文件内容,如下

# 标准错误记录
logoutput: stderr

# 使用本地所有可用网络接口的 3721 端口
internal: 0.0.0.0 port = 3721

# 输出接口设置为 eth0
external: eth0

# socks的验证方法,设置为 pam.username,本例中,是使用系统用户验证,即使用adduser添加用户
socksmethod: pam.username

# user.privileged: root

user.unprivileged: nobody

user.libwrap: nobody

# 访问规则
client pass {
        from: 0.0.0.0/0  to: 0.0.0.0/0
}

socks pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        protocol: tcp udp
        socksmethod: pam.username
        log: connect disconnect
}

socks block {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect error
}

danted-2.png
4.adduser --no-create-home --shell /usr/sbin/nologin liujia2 # 添加一个本地用户,不创建默认目录和登录Shell

5.systemctl start danted # 启动 danted 服务

6.在浏览器里设置socks5代理,访问测试网站,显示socks5服务器的IP地址
danted-3.png

7.如服务器有IPv6,可以访问IPv6网站,如 ipv6.baidu.com
danted-4.png

参考: