存档

2010年4月 的存档

php设置强制使用https访问

2010年4月28日 DarkIce 没有评论

出于安全等考虑,可能需要设置强制https访问,那么php中可以采取如下设置。
代码如下:

if ($_SERVER["HTTPS"]<>"on")
{
        $xredir="https://".$_SERVER["SERVER_NAME"].
        $_SERVER["REQUEST_URI"];   header("Location: ".$xredir);
 
}

如果要强制非https访问那么把<>改成==就可以了。

https访问需要响应的ssl证书,默认的不可信任倒是也没关系,如果需要可信任的证书,可参考以下文章:
http://zou.lu/nginx-https-ssl-module/
http://blog.s135.com/startssl/

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/2b

分类: 技术 标签:

OpenVPN设置不同IP走不同路由

2010年4月5日 DarkIce 没有评论

方法一:
默认走OpenVPN,把不走OpenVPN的IP按下列方法设置
把类似于下面的代码加到OpenVPN的配置文件后面:

max-routes 1000
route 58.17.0.0 255.255.0.0 net_gateway
route 58.18.0.0 255.254.0.0 net_gateway
route 58.20.0.0 255.255.0.0 net_gateway
route 58.24.0.0 255.254.0.0 net_gateway
route 58.30.12.136 255.255.255.255 net_gateway

附:教育网freeip.txt 中国IP地址分配列表

方法二:
默认不走OpenVPN,设定部分IP通过OpenVPN访问
把类似于下面的代码加到OpenVPN的配置文件后面:

route-nopull
# vpnchina sever
route 174.36.181.0 255.255.255.0 net_gateway
#ustream
route 96.17.8.0 255.255.255.0 vpn_gateway
#no21984.org
route 97.74.203.0 255.255.255.0 vpn_gateway
#archive
route 207.241.0.0 255.255.0.0 vpn_gateway
#isohunt
route 208.71.112.0 255.255.255.0 vpn_gateway
# zkaip
route 174.37.148.0 255.255.255.0 vpn_gateway
#bit.ly
route 168.143.173.0 255.255.255.0 vpn_gateway
#adobe
route 192.150.0.0 255.255.0.0 vpn_gateway
# ke neng ba
route 74.207.248.0 255.255.255.0 vpn_gateway
# python
route 82.94.164.0 255.255.255.0 vpn_gateway
#ur.ly
route 216.239.34.0 255.255.255.0 vpn_gateway
#iphonedownloadblog
route 66.33.209.0 255.255.255.0 vpn_gateway
# uncyclopedia
route 96.45.180.0 255.255.255.0 vpn_gateway
#mediafire
route 93.46.8.0 255.255.255.0 vpn_gateway
route 8.7.198.0 255.255.255.0 vpn_gateway
route 37.61.54.0 255.255.255.0 vpn_gateway
# blackra1n
route 74.220.215.0 255.255.255.0 vpn_gateway
#r f a
route 63.85.36.0 255.255.255.0 vpn_gateway
#yam
route 60.199.252.0 255.255.255.0 vpn_gateway
#wei quan wang
route 75.125.252.0 255.255.255.0 vpn_gateway
#ff.im
route 64.13.142.0 255.255.255.0 vpn_gateway
# plurk
route 74.120.121.0 255.255.255.0 vpn_gateway
# b b c
route 212.58.240.0 255.255.248.0 vpn_gateway
# xiaochun
route 210.157.5.0 255.255.255.0 vpn_gateway
# dropbox
route 174.129.212.0 255.255.255.0 vpn_gateway
# wikimedia
route 208.80.152.0 255.255.255.0 vpn_gateway
# akamai
route 63.150.131.0 255.255.255.0 vpn_gateway
# flickr
route 67.195.19.0 255.255.255.0 vpn_gateway
route 69.147.90.0 255.255.255.0 vpn_gateway
# twitbrowser
route 97.74.144.0 255.255.255.0 vpn_gateway
# ipaddl
route 67.19.72.0 255.255.255.0 vpn_gateway
# delicious
route 76.13.6.0 255.255.255.0 vpn_gateway
# sendspace
route 216.151.186.0 255.255.255.0 vpn_gateway
#emule
route 74.53.185.0 255.255.255.0 vpn_gateway
# dev-team
route 72.32.231.0 255.255.255.0 vpn_gateway
# hellotxt
route 212.239.17.0 255.255.255.0 vpn_gateway
# Mediafire
route 205.196.120.0 255.255.255.0 vpn_gateway
# Geocity
route 202.93.87.0 255.255.255.0 vpn_gateway
#tinypic
route 209.17.74.0 255.255.255.0 vpn_gateway
# ultraxs.com
route 93.46.8.0 255.255.255.0 vpn_gateway
# AOL
route 64.12.0.0 255.255.0.0 vpn_gateway
route 207.200.64.0 255.255.192.0 vpn_gateway
route 205.188.0.0 255.255.0.0 vpn_gateway
# NTT Twitter
route 168.143.0.0 255.255.0.0 vpn_gateway
route 128.121.0.0 255.255.0.0 vpn_gateway
# Cloud Front (Twitter)
route 216.137.32.0 255.255.224.0 vpn_gateway
# Facebook
route 159.106.121.0 255.255.255.0 vpn_gateway
route 69.63.176.0 255.255.240.0 vpn_gateway
route 66.220.144.0 255.255.240.0 vpn_gateway
# Akamai (Facebook)
route 72.246.0.0 255.254.0.0 vpn_gateway
route 204.2.171.0 255.255.255.0 vpn_gateway
# Youtube / Google
route 8.8.0.0 255.255.0.0 vpn_gateway
route 66.249.0.0 255.255.0.0 vpn_gateway
route 74.125.0.0 255.255.0.0 vpn_gateway
route 209.85.128.0 255.255.128.0 vpn_gateway
route 202.78.112.0 255.255.240.0 vpn_gateway
route 66.102.0.0 255.255.240.0 vpn_gateway
route 208.65.152.0 255.255.252.0 vpn_gateway
# Revsci
route 216.223.0.0 255.255.0.0 vpn_gateway
# Amazon
route 174.129.0.0 255.255.0.0 vpn_gateway
# Omroep
route 145.58.0.0 255.255.0.0 vpn_gateway
# Transip
route 80.69.64.0 255.255.224.0 vpn_gateway
# Hurricane Electric (mail-archive.com)
route 72.52.64.0 255.255.192.0 vpn_gateway
# GoDaddy
route 64.202.160.0 255.255.224.0 vpn_gateway
# PsiNET
route 38.0.0.0 255.0.0.0 vpn_gateway
# Wordpress
route 72.233.0.0 255.255.128.0 vpn_gateway
route 74.200.192.0 255.255.192.0 vpn_gateway
route 76.74.254.0 255.255.255.128 vpn_gateway
route 65.52.0.0 255.252.0.0 vpn_gateway
# Spotify
route 78.31.8.0 255.255.255.0 vpn_gateway
# The Planet
route 74.52.0.0 255.252.0.0 vpn_gateway
# Slicehost / Posterous
route 67.207.128.0 255.255.224.0 vpn_gateway
# Softlayer / Twitpic
route 174.36.0.0 255.254.0.0 vpn_gateway
route 66.228.120.0 255.255.255.0 vpn_gateway
# Vimeo
route 66.235.112.0 255.255.240.0 vpn_gateway
route 208.67.232.0 255.255.248.0 vpn_gateway
route 72.21.192.0 255.255.224.0 vpn_gateway
# Wefollow
route 70.32.64.0 255.255.192.0 vpn_gateway
# blogspot
route 64.233.160.0 255.255.224.0 vpn_gateway
route 72.14.192.0 255.255.192.0 vpn_gateway
# badongo
route 216.45.48.0 255.255.240.0 vpn_gateway
# www.wenxuecity.com / psinet
route 38.0.0.0 255.0.0.0 vpn_gateway
# Twitpic
route 74.86.0.0 255.255.0.0 vpn_gateway
# www.dwnews.com / level3
route 209.244.0.0 255.252.0.0 vpn_gateway
# www.6park.com / the planet
route 74.52.0.0 255.252.0.0 vpn_gateway
# Backchina / the planet
route 209.62.0.0 255.255.128.0 vpn_gateway
# yFrog
route 208.94.0.0 255.255.252.0 vpn_gateway
# opera
route 213.236.128.0 255.255.128.0 vpn_gateway

方法三:
直接使用chnroutes
使用方法参见http://code.google.com/p/chnroutes/wiki/Usage

方法四:
直接使用DOS命令添加路由。这种方法对其它各类的VPN应该是通用的。
例如在命令行下运行如下命令(如果不熟悉的话,不推荐使用该方法):

route add 110.6.0.0 mask 255.254.0.0 %gw% metric 5
route add 110.16.0.0 mask 255.252.0.0 %gw% metric 5
route add 110.40.0.0 mask 255.252.0.0 %gw% metric 5
route add 110.48.0.0 mask 255.255.0.0 %gw% metric 5
route add 110.51.0.0 mask 255.255.0.0 %gw% metric 5
route add 110.52.0.0 mask 255.254.0.0 %gw% metric 5
route add 110.56.0.0 mask 255.248.0.0 %gw% metric 5
route add 110.64.0.0 mask 255.254.0.0 %gw% metric 5
route add 110.72.0.0 mask 255.254.0.0 %gw% metric 5

附:国内IP地址路由

参考文章:
http://kangzj.net/how-to-add-local-route-for-openvpn/
http://xiaolife.com/wordpress/use-openvpn-route-and-vpn_gateway/

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/2a

分类: 技术 标签:

PR更新为1

2010年4月3日 DarkIce 没有评论

中午看到某人说自己的网址PR上升到5了,刚才发现自己的博客网址也升到1了。
看来google是很重视愚人节的啊。。

开博差不多整3个月,在此留个记号。

转载请注明:转载自DarkIces.com
本文链接地址:http://dki.me/29

分类: 杂谈 标签: