首页
好物推荐
薅羊毛领红包
精彩直播
好看壁纸
更多
隐私政策
友情链接
时光机
搜索
1
使用 docker 快速安装 Home Assistant
2,456 阅读
2
Ipad mini2 降级到IOS10.3.3系统
759 阅读
3
智能家居系统 Home Assistant 介绍
737 阅读
4
Home Assistant集成OpenWrt
733 阅读
5
Linux查看磁盘空间使用状态以及docker空间清理
592 阅读
无分类
智能家居
心得随想
文档教程
登录
Search
标签搜索
Linux
JS
教程
CSS
HTML
配置
NodeJS
Docker
解决方案
文档
Git
技术培训
Hadoop
Mac
Java
Windows
RiotJS
Python
VPS
Home Assistant
DONG HAO
累计撰写
139
篇文章
累计收到
48
条评论
首页
栏目
无分类
智能家居
心得随想
文档教程
页面
好物推荐
薅羊毛领红包
精彩直播
好看壁纸
隐私政策
友情链接
时光机
搜索到
37
篇与
Linux
的结果
2017-10-20
Nginx解决下载json静态文件乱码
Linux下采用的是utf-8的字符编码,默认情况下我们的浏览器在服务器没有指定编码或者静态页面没有声明编码的情况下会以GBK的编码去渲染页面,这样默认情况下返回中文的话浏览器用gbk来解析utf-8编码,显然会出现乱码,这时要在nginx location块中主动添加header来输出正确编码添加配置add_header Content-Type 'text/html; charset=utf-8';示例location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 7d; } location ~ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; add_header Content-Type 'text/html; charset=utf-8'; } }
2017年10月20日
74 阅读
0 评论
0 点赞
2017-07-19
linux安装htop来管理进程
源安装 On RHEL/CentOS – 32-bit OS -------------- For RHEL/CentOS 6 -------------- # wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm # rpm -ihv epel-release-6-8.noarch.rpm -------------- For RHEL/CentOS 5 -------------- # wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm # rpm -ihv epel-release-5-4.noarch.rpm On RHEL/CentOS – 64-bit OS -------------- For RHEL/CentOS 7 -------------- # wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm # rpm -ihv epel-release-7-13.noarch.rpm -------------- For RHEL/CentOS 6 -------------- # wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -ihv epel-release-6-8.noarch.rpm -------------- For RHEL/CentOS 5 -------------- # wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm # rpm -ihv epel-release-5-4.noarch.rpm 添加好源后执行安装 # yum install htop On Fedora OS # yum install htop # dnf install htop [On Fedora 22+ releases] On Debian and Ubuntu # sudo apt-get install htop 编译安装 On RHEL/CentOS and Fedora # yum groupinstall "Development Tools" # yum install ncurses ncurses-devel # wget http://hisham.hm/htop/releases/2.0.2/htop-2.0.2.tar.gz # tar xvfvz htop-2.0.2.tar.gz # cd htop-2.0.2 On Debian and Ubuntu $ sudo apt-get install build-essential $ sudo apt-get install libncurses5-dev libncursesw5-dev $ wget http://hisham.hm/htop/releases/2.0.2/htop-2.0.2.tar.gz $ tar xvfvz htop-2.0.2.tar.gz $ cd htop-2.0.2 下载好了源码之后编译安装 # ./configure # make # make install 运行htop htop
2017年07月19日
140 阅读
0 评论
0 点赞
2017-06-29
搬瓦工VPS购买教程
搬瓦工VPS,一款性价比极高的便宜VPS主机方案,有提供洛杉矶QNET、洛杉矶MACOM、纽约、凤凰城、佛罗里达、荷兰、弗里蒙特数据中心便宜年付OpenVZ VPS方案,开放功能比较全。适合我们基础建站、搭建环境以及各种折腾应用,而且支持支付宝购买续费。 搬瓦工官方网站 https://bandwagonhost.com/aff.php?aff=16054 注册 点击上面的链接, 选择右上角的 Register 进行注册操作。 这样的话我们以后登录就可以看到自己的机器列表。 用户管理 选择右上角的 Client Area 进入用户管理界面,如果没有登录,输入 用户名(注册邮箱)和 密码 进行登录。 服务器购买 点击VPS Hosting ,可以看到服务器列表 如果仅仅用来翻墙或者玩玩,可以购买最小化配置(最便宜,人民币120左右),建议kvm的机器。 我们然后会看到上图所示的界面,根据图示我们需要确定选择的方案以及时间,默认是洛杉矶机房,我们也可以选择其他的几个机房之一,点击ADD TO CART添加购物车。 在promotional code里面还可以输入优惠码来获得折扣,优惠码如下 服务器优惠码(可能会失效,逐个尝试) 优惠码 折扣 BWH1ZBPVK(6%) BWH1XZOBK(5.5%) BWH1NJJHL(4.5%) BWH1GFWZP(3.5%) BWH1FOXXE(3%) 输入后点击validate code,优惠码可用的话就可以看到折扣后价格。 核对我们选择方案的价格,没有问题后点击CHECKOUT结账。 然后我们就可以愉快的使用支付宝支付了。 [rihide] 客户端软件 Windows: shadowsocks-win Mac:ShadowsocksX-NG 或者命令行安装 pip install shadowsocks brew install shadowsocks-libev cpan Net::Shadowsocks Linux: Shadowsocks-Qt5 或者命令行安装 pip install shadowsocks apt-get install shadowsocks-libev cpan Net::Shadowsocks Android: shadowsocks-android iOS: Wingy OpenWRT: [shadowsocks-libev](opkg install shadowsocks-libev) SS配置 参照 https://teddysun.com/357.html [/rihide]
2017年06月29日
102 阅读
0 评论
0 点赞
2017-06-23
如何在windows下升级node & npm
upgrade nodenode有一个模块叫n,是专门用来管理node.js的版本的。 第一步:安装n模块: npm install -g n第二步: 升级node.js到最新稳定版 n stableBut,这在我的windows环境下报错: Google了一圈: (敲黑板!!)As stated in the readme file of that module, the module does not support Windows, hence the error you are getting. If you would like to update Node.js on Windows you can find binaries at https://nodejs.org/en/download/current/.于是乖乖去nodejs网站上下载.msi并安装,command line下成功,顺带着npm也一并更新了:
2017年06月23日
132 阅读
0 评论
0 点赞
2017-06-09
ghost使用pm2管理启动
以前运行ghost使用forever管理启动,但是现在发现pm2管理nodejs程序更好,遂尝试改造代码如下pm2.json{ "apps": [{ "name": "ghost", "script": "index.js", "cwd": "/data/wwwroot/blog.minws.com", "exec_mode": "cluster", "instances": 0, "max_memory_restart": "256M", "autorestart": true, "node_args": [], "args": [], "env": { "NODE_ENV": "production" } }] } 启动pm2 start pm2.json<br/>
2017年06月09日
90 阅读
0 评论
0 点赞
2017-04-12
私有DNS服务器之dnsmasq搭建
安装yum install dnsmasq -y 配置nano /etc/dnsmasq.confresolv-file=/etc/resolv.dnsmasq.conf //设置解析文件 strict-order //放开#注释 listen-address=公网/局域网IP地址,127.0.0.1 addn-hosts=/etc/dnsmasq.hosts nano /etc/resolv.dnsmasq.confnameserver 127.0.0.1 nameserver 119.29.29.29 nameserver 182.254.116.116 nameserver 114.114.114.114 nameserver 114.114.114.115 nameserver 223.5.5.5 nameserver 223.6.6.6 nano /etc/dnsmasq.hosts10.201.11.222 local //ping local 会指向10.201.11.222 启动service dnsmasq start
2017年04月12日
60 阅读
0 评论
0 点赞
2017-04-12
iptables开启DNS解析服务端口
使用dnsmasq搭建dns解析服务器需要开启53的UDP端口操作如下:iptables -I INPUT -p udp --dport 53 -j ACCEPT iptables -I OUTPUT -p udp --sport 53 -j ACCEPT /etc/init.d/iptables save service iptables restart
2017年04月12日
22 阅读
0 评论
0 点赞
2017-04-05
centos端口相关指令
列出所有端口netstat -ntlp 查看端口占用的进程lsof -i tcp:80 查看iptables状态/etc/init.d/iptables status 开启iptables端口iptables -I INPUT -p tcp --dport 3306 -j ACCEPT /etc/init.d/iptables save service iptables restart 关闭iptables端口iptables -I INPUT -p tcp --dport 3306 -j DROP /etc/init.d/iptables save service iptables restart 修改iptables规则iptables -R INPUT 3 -j DROP //将第三条INPUT规则修改掉 删除iptables规则iptables -D INPUT 1 //INPUT 规则表 //1 查看iptables状态的第几条 设置filter表INPUT默认规则是 DROP//注意:必须先将22端口加入到input规则,否则将ssh链接不上 //iptables -I INPUT -p tcp --dport 22 -j ACCEPT iptables -P INPUT DROP 干净配置/sbin/iptables -P INPUT ACCEPT /sbin/iptables -F /sbin/iptables -X /sbin/iptables -Z /sbin/iptables -A INPUT -i lo -j ACCEPT /sbin/iptables -A INPUT -p tcp --dport 22 -j ACCEPT /sbin/iptables -A INPUT -p tcp --dport 80 -j ACCEPT /sbin/iptables -A INPUT -p tcp -s 自己的公网ip -j ACCEPT /sbin/iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT /sbin/iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT /sbin/iptables -P INPUT DROP
2017年04月05日
16 阅读
0 评论
0 点赞
2016-12-06
Ubuntu Meta网络图标丢失解决方案
现象:在终端里面输入nm-applet,错误提示如下:(nm-applet:3338): Gdk-CRITICAL **: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed 问题分析:应该是权限不足导致的任务不能启动。解决方案:我是将当前登录用户加入root组,即可看到图标。
2016年12月06日
12 阅读
0 评论
0 点赞
2016-12-04
ubuntu打开eclipse提示jdk环境变量缺失报错的解决
Ubuntu在安装完eclipse后打开有时会遇到找不到jdk环境变量的错误:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No java virtual machine was found after searching the following locations 解决方案如下:1. 进入eclipse,打开终端 2. mkdir jre 3. cd jre 4. ln -s /usr/lib/jvm/jdk1.7/bin bin --(你的JDK目录)
2016年12月04日
65 阅读
0 评论
0 点赞
2016-11-14
python的wechat机器人框架-werobot
安装werobotpip install werobotwerobot githubhttps://github.com/whtsky/WeRoBotwerobot 文档https://werobot.readthedocs.io/zh_CN/latest/index.html示例代码 wechat.py# -*- coding: utf-8 -*- import werobot robot = werobot.WeRoBot(token='tokenhere', enable_session=True) @robot.subscribe def subscribe(message): return 'Hello My Friend!' @robot.unsubscribe def unsubscribe(message): return 'Hello My Friend!' @robot.text def text(message, session): last = session.get("last", None) if last: return last session["last"] = message.content return '这是你第一次和我说话' @robot.filter("帮助") def show_help(message): return """ 帮助 XXXXX """ @robot.click def click(message): if message.key == "abort": return "I'm a robot" robot.run(port=10001) nginx 配置server { listen 80; server_name wechat.minws.com; access_log off; location ~ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:10001; } } 启动文件 /etc/init.d/wechat#!/bin/sh ### BEGIN INIT INFO # Provides: wechat # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: wechat # Description: # ### END INIT INFO NAME=wechat.py DAEMON=/data/wwwroot/wechat.minws.com/$NAME case "$1" in start) echo "Starting $NAME..." nohup python $DAEMON >/dev/null 2>&1 & ;; stop) echo "Stopping $NAME..." sudo ps -ef|grep $NAME|grep -v grep|cut -c 9-15|xargs kill -9 ;; restart) $0 stop && sleep 2 && $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac exit 0 自启动chkconfig wechat on
2016年11月14日
31 阅读
0 评论
0 点赞
2016-11-09
java等环境变量配置
windows//jdk路径 新建 JAVA_HOME = E:\soft\Java_jdk\jdk1.7.0_45 //maven路径 新建 MAVEN_HOME = E:\soft\maven_3_1_1 新建或更新 CLASSPATH = .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; 在 Path 的最后加入: ;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;%MAVEN_HOME%\bin; linux//编辑环境变量文件 sudo nano /etc/profile //在末尾加入以下代码 JAVA_HOME=/usr/local/jdk1.7.0_79 M2_HOME=/home/hadong/soft/dev/maven_3_1_1 PATH=$M2_HOME/bin:$JAVA_HOME/bin:$PATH CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar MAVEN_OPTS="-Xms256m -Xmx512m" export JAVA_HOME export M2_HOME export PATH export CLASSPATH export MAVEN_OPTS //应用环境变量 source /etc/profile jdk7地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2016年11月09日
32 阅读
0 评论
0 点赞
2016-11-03
linux后台执行任务
nohup node-v6.2.1-linux-x64/bin/node index.js >/dev/null 2>&1 &
2016年11月03日
54 阅读
0 评论
0 点赞
2016-10-25
用forever运行ghost博客
如果没有安装,先安装npm install forever -g 查看forever运行状态forever list 运行GhostNODE_ENV=production forever start index.js 关闭Ghostforever stop index.js
2016年10月25日
16 阅读
0 评论
0 点赞
2016-10-17
linux防火墙iptables添加端口
//插入规则到最上面iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
2016年10月17日
9 阅读
0 评论
0 点赞
2016-10-17
JDK7在linux下安装及环境变量配置
使用wget下载到本地//使用cookie模式下载 wget --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz //修改环境变量配置文件 sudo nano ~/.bashrc //在文件末尾加入下面的代码 export JAVA_HOME=/usr/local/java/jdk1.7.0_79 export JAVA=/usr/local/java/jdk1.7.0_79 export JRE_HOME=/usr/local/java/jdk1.7.0_79/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib export PATH=$JAVA_HOME/bin:$PATH //应用新的环境变量 source ~/.bashrc
2016年10月17日
22 阅读
0 评论
0 点赞
2016-10-17
linux安装jetty以及配置
安装jetty程序//下载jetty8 wget http://download.eclipse.org/jetty/8.1.17.v20150415/dist/jetty-distribution-8.1.17.v20150415.tar.gz //解压jetty tar xfz jetty-distribution-8.1.17.v20150415.tar.gz //启动jetty java -jar start.jar //查看jetty帮助 java -jar start.jar --help 添加jetty自启动//创建jetty启动文件 sudo touch /etc/init.d/jetty //设置jetty启动权限 sudo chmod +x /etc/init.d/jetty //编辑jetty启动文件 sudo nano /etc/init.d/jetty //填入以下脚本命令 #!/bin/sh ### BEGIN INIT INFO # Provides: jetty # Required-Start: $network $local_fs $remote_fs # Required-Stop:: $network $local_fs $remote_fs # Should-Start: $all # Should-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: jetty service # Description: jetty service ### END INIT INFO case "$1" in start) echo "Starting jetty service ..\n" sudo /usr/java/jdk1.7.0_80/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar /usr/local/jetty/start.jar --daemon & #>logs/start.log 2>&1 & echo "Start jetty service done.\n" ;; stop) echo "Stoping jetty service ...\n" sudo /usr/java/jdk1.7.0_80/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar /usr/local/jetty/start.jar --stop echo "Stop jetty service done.\n" ;; esac exit 0 //设置自启动 sudo chkconfig jetty on
2016年10月17日
38 阅读
0 评论
0 点赞
1
2