[運維-安全]CentOS7.0環境下安裝kangle和easypanel


一、康樂簡介

主要特點
1、免費開源
kangle技術團隊希望國人擁有一款真正好用、易用、實用的國產web服務器。
2、跨平台
可在linux、windows、freebsd、openbsd、netbsd、solaris等平台上運行。
3、可輕松查看到被攻擊的url
這是kangle web服務器獨有的,其它web服務器很難查找到。
4、性能高
工作模型多樣化。Windows上采用iocp、Linux上采用epoll、Bsd上采用kqueue。
5、功能強大、靈活
kangle的訪問控制理念來自linux的iptables防火牆,kangle擁有功能最小化的匹配模塊和標記模塊,通過組合,反轉等可以實現用戶最復雜的需求;
談kangle的訪問控制:點擊查看
6、是一款做idc的專業web服務器
.實現虛擬主機獨立身份,獨立進程。
.隔離攻擊(實現某個虛擬主機受到外部攻擊,不影響到服務器上其它虛擬主機)。
.智能防cc攻擊(CC是http協議的攻擊,不是tcp/ip,kangle是底層的web服務器,更懂http)。
.做全能空間(php虛擬主機、java虛擬主機等)

主要特性

  • 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功能

二、安裝部署

第一步:系統支持包安裝
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)
1、下載kangle源碼包
wget http://download.kanglesoft.com/zcore.php?os=src
2、解壓
tar xzf kangle-3.4.8.tar.gz
3、進入kangle目錄
cd kangle-3.4.8
4、配置kangle源代碼
./configure –prefix=/vhs/kangle –enable-disk-cache –enable-ipv6 –enable-ssl –enable-vh-limit
5、編譯安裝
make && make check && make install

6、啟動kangle
/vhs/kangle/bin/kangle
7、設置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.target

8、使用SSH輸入下列命令建立鏈接
ln -s ‘/usr/lib/systemd/system/kangle.service’ ‘/etc/systemd/system/multi-user.target.wants/kangle.service’
9、啟動kangle
systemctl start kangle.service
(關閉kangle的命令是systemctl stop kangle.service)

10、設置為開機自動啟動
systemctl enable kangle.service

三、mariadb配置

第三步:安裝數據庫mariadb
1、centos7默認安裝mariadb5.5.37
yum install mariadb-server mariadb
2、啟動mariadb服務
systemctl start mariadb.service
3、設置mariadb開機自動運行
systemctl enable mariadb.service
4、設置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!
5、裝完后設置一下鏈接,mariadb完全兼容mysql,所以很多命令也是一樣的
ln -s /usr/bin/mysql /vhs/kangle/bin/mysql
ln -s /usr/bin/mysqldump /vhs/kangle/bin/mysqldump

四、安裝php

第四步:安裝php,centos7默認安裝5.4.16
yum install php php-cli php-mysql php-gd php-xml php-pdo php-mbsring

五、安裝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.gz

64位ionCube

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.gz


1、到官方下載ioncube_loader_lin_5.4.so放到/usr/lib64/php/modules目錄下
2、在/etc/php.d目錄下新建ioncube.ini文件,內容為
zend_extension=/usr/lib64/php/modules/ioncube_loader_lin_5.4.so

六、安裝pftp

第六步:安裝pureftpd(用戶使用,36版有問題)
1、官方下載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
2、解壓
tar xzf pure-ftpd-1.0.42.tar.gz
3、進入目錄
cd pure-ftpd-1.0.42
4、配置pureftpd源代碼
./configure –prefix=/vhs/pure-ftpd with –with-extauth –with-throttling –with-peruserlimits
5、編譯安裝
make && make check && make install
6、設置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
7、建立軟連接
ln -s ‘/usr/lib/systemd/system/pureftpd.service’ ‘/etc/systemd/system/multi-user.target.wants/pureftpd.service’
8、啟動pureftpd
systemctl start pureftpd.service
(關閉pureftpd:  systemctl stop pureftpd.service)

七、安裝easypanel

第七步:安裝easypanel
1、下載easypanel(目前最新版是2.6.26)
wget http://download.kangleweb.com/easypanel/easypanel-2.6.26-x86_64-6.tar.gz
2、解壓縮
tar xzf easypanel-2.6.26-x86_64-6.tar.gz
3、關閉kangle服務
/vhs/kangle/bin/kangle -q
4、復制文件
cp -a easypanel-2.6.26-x86_64/* /vhs/kangle/
5、安裝
最后啟動kangle和pureftp
systemctl start kangle.service
systemctl start pureftpd.service
6、裝完后開始設置,不用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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM