Total Pageviews

Sunday, 20 August 2017

利用Dropbox+droppages搭建你的静态网站

DropBox是一款非常好用的免费网络文件同步工具,是Dropbox公司运行的在线存储服务,通过云计算实现因特网上的文件同步,用户可以存储并共享文件和文件夹。今天分享一下如何使用dropbox来搭建静态网页。

1、首先你得拥有一个Dropbox账户,点击这里www.dropbox.com注册.
2、注册并登陆后打开droppages.com进行授权,点击右上角sign up,然后允许授权。

3、接下来点击Create a new site,创建一个你的二级域名,输入如下图的格式(你的域名.droppages.com,切记后缀不可更改,否则创建不成功)

4、创建成功后,回到你的dropbox主页,然后点击>> 应用>>My.DropPages,这时候你就能看到刚才droppages生成的文件夹啦。

5、打开刚才生成的文件夹(小z这里是xiaozblog.droppages.com文件夹),然后你会看到有个public文件夹,那么你将你的静态网页上传至xiaozblog.droppages.com>>public文件夹即可。

至此大功告成,你可以试试小z的演示地址:xiaozblog.droppages.com

droppages提供了50M的应用空间,对静态网页来说完全够用了,通过这个方法你不需要用到FTP工具即可完成。如果你安装了dropbox客户端并将这个文件夹同步,那么就更加的方便,你只需要在本地修改你的网页即可。

可能有人会说了现在都是用动态的php、asp.NET、jsp等动态技术,谁还会用这种静态的啊,但是对于我们学习前端开发的同学如果想展示一下自己的作品,用这个方法还是不错的.

在CentOS系统,通过davfs2挂载Dropbox网盘

Dropbox是一个功能强大的同步盘,也是为数不多且提供WEBDAV支持的网盘,Linux系统可以安装davfs2通过webdav的方式来挂载Dropbox,方便存取文件或备份使用。如果您还没有注册Dropbox,可以访问www.dropbox.com注册(请自备梯子,否则无法打开)。

安装davfs2

CentOS安装davfs2非常简单,执行下面的命令即可:
yum install davfs2 -y

Dropbox开启webdav支持

这一步被坑了很久,官方也没找到帮助文档,网上说的是webdav地址为:https://dav.dropdav.com/ ,输入用户名和密码就ok,但实测压根不行啊,正确的做法是:

    先到https://www.dropdav.com注册一个账号
    授权dropdav访问Dropbox的权限
    记录dropdav的账号和密码

挂载Dropbox

上面步骤完成后挂载Dropbox就很简单了,分别执行下面的命令即可。这一步中会要求输入dropdav的账号和密码。


#创建挂载目录
mkdir /home/dropbox
#执行挂载命令
mount -t davfs https://dav.dropdav.com/backup /home/dropbox

上面的命令中https://dav.dropdav.com/backup,后面的backup为您在Dropbox创建的文件夹名字,请根据实际情况修改,看到如下截图后说明挂载成功。


完成之后将文件存放到/home/dropbox会自动同步到Dropbox,可以达到备份的目的.

总结

由于X墙的原因国内服务器可能无法正常使用Dropbox,或速度缓慢,推荐国外的服务器挂载Dropbox用来备份数据。国内支持WEBDAV的网盘还有坚果云,也可以使用此方法挂载.

用Fikker自建CDN,支持Https/页面缓存/实时监控/流量统计,防CC攻击

安装Fikker 缓存自建CDN加速,把这个自建CDN的工具分享出来。仔细研究了一下官网的介绍,发现Fikker安装方便,使用简单,是自己搭建CDN的好软件。

按照官网的说法,Fikker 是一款面向 CDN/站长 的专业级网站缓存(Webcache)和反向代#理服务器软件(Reversed Proxy Server),可以实现的功能有反向代#理 + 页面缓存 + 实时监控 + 流量统计 + 转向管理 + HTTPS + 防CC攻击。

不过看了一下免费版本的Fikker,貌似页面缓存这一项功能是没有的,所以免费版本只能用来给图片、JS、CSS等静态资源作CDN加速。Fikker还有一个主控系统,利用它可以将多个Fikker缓存节点进行统一管理,组建成一个全新的CDN缓存系统.

一、Fikker安装方法

Fikker官网:https://www.fikker.com,由广州市非客网络科技有限公司,创建于2010年。

安装准备:Fikker需要监听80/443/6780端口,若您的服务器已经安装过Nginx/Apache等服务,需要先停用,推荐使用一台全新的VPS进行安装。

#下载安装包
wget -c http://www.fikker.com/dl/fikkerd-3.7.3-linux-x86-64.tar.gz
#解压
tar zxvf fikkerd-3.7.3-linux-x86-64.tar.gz
#进入安装目录
cd fikkerd-3.7.3-linux-x86-64
#运行Fikker
./fikkerd.sh start

开始安装:依次复制下面的命令(需要root用户)执行,注意:适用于CentOS 6.x/7.x 等操作系统 64 位版本,对 CPU 无要求,内存 4GB 以上。

上面已经提到,Fikker监听80/443/6780端口,请注意在防火墙放行端口,输入下面的命令:

#如果防火墙使用的iptables(Centos 6)
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
iptables -I INPUT -p tcp --dport 6780 -j ACCEPT
service iptables save
service iptables restart
#如果使用的是firewall(CentOS 7)
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --zone=public --add-port=6780/tcp --permanent
firewall-cmd --reload

完成后访问http://IP:6780,初始密码为123456,如果打不开,请输入命令netstat -apn|grep ‘6780’查看端口是否监听,检查防火墙是否放行端口。

Fikker登录账号
二、Fikker使用教程

添加站点:在Fikker 后台 – 管理工具 – 主机管理 – 右下角添加主机,添加一个需要CDN加速的域名(支持HTTP/HTTPS),如下截图。(点击放大)

Fikker添加主机

上传SSL证书:如果是添加Https站点,你需要上传你的证书和密钥。

Fikker上传证书

设置源站:添加主机后,还需要设置回源地址,告知CDN节点从哪里获取数据,源站添加完毕后大功告成,您可以将DNS解析至CDN节点了。(点击放大)

Fikker添加源站

其它操作:如果您需要将Fikker注册为服务,请执行下面的命令:

#注册服务
./fikkerd.sh install
#停止服务
./fikkerd.sh stop
#删除服务
./fikkerd.sh uninstall

三、自建CDN系统

第一步:先安装 Fikker 缓存(支持 Linux/Windows 系统) 。将 Fikker 缓存安装在一个或多个缓存节点服务器上,用于缓存加速/反向代#理等。

Fikker安装成功

第二步:再安装 Fikker CDN 主控。用于管理多个缓存节点,用于同步各个节点的配置/域名流量统计/用户管理/套餐管理等。注:可选安装项,节点很少时,可以不用主控。(点击放大)

Fikker主控端

第三步:最后利用第三方智能解析(例如 Cloudxns/DNSpod/51DNS/DNSla 等) 。利用第三方智能解析,将网站的域名以轮询/分地区/分线路的方式,分别解析到各个缓存节点服务器IP上即可。注:不要解析到主控IP上。

Fikker实现CDN加速
四、总结

Fikker CDN可以很方便的搭建自己的CDN服务,并且支持HTTP/HTTPS,但是Fikker占用了80/443,导致无法和自己的WEB服务共存。如果您不想折腾还是老老实实用第三方CDN吧。

启用了CDN后你会发现你的的程序获取到的用户的IP都变成了缓存节点的IP了。想要获取到用户的真实IP,请参考以下代码进行相应的调整。

#php 获得用户真实 IP 代码举例:
function getRemoteIP()
{
    if (!isset($_SERVER["HTTP_X_FORWARDED_FOR"])) /* 存在 X-Forwarded-For 吗? */
    {
        return $_SERVER["REMOTE_ADDR"]; /* 兼容已有程序 */
    }
   
    return $_SERVER["HTTP_X_FORWARDED_FOR"]; /* 返回用户真实 IP, 如为多个 IP 时, 则取第一个 */
}

#asp.net 获得用户真实 IP 代码举例:
void getRemoteIP()
{
    string SourceIP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; /* 存在 X-Forwarded-For 吗? */
    if (string.IsNullOrEmpty(SourceIP))
    {
        SourceIP = Request.ServerVariables["REMOTE_ADDR"]; /* 兼容已有程序 */
    }
   
    Response.Write(SourceIP); /* 返回用户真实 IP, 如为多个 IP 时, 则取第一个 */
}

#asp 获得用户真实 IP 代码举例:
<%
Private Function getRemoteIP()
Dim strIPAddr
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
Else
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
getIP = Trim(Mid(strIPAddr, 1, 30))
End Function

ip=getRemoteIP()
response.write(ip)
%>

pingthat:网站监控服务

pingthat,stablehost旗下推出的免费(收费)监控服务,支持http(s)、ssh、dns、tcp、smpt等。
官网:https://www.pingthat.com/
支持Email、SMS、自定义网址等3种通知方式。
需要邮箱激活链接。免费版支持添加2个服务(推广期,暂时没看到数量限制)。
有亚洲、美国东、西岸、欧洲服务器。
最低可设置1分钟监测频率。

一个基于PHP的benchmark跑分脚本

上传到支持PHP的空间即可,现在就可以方便的测试虚拟主机了。
PHP benchmark Script

一代美女 无声飘零:80年代女星殷亭如在美国病逝

8月18日晚,知名电影人程青松在网上发布消息,演员殷亭如于2017年6月11日因病于美国去世,享年62岁。
  
  程青松微博截图
据悉,殷亭如于1955年出生于上海市,毕业于上海音乐学院进修班。80年代初,殷亭如因主演滕文骥执导的故事片《苏醒》而初登大银幕,随后又陆续出演《都市里的村庄》《锅碗瓢盆交响曲》《乡思》《大明星》等大银幕作品。殷亭如于1985年赴美留学,后定居美国。在中国电影的黄金年代,殷亭如因其清新独特的气质为观众所喜爱,她留在银幕上的形象也将永存电影记忆
  80年代气质美女殷亭如美国病逝 一生留六部大银幕作品:青年电影手册
  一代美女,无声飘零。
  
对于现在的中国观众来说,80年代的气质明星殷亭如是一个陌生的名字,即使在80年代,她也没有刘晓庆、陈冲、张瑜、龚雪、潘虹、斯琴高娃等人的名气大。可是她自然、清新、文雅,充满书卷气的形象,仍然让她脱颖而出,堪称中国银幕上的清流派。
  

殷亭如是上海人,上过音乐学院,当过中学音乐老师,后来又考进上海乐团。在她身上,有一种脱俗的都市气质,洋气、书卷气和贵气,可以说是中国银幕上的第一代气质型美女。
  
1981年,殷亭如走上大银幕,在滕文骥导演的影片《苏醒》中扮演一个戏份并不多的角色(这部电影的女主是陈冲,也是陈冲去美国留学前在国内拍摄的最后一部电影)。但是这是她走上大银幕的第一步。
  
《苏醒》左:殷亭如 右:陈冲
  1982年,殷亭如出演滕文骥导演的《都市里的村庄》,电影就在上海拍摄。她扮演造船厂的电焊工丁小亚,一个被孤立的“劳动模范”。她遭到工友的排挤,爱上了另一个有工读前科的工人。
  
《都市里的村庄》的殷亭如
  这在现在完全是无法想象的一个事情。一个先进青年怎么能爱上一个有过劣迹的青年呢?两颗孤独的心灵走在了一起。殷亭如的表演质朴、坚定、有自己的独立人格,立刻赢得了观众的心。
  
《都市里的村庄》中的殷亭如(左)
  1983年,殷亭如出演了滕文骥导演的影片《锅碗瓢盆交响曲》,搭档80年代中国银幕第一气质帅哥孙淳。这部表现国营饭店改革的影片,展现了那一时期青年人的生活风貌。殷亭如在电影中的造型,长发飘飘,宛如女神。
  



《锅碗瓢盆交响曲》左:孙淳 右:殷亭如
  殷亭如因扮演丁小亚,刘俊英这两个银幕角色而成为一代电影观众的青春偶像。她迅速的成为电影明星,登上各种电影杂志的封面、封底,还有挂历。
  


为了证明自己不仅仅能出演洋气的城市女性,殷亭如1984年在银幕上扮演了乡村女教师周凉姑,这也是她第一次出演农村女性。她在电影《乡思》里的表演广受好评好评。
  



《乡思》 左:殷亭如 右:张国立
  殷亭如在80年代的中国女演员当中,是一个安静优雅的存在。仿佛深谷的百合,静静绽放。
  




1985年殷亭如放弃在国内火红的事业,自费赴美留学,攻读电影专业和传播。
  1987年,殷亭如应滕文骥导演邀请,回国拍摄了歌舞片《大明星》。音乐科班出身的殷亭如在这部影片中扮演一个草根成为了大明星,她在电影中载歌载舞,像一个发光体一样,通过角色实现了自己的音乐梦想。当然,她也没有想到这会是她在中国大陆拍摄的最后一部电影。
  
《大明星》里的殷亭如,她扮演女主角亭亭。
  




殷亭如在中国大陆拍摄了一共五部电影,其中有四部都是由滕文骥导演,她担任了三部电影的主演,也是殷亭如电影生涯里最高光的时刻。她是中国80年代电影星空中一颗别具魅力的星辰。
  1989年,殷亭如拍摄了一部全部在美国取景的香港(专题)电影《警察也移民(专题)》。这是她最后一部大银幕作品。
  
1980年走上银幕,1989年告别银幕,电影生涯短短十年。殷亭如留给中国银幕是永远青春的形象。虽然只拍摄了六部电影,对影迷来说,有些遗憾。从另一种意义上来说,她又是幸运的,她在中国电影的黄金年代,因其清新独特的气质为观众所喜爱,她留在银幕上的形象将永存中国电影的记忆之中。
  愿殷亭如在天堂安好!

from http://www.backchina.com/news/2017/08/20/511284.html

gfw的帮凶-NetGuard

A simple way to block access to the internet per application

NetGuard provides simple and advanced ways to block access to the internet - no root required. Applications and addresses can individually be allowed or denied access to your Wi-Fi and/or mobile connection.
Blocking access to the internet can help:
  • reduce your data usage
  • save your battery
  • increase your privacy
NetGuard is the first free and open source no-root firewall for Android.
Features:
  • Simple to use
  • No root required
  • 100% open source
  • No calling home
  • No tracking or analytics
  • Actively developed and supported
  • Android 4.0 and later supported
  • IPv4/IPv6 TCP/UDP supported
  • Tethering supported
  • Multiple device users supported
  • Optionally allow when screen on
  • Optionally block when roaming
  • Optionally block system applications
  • Optionally forward ports, also to external addresses (not available if installed from the Play store)
  • Optionally notify when an application accesses the internet
  • Optionally record network usage per application per address
  • Optionally block ads using a hosts file (not available if installed from the Play store)
  • Material design theme with light and dark theme
PRO features:
  • Log all outgoing traffic; search and filter access attempts; export PCAP files to analyze traffic
  • Allow/block individual addresses per application
  • New application notifications; configure NetGuard directly from the notification
  • Display network speed graph in a status bar notification
  • Select from five additional themes in both light and dark version
There is no other no-root firewall offering all these features.
Requirements:
Downloads:
Usage:
  • Enable the firewall using the switch in the action bar
  • Allow/deny Wi-Fi/mobile internet access using the icons along the right side of the application list
You can use the settings menu to change from blacklist mode (allow all in Settings but block unwanted applications in list) to whitelist mode (block all in Settings but allow favorite applications in list).
  • Red/orange/yellow/amber = internet access denied
  • Teal/blue/purple/grey = internet access allowed




For more screenshots, see here.

Compatibility

The only way to build a no-root firewall on Android is to use the Android VPN service. Android doesn't allow chaining of VPN services, so you cannot use NetGuard together with other VPN based applications. See also this FAQ.
NetGuard can be used on rooted devices too and even offers more features than most root firewalls.
Some Android versions, expecially not updated Samsung Android versions, have a buggy VPN implementation, which results in Android refusing to start the VPN service in certain circumstances, like when there is no internet conncectivity yet (when starting up your device) or when incorrectly requiring manual approval of the VPN service again (when starting up your device). Unfortunately these Android bugs cannot be worked around by NetGuard.
Filtering mode cannot be used on CopperheadOS.
NetGuard will not work or crash when the package com.android.vpndialogs has been removed or otherwise is unavailable. Removing this package is possible with root permissions only.
NetGuard is supported for phones and tablets only, so not for other device types like on a television or in a car.
Wi-Fi or IP calling will not work if your provider uses IPsec to encrypt your phone calls, SMS messages and/or MMS messages, unless there was made an exception in NetGuard for your provider (currently for T-Mobile and Verizon). I am happy to add exceptions for other providers, but I need the MCC codes, MNC codes and IP address ranges your provider is using. As an alternative you can enable the option 'Disable on call', which is available since version 2.113.

Frequently Asked Questions (FAQ)

(0) How do I use NetGuard?
(1) Can NetGuard completely protect my privacy?
(2) Can I use another VPN application while using NetGuard?
(3) Can I use NetGuard on any Android version?
(4) Will NetGuard use extra battery power?
(6) Will NetGuard send my internet traffic to an external (VPN) server?
(7) Why are applications without internet permission shown?
(8) What do I need to enable for the Google Play™ store app to work?
(9) Why is the VPN service being restarted?
(10) Will you provide a Tasker plug-in?
(13) How can I remove the ongoing NetGuard entry in the notification screen?
(14) Why can't I select OK to approve the VPN connection request?
(15) Why won't you support the F-Droid builds?
(16) Why are some applications shown dimmed?
(17) Why is NetGuard using so much memory?
(18) Why can't I find NetGuard in the Google Play™ store app?
(19) Why does application XYZ still have internet access?
(20) Can I Greenify/hibernate NetGuard?
(21) Does doze mode affect NetGuard?
(22) Can I tether / use Wi-Fi calling while using NetGuard?
(24) Can you remove the notification from the status bar?
(25) Can you add a 'select all'?
(27) How do I read the blocked traffic log?
(28) Why is Google connectivity services allowed internet access by default?
(29) Why do I get 'The item you requested is not available for purchase'?
(30) Can I also run AFWall+ on the same device?
(31) Why can some applications be configured as a group only?
(32) Why is the battery/network usage of NetGuard so high
(33) Can you add profiles?
(34) Can you add the condition 'when on foreground'?
(35) Why does the VPN not start?
(36) Can you add PIN or password protection?
(37) Why are the pro features so expensive?
(38) Why did NetGuard stop running?
(39) How does a VPN based firewall differ from a iptables based firewall?
(40) Can you add schedules?
(41) Can you add wildcards?
(42) Why is permission ... needed?
(43) I get 'This app is causing your device to run slowly'
(44) I don't get notifications on access
(45) Does NetGuard handle incoming connections?
(46) Can I get a refund?
(47) Why are there in application advertisements?
(48) Why are some domain names blocked while they are set to be allowed?
(49) Does NetGuard encrypt my internet traffic / hide my IP address?
(50) Will NetGuard automatically start on boot?
(51) NetGuard blocks all internet traffic!
(52) What is lockdown mode?
(53) The translation in my language is missing / incorrect / incomplete!
(54) How to tunnel all TCP connections through the Tor network?
(55) Why does NetGuard connect to Amazon / ipinfo.io?
(56) NetGuard allows all internet traffic!
(57) Why does NetGuard use so much data?
(58) Why does loading the application list take a long time?
(59) Can you help me restore my purchase?
(60) Why does IP (Wi-Fi) calling/SMS/MMS not work?
(61) Help, NetGuard crashed!

Support

For questions, feature requests and bug reports, please use this XDA-Developers forum thread.
There is support on the latest version of NetGuard only.
There is no support on things that are not directly related to NetGuard.
There is no support on building and developing things by yourself.
NetGuard is supported for phones and tablets only, so not for other device types like on a television or in a car.

Contributing

Building
Building is simple, if you install the right tools:
The native code is built as part of the Android Studio project.
It is expected that you can solve build problems yourself, so there is no support on building. If you cannot build yourself, there are prebuilt versions of NetGuard available here.
Translating
  • Translations to other languages are welcomed
  • You can translate online here
  • If your language is not listed, please send a message to marcel(plus)netguard(at)faircode(dot)eu
  • You can see the status of all translations here.
Please note that you agree to the license below by contributing, including the copyright.

Attribution

NetGuard uses:
from https://github.com/M66B/NetGuard