1、康樂簡介
主要特色
一、免費開源
kangle技術團隊但願國人擁有一款真正好用、易用、實用的國產web服務器。
二、跨平臺
可在linux、windows、freebsd、openbsd、netbsd、solaris等平臺上運行。
三、可輕鬆查看到被攻擊的url
這是kangle web服務器獨有的,其它web服務器很難查找到。
四、性能高
工做模型多樣化。Windows上採用iocp、Linux上採用epoll、Bsd上採用kqueue。
五、功能強大、靈活
kangle的訪問控制理念來自linux的iptables防火牆,kangle擁有功能最小化的匹配模塊和標記模塊,經過組合,反轉等能夠實現用戶最複雜的需求;
談kangle的訪問控制:點擊查看
六、是一款作idc的專業web服務器
.實現虛擬主機獨立身份,獨立進程。
.隔離攻擊(實現某個虛擬主機受到外部攻擊,不影響到服務器上其它虛擬主機)。
.智能防cc攻擊(CC是http協議的攻擊,不是tcp/ip,kangle是底層的web服務器,更懂http)。
.作全能空間(php虛擬主機、java虛擬主機等)
主要特性php
- kangle採用基於事件驅動(epoll等)加非阻塞socket及異步IO的方式構架,使其比傳統web服務器性能更高;靜態網頁處理能力達到Apache的8-10倍左右。
- kangle支持isapi,fastcgi,cgi,ajp,uwsgi,fcgi,hmux,http等多種擴展接口,是一個很是開放的系統,很是方便的作負載均衡功能;
- kangle內置內存/磁盤兩級緩存,採用LRU淘汰算法,緩存命中率很是高,有效下降資源佔用
- 能夠設置每一個虛擬主機獨立進程,獨立身份運行(虛擬主機商的最愛,安全的實現虛擬主機功能);
- 企業版還帶有獨特的防CC攻擊和限制虛擬主機cpu的功能,自動監測動態網頁的訪問頻率,一但達到設定的閥值,自動對該網頁保護,kangle能區分攻擊訪問和正常訪問。一但某個虛擬主機的cpu超過設置,自動對該虛擬主機下降優先級。從而不影響其它虛擬主機。作到隔離攻擊。
- 獨有的命令擴展(虛擬化其它web服務器,使其它web服務器亦具備前述優勢,如tomcat,這樣就能安全的提供java虛擬 主機了)
- kangle具備擴展隊列功能。對於突發大量的動態網頁請求會加入到隊列中,以使系統穩定的提供服務
- kangle的訪問控制理念來自linux的iptables防火牆,kangle實現不少最小化的匹配模塊和標記模塊,經過組合,反轉能夠實現最複雜的需求;從而實現強大的訪問請求控制(url,ip地址,鏈接數/網速限制,http頭,時間控制,多種http認證,服務器負載,url重定向,url重寫,內容過濾等等);
- 支持遠程web方式管理.默認管理端口:3311,初始用戶名:admin,密碼:kangle;
- 兼容apache的自定義.htaccess功能
2、安裝部署
第一步:系統支持包安裝
yum -y install wget tar make automake gcc gcc-c++ pcre pcre-devel zlib-devel sqlite-devel openssl-devel libxml2 libxml2-devel libtool libtool-libs quota perl gd
第二步:安裝kangle(目前最新版本 :kangle-3.4.8.tar.gz)
一、下載kangle源碼包
wget http://download.kanglesoft.com/zcore.php?os=src
二、解壓
tar xzf kangle-3.4.8.tar.gz
三、進入kangle目錄
cd kangle-3.4.8
四、配置kangle源代碼
./configure –prefix=/vhs/kangle –enable-disk-cache –enable-ipv6 –enable-ssl –enable-vh-limit
五、編譯安裝
make && make check && make installhtml
六、啓動kangle
/vhs/kangle/bin/kangle
七、設置centos7 kangle 啓動
在/usr/lib/systemd/system/目錄下新建kangle.service,內容以下:
[Unit]
Description=Kangle Web Service
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/vhs/kangle/bin/kangle
ExecStop=/vhs/kangle/bin/kangle -q
[Install]
WantedBy=multi-user.targetjava
八、使用SSH輸入下列命令創建連接
ln -s ‘/usr/lib/systemd/system/kangle.service’ ‘/etc/systemd/system/multi-user.target.wants/kangle.service’
九、啓動kangle
systemctl start kangle.service
(關閉kangle的命令是systemctl stop kangle.service)node
十、設置爲開機自動啓動
systemctl enable kangle.servicemysql
3、mariadb配置
第三步:安裝數據庫mariadb
一、centos7默認安裝mariadb5.5.37
yum install mariadb-server mariadb
二、啓動mariadb服務
systemctl start mariadb.service
三、設置mariadb開機自動運行
systemctl enable mariadb.service
四、設置root密碼
/usr/bin/mysql_secure_installation
而後根據提示一步步操做便可,以下所示:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 安裝後默認沒有root密碼,直接回車
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password: 輸入root的新密碼
Re-enter new password: 新密碼確認
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] 刪除匿名用戶 Y
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] 關閉root遠程登陸 Y
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] 刪除test數據庫 Y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] 肯定以上全部操做 Y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
五、裝完後設置一下連接,mariadb徹底兼容mysql,因此不少命令也是同樣的
ln -s /usr/bin/mysql /vhs/kangle/bin/mysql
ln -s /usr/bin/mysqldump /vhs/kangle/bin/mysqldump
4、安裝php
第四步:安裝php,centos7默認安裝5.4.16
yum install php php-cli php-mysql php-gd php-xml php-pdo php-mbsring
5、安裝ioncube
ioncube是一個保護使用PHP編程語言編寫的軟件不被查看的工具。這些工具使用在編碼以前編譯爲字節碼的技術,從而消除了源代碼,減小了運行時開銷(加密)。還有一個名爲ionCube Loader 的PHP 擴展在運行時處理編碼文件的讀取和執行(解密)。
cd /usr/local
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
tar zxvf ioncube_loaders_lin_x86.tar.gzlinux
64位ionCubec++
cd /usr/local
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar zxvf ioncube_loaders_lin_x86-64.tar.gzweb
一、到官方下載ioncube_loader_lin_5.4.so放到/usr/lib64/php/modules目錄下
二、在/etc/php.d目錄下新建ioncube.ini文件,內容爲
zend_extension=/usr/lib64/php/modules/ioncube_loader_lin_5.4.so
6、安裝pftp
第六步:安裝pureftpd(用戶使用,36版有問題)
一、官方下載pureftpd(目前最新版是1.0.42版)
wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.42.tar.gz
或者在kangle下載(1.0.36版)
wget http://download.kanglesoft.com/easypanel/source/pure-ftpd-1.0.36.tar.gz
二、解壓
tar xzf pure-ftpd-1.0.42.tar.gz
三、進入目錄
cd pure-ftpd-1.0.42
四、配置pureftpd源代碼
./configure –prefix=/vhs/pure-ftpd with –with-extauth –with-throttling –with-peruserlimits
五、編譯安裝
make && make check && make install
六、設置pureftpd啓動服務
(1)在/vhs/pure-ftpd/sbin下新建pureftpd.sh,內容以下:
#!/usr/bin/bash
/vhs/pure-ftpd/sbin/pure-authd –daemonize -s /var/run/ftpd.sock -r /vhs/kangle/bin/pureftp_auth
sleep 1
/vhs/pure-ftpd/sbin/pure-ftpd –daemonize -lextauth:/var/run/ftpd.sock
(2)在/usr/lib/systemd/system/下新建pureftpd.service,內容以下:
[Unit]
Description=Pure-FTPd FTP Server
After=syslog.target
[Service]
Type=forking
ExecStart=/usr/bin/sh /vhs/pure-ftpd/sbin/pureftpd.sh
[Install]
WantedBy=multi-user.target
七、創建軟鏈接
ln -s ‘/usr/lib/systemd/system/pureftpd.service’ ‘/etc/systemd/system/multi-user.target.wants/pureftpd.service’
八、啓動pureftpd
systemctl start pureftpd.service
(關閉pureftpd: systemctl stop pureftpd.service)
7、安裝easypanel
第七步:安裝easypanel
一、下載easypanel(目前最新版是2.6.26)
wget http://download.kangleweb.com/easypanel/easypanel-2.6.26-x86_64-6.tar.gz
二、解壓縮
tar xzf easypanel-2.6.26-x86_64-6.tar.gz
三、關閉kangle服務
/vhs/kangle/bin/kangle -q
四、複製文件
cp -a easypanel-2.6.26-x86_64/* /vhs/kangle/
五、安裝
最後啓動kangle和pureftp
systemctl start kangle.service
systemctl start pureftpd.service
六、裝完後開始設置,不用ep自帶的php52,打開/vhs/kangle/ext/tpl_php52/config.xml找到<cmd name=」nodephp」 行,修改成:
<cmd name=’nodephp’ file=’/usr/bin/php-cgi’ listen=’local’ lock=’0′ type=’mp’ proto=’fastcgi’>
<env PHP_FCGI_MAX_REQUESTS=’0′ PHPRC=’/etc/php.ini’/>
</cmd>
第八步:啓動kangle和pureftp
systemctl start kangle.service
systemctl start pureftpd.service算法