放弃阿里云的服务器,将wp迁移到家里的工控机之后一直就有个疑问。安装之后的磁盘空间显示的容量只有硬盘大小的一半。导致我一度以为实际磁盘就是100G的。
ubuntu下php扩展的曲线救国计划
每次更换服务器,后续都会有很多的事情需要去处理。有的是服务器本身的问题,有的是各种配置问题。所以不到万不得已实在是不想更换服务器,下午看到杜老师的留言提到了litespeed cache,于是登录后台看了一眼,发现原来的redis缓存配置没有生效。问题也很容易定位,那就是没有安装php的redis扩展。正常的话通过apt就可以安装,但是问题出现了,工控机上php 和php-fpm不是同一个版本。
ubuntu性能监视工具glances
Glances is a cross-platform monitoring tool which aims to present a maximum of information in a minimum of space through a curses or Web based interface. It can adapt dynamically the displayed information depending on the terminal size.
It can also work in client/server mode. Remote monitoring could be done via terminal, Web interface or API (XMLRPC and RESTful).
Glances is written in Python and uses the psutil library to get information from your system.
Stats can also be exported to external time/value databases.
PyCharm 2021.3.3 修改启动图片
想修改一下pycharm的启动背景,按照网上的办法直接修改pycharm.jar
pycharm的启动图片放在
pycharm安装目录\lib
文件夹下的pycharm.jar
文件中
直接右键用压缩软件打开.jar文件,里面的pycharm_logo.png和pycharm_logo@2x.png两个图片文件就是启动图,分辨率分别是640×400和1280×800,将你制作的启动图(尽量不要改变分辨率)拖进压缩包替换他们即可.
Sip服务器(Freeswitch)屏蔽国外IP
SIP攻击很常见,特别是各大云服务器,基本上开了个公网IP绑定到实例机器就会被外国IP一遍怼。防范也容易,就是把外国IP禁掉。
实现:iptables+ipset,只允许中国IP访问本机,也就实现了封禁国外IP的效果。
优点:匹配迅速,免去iptables单链匹配。
操作步骤:
1.安装ipset 以及iptabls
#安装ipset: RedHat:yum install ipset Debian:apt-get install ipset #建表 ipset create china hash:net hashsize 10000 maxelem 1000000 #批量增加中国IP到ipset的china表 #以下内容保存成脚本执行即可 #!/bin/bash rm -f cn.zone wget http://www.ipdeny.com/ipblocks/data/countries/cn.zone for i in `cat cn.zone` do ipset add china $i done
nginx 代理google搜索
为了能够正常访问google进行搜索,之前一直用的ssh转socks代理。后来觉得如果s2主机只用来做代理,有点浪费了。于是就想了干脆反向代理一个google搜索。网上相关的文章比较多,随便搜索一下就可以找到相关的代码。基于nginx的主要配置代码如下:
proxy_cache_path /tmp/accounts levels=1:2 keys_zone=cache:10m max_size=10g inactive=60m use_temp_path=off;
server {
server_name h4ck.ws;
location / {
proxy_redirect off;
proxy_cache cache;
proxy_cache_valid 200 304 12h;
proxy_cache_valid any 10m;
proxy_cookie_domain google.com h4ck.ws;
proxy_pass https://www.google.com;
proxy_connect_timeout 20s;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
proxy_set_header Host "www.google.com";
proxy_set_header User-Agent $http_user_agent;
proxy_set_header Referer https://www.google.com;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Accept-Language "zh-CN";
# proxy_set_header Cookie "PREF=ID=047808f19f6de346:U=0f62f33dd8549d11:FF=2:LD=zh-CN:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2W1IQ-Maw"; #这行代码可能会导致google监测到流量异常
sub_filter https://www.google.com https://h4ck.ws;
sub_filter https://www.google.co.jp https://h4ck.ws;
sub_filter_once off;
addition_types *;
}
}
阿里云 opensips nat内网穿透
书接上文,上次在阿里云安装好opensips之后,发现无法在公网ip监听。为了能够快速测试后续改用内网服务器搭建sips服务器。现在功能差不多了,于是就需要将opensips服务器重新部署到公网上。不得不再次面对这个蛋疼的问题。通过搜索之后发现可以通过rtpproxy实现内网穿透?(这个说不知道准不准去,没有深入研究实现原理)
方法也比较简单,安装rtpproxy:
sudo apt-get install rtpproxy
安装之后修改opensips.cfg配置文件,添加如下内容:
#rtpproxy
loadmodule "rtpproxy.so"
modparam("rtpproxy", "rtpproxy_sock", "unix:/var/run/rtpproxy/rtpproxy.sock") #需要将unix路径修改为rtpproxy对应的sock路径。
ubuntu 18.04 安装opensips 3.1
OpenSIPS is an Open Source SIP proxy/server for voice, video, IM, presence and any other SIP extensions.OpenSIPS is a multi-functional, multi-purpose signaling SIP server used by carriers, telecoms or ITSPs for solutions like Class4/5 Residential Platforms, Trunking / Wholesale, Enterprise / Virtual PBX Solutions, Session Border Controllers, Application Servers, Front-End Load Balancers, IMS Platforms, Call Centers, and many others – see the full Set of Features.
搜索一下网上安装opensips的文章基本都是源码安装的,虽然从源码安装并不是十分困难,但是在安装过程中需要处理各种依赖库。并且在某些系统上会出现编译不过的问题,在阿里云的服务器上很容易就通过源码安装好了opensips。但是由于阿里云的ecs没有经典网络,所以无法在公网ip绑定服务,导致客户端无法正常连接。如果有在阿里云部署服务的,那么可能会在这个地方失败。
在内网尝试部署的时候出现了另外一个问题,那就是源码编译不过去。搜索了一下发现其实可以通过ubuntu的apt命令进行安装,不过官方的apt源限定了linux的发行版本。所以在安装之前最好先确认一下,建议使用ubuntu18.04.