最近有个哥们要小型服务器做网站cdn的节点教程,我这里记录一下,然后分享一下。有需要的朋友可以自行搞定。
如果你是国内的用户的话,建医用阿里云轻云服务器香港节点或者是阿里云国际节点,就是买个香港轻音服务器,或者是阿里云国际的香港服务器,因为他们都是30MB/S的带宽。节点服务器暂时是不需要服务器性能有多强悍,只需要后端的服务器的性能好一些。
买服务器那个步骤我就不推荐了,下面直接来到配置CDN的节点教程
如果你是centos6.9的话,建议用小樱的kangle,
[code]
- yum -y install wget
- echo "timeout=120" >> /etc/yum.conf
- yum -y update
- yum -y install epel-release
- chkconfig nscd off;service nscd stop;yum -y install dnsmasq;sed -i 's/#listen-address.*/listen-address=127.0.0.1/g' /etc/dnsmasq.conf;echo -e 'nameserver 127.0.0.1\nnameserver 8.8.8.8\nnameserver 2001:4860:4860::8888\nnameserver 2606:4700:4700::1111\nnameserver 1.1.1.1\nnameserver 114.114.114.114\nnameserver 119.29.29.29\noptions timeout:1 attempts:1 rotate' > /etc/resolv.conf;chkconfig dnsmasq on;service dnsmasq start
- rm -rf /etc/yum.repos.d/CentOS-Base.repo
- wget http://github.itzmx.com/1265578519/mirrors/master/CentOS/CentOS6-Base-itzmx.repo -O /etc/yum.repos.d/CentOS6-Base-itzmx.repo
- rm -rf /etc/yum.repos.d/*pel.repo /etc/yum.repos.d/epel-testing.repo
- wget http://github.itzmx.com/1265578519/mirrors/master/EPEL/epel.repo -O /etc/yum.repos.d/epel.repo
- rpm -ivh http://github.itzmx.com/1265578519/repo/master/CentOS/mysql-community-release-el6-5.noarch.rpm
- rm -rf /etc/yum.repos.d/mysql-community.repo /etc/yum.repos.d/mysql-community-source.repo
- wget http://github.itzmx.com/1265578519/repo/master/CentOS/mysql-community.repo -O /etc/yum.repos.d/mysql-community.repo
- yum clean all;yum makecache
- yum -y install which file wget make automake gcc gcc-c++ pcre-devel zlib-devel openssl-devel sqlite-devel quota unzip bzip2 libaio-devel
- ulimit -n 1048576
- echo "* soft nofile 1048576" >> /etc/security/limits.conf
- echo "* hard nofile 1048576" >> /etc/security/limits.conf
- wget http://github.itzmx.com/1265578519/kangle/master/ent/e.sh -O e.sh;sh e.sh /vhs/kangle
- wget http://github.itzmx.com/1265578519/kangle/master/kangle/easypanel/ep.sh -O ep.sh;sh ep.sh
- yum -y install memcached php-pecl-memcache
- yum -y install php-pecl-apc
- rm -rf /etc/sysconfig/memcached
- wget http://github.itzmx.com/1265578519/kangle/master/memcached/memcached -O /etc/sysconfig/memcached
- service memcached start
- chkconfig --level 2345 memcached on
- echo "127.0.0.1 download.safedog.cn" >> /etc/hosts
- setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
- wget http://github.itzmx.com/1265578519/safedog/master/2.4/safedog_linux64.tar.gz
- tar xzf safedog_linux64.tar.gz
- cd safedog_linux64
- chmod -R 777 install.py
- ./install.py
- sdcmd webflag 0
- sdcmd twreuse 1
- sdcmd sshddenyflag 1
- cd ..
- yum -y install mysql mysql-server
- rm -rf /etc/my.cnf
- wget http://github.itzmx.com/1265578519/kangle/master/mysql/5.6/my.cnf -O /etc/my.cnf
- service mysqld restart
[/code]
复制以上代码刀xshell,然后粘贴就可。
安装后通过访问进入后台设置,默认用户名admin,密码kangle,mysql数据库用户名root,密码空,初始化后点击左边的mysql管理进行修改root密码,修改后记得去服务器设置填写新密码
[code]http://ip:3312/admin[/code]
然后进入easypanel的后台,建立一个站点
这里要注意的是www.baidu.com 是你的网站域名,你的后端服务器IP是你的后端服务器,A记录ip是你这台机器的IP地址,你需要将你的域名解析到A记录IP
如果你是centos7的话,也是进入xhsell,复制粘贴如下代码:
[code]
yum update -y;yum install wget -y;wget http://www.osyum.com/yum/eprpm.sh -O ep.sh;sh ep.sh
[/code]
之后也是傻瓜类的安装,不过要注意的是,当你安装面板以后,登录到ip:3312/admin的界面时,centos7以下需要如下设置
centos7以上需要将主机localhost改为127.0.0.1既可。
你后端服务器也可以设置为kangle,话说kangle的并发能力也是不错的,
https暂时没有设置成功,如果设置成功的话,我也会给大家写一个简用的文章。
评论