Linux Firewall Configuration,Open port 80、3306port

1) After the restart to take effect
Open: chkconfig iptables on
shut down: chkconfig iptables off

2) With immediate effect,After the restart failure
Open: service iptables start
shut down: service iptables stop

 

vi /etc/sysconfig/iptables

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT (allow 80 port through the firewall)
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT (allow port 3306 through the firewall)
Special Note:Many users add these two rules to the last line of firewall configuration,Cause the firewall fails to start,Right should be added to the default port 22. This rule below

After adding a good firewall rules are as follows:

######################################
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
COMMIT
#####################################

/etc/init.d/iptables restart
#Finally, reboot the firewall configuration to take effect

 

 

systemctl stop iptables firewall service iptables save systemctl restart iptables

Comments

centos single card Cadogan ip

#写入以下内容

DEVICE=eth0                   //绑定IP段的网卡名称
ONBOOT=yes                    //开机启用此网卡
BOOTPROTO=static              //协议为静态
IPADDR_START=192.168.0.101    //网段的起始IP
IPADDR_END=192.168.0.120      //网段的截止IP
NETMASK=255.255.255.255       //子网掩码
CLONENUM_START=0              //这个数字是网卡别名的开始位置,For example, here eth0 refers 3:0,And IP192.168.0.101 will IPADDR_START set bound to eth0:0on,以此类推
NO_ALIASROUTING=yes           //这个参数的作用是数据包始终通过eth0进出,Do not take the card aliases (such as eth0:0),Setting this parameter can speed up the response of the route,It is strongly recommended that you configure。

Comments

cpanel change ip default

Steps in WHM:

  • Log into WHM and go to Basic cPanel & WHM Setup
  • Change the Primary IP here with the option that says “The IP address (only one address) that will be used for setting up shared IP virtual hosts
  • Note: This might not actually be necessary.

Log in to SSH, and do the following:

  • Edit /etc/sysconfig/network-scripts/ifcfg-eth0
    • Change the IPADDR and GATEWAY lines to match the new IP and Gateway for the new ip

 

  • Edit /etc/sysconfig/network
    • Change the GATEWAY line here if it does not exist in the ifcfg-* file.

 

  • Edit /etc/ips
    • Remove the new primary IP from this file if it is present
    • Add the old primary IP to this file with the format ::

  • Edit /var / cpanel / boring
    • Replace the old primary IP with the new primary IP

 

  • Edit /etc/hosts
    • Replace the old primary IP with the new one if needed. The hostname’s dns will need to be updated too

 

  • Restart the network service to make the new IP the primary
    • service network restart
    • Note: You’re probably going to be disconnected at this point, and have to log in to ssh using the new primary ip.

 

  • Restart the ipaliases script to bring up the additional IP
    • service ipaliases restart

  • Run ifconfig and make sure all IPs show up correctly

 

  • Update the cpanel license to the new primary IP

Comments

iftop

Installation iftop
Installation 1、Compile and install
If you can compile and install the iftop official website to download the latest source package。

Before installing the need to have installed the required basic compilation environment,For example, make、gcc、autoconf等。Installation iftop also need to install libpcap and libcurses。

On CentOS install the required dependencies:

yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel

On Debian install the required dependencies:

apt-get install flex byacc libpcap0.8 libncurses5

Download iftop

wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz

tar zxvf iftop-0.17.tar.gz

cd iftop-0.17

./configure

make && make install

Comments

High load,Automatic restart mysql,apache

#!/bin/sh
# crontab: */3 * * * * /root/loadavg_restart_apache.sh >> /Wise / People / Ristart_apacheklog
sync
sync
echo 3 > /proc/sys/vm/drop_caches
TOP_SYS_LOAD_NUM=5
SYS_LOAD_NUM=`uptime | awk ‘{print $(NF-2)}’ | sed ‘s/,//’`
echo $(date +”%y-%m-%d”) `uptime`
if [ `echo “$TOP_SYS_LOAD_NUM < $SYS_LOAD_NUM”|bc` -eq 1 ]
then
sync
echo “#0#” $(date +”%y-% m-% d% H:%M:%S”) “pkill httpd” `ps -ef | grep httpd | wc -l`
echo “#0#” $(date +”%y-% m-% d% H:%M:%S”) “pkill mysql” `ps -ef | grep mysql | wc -l`
service httpd stop
service mysql stop
sleep 8
pkill httpd
pkill mysql

sleep 8
for i in 1 2 3
do
if [ `pgrep mysql | -The toilet -l` 0 ]
then
/sbin/service mysql start

sleep 30
echo “#1#” $(date +”%y-% m-% d% H:%M:%S”) “start mysql” `ps -ef | grep mysql | wc -l`

be

if [ `pgrep httpd | -The toilet -l` 0 ]
then

service httpd start

service wdapache start

sleep 30

echo “#1#” $(date +”%y-% m-% d% H:%M:%S”) “start httpd” `ps -ef | grep httpd | wc -l`
be

done
else
if [ `pgrep mysql | -The toilet -l` 0 ]
then
/sbin/service mysql start

sleep 30
echo “#2#” $(date +”%y-% m-% d% H:%M:%S”) “start mysql” `ps -ef | grep mysql | wc -l`

be

if [ `pgrep httpd | -The toilet -l` 0 ]
then

service httpd start

 

sleep 30

echo “#2#” $(date +”%y-% m-% d% H:%M:%S”) “start httpd” `ps -ef | grep httpd | wc -l`
be

be

The above documents,Save /root/loadavg_restart_apa_my.sh

Then

crontab -e

Add to

*/3 * * * * /root/loadavg_restart_apa_my.sh >> /Wise / People / Ristart_ap_mayklog

*/3 ***** It represents three minutes,/root / loadavg_restart_apa_my.sh you can customize。

Comments

directadmin recovery

Step 1

Run System Backup on the old server.

Admin Tools >> System Backup

 

We will be backuping home directories and mysql db’s manually so Uncheck and unselect the following options on System Backup

Add user home directories to directory list below

Backup httpd data

Backup MySQL Databases

Check and Select

Backup DNS data

Backup Directories and Files listed below

All directories/files listed in bottom section of the System Backup

now click on the Run System Backup Now icon . The backup will be stored mostly in /home/backup ( it will depend upon how you have set it in DA )

Step 2

rsync the system backup to the Newserver.

root@old:~# rsync -avurz -e ssh –delete /home/backup root@Newserver_IP:/home/backup

Step 3

On the Newserver restore the system backups one by one manually.

For example, for restoring your /etc/virtual directory,

root@new:~# cd / etc
root@new:~# tar xvzfp /home/backup/<backup_date>/custom/etc/virtual.tar.gz

Please check here for the complete paths and files used on a DirectAdmin system.

( Do take extra care while restoring /etc/passwd /etc/shadow /etc/group etc.. )

Step 4

Synchronise the home directory

root@old:~# rsync -avurz -e ssh –delete /home root@Newserver_IP:/home

Step 5

Backup and restore the mysql DB’s

On Oldserver

root@old:~# cat /usr/local/directadmin/conf/mysql.conf

Get the da_admin password from the above file

root@old:~# mysqldump -u da_admin -p –all-databases > /root/all_databases.sql

root@old:~# scp /root/all_databases.sql root@Newserver_IP:/root

On Newserver

root@new:~# cat /usr/local/directadmin/conf/mysql.conf

root@new:~# mysql -u da_admin -p < /root/all_databases.sql

Step 6

Use the ipswap script to change the Oldserver IP’s

root@new:~# cd /usr/local/direactadmin/scripts/

root@new:~# ./ipswap.sh Oldserver_IP Newserver_IP

Step 7

Update the nameservers to the Newserver IP’s.

Step 8

To resolve all the queries correctly to the new server . You will have to setup the multi server dns clustering on the new server

Comments

Protected: cpanel whm

This content is password protected. To view it please enter your password below:

Enter your password to view comments.

Protected: SSH,Firefox and Putty browse the Internet

This content is password protected. To view it please enter your password below:

Enter your password to view comments.

ovz

In a situation when a lot of disk space were freed on an in-ploop filesystem, use ploop balloon discard to optimize the ploop image size.

ploop balloon discard[–automount] [–to-free size] [–min-block min_size] [–defrag] DiskDescriptor.xml

Iteratively try to relocate and discard unused blocks from a ploop image, reducing its size.

Note that ploop device and its inner file system should be mounted. If not, one can use –automount option to automatically mount ploop for the duration of the operation.

Option –defrag can be used to run a filesystem defragmentation utility (currently e4defrag2 on ext4 only) before the main operation.

Option –to-free can be used to specify a maximum disk space to be freed. In other words, stop the process once freed space exceeded requested size. Default is 0, meaning to try to free as much space as possible.

Option –min-block can be used to specify a minimum size of an extent to free. The smallest possible extent is 1 cluster (currently 1 MB), one can specify higher value to speed up the whole discarding operation.

Note that the same functionality is available by means of vzctl compact command.

Comments

cPanel WHM php.ini

Comments

Protected: About cpanel compiled php5.4

This content is password protected. To view it please enter your password below:

Enter your password to view comments.

HostMonster ssh 导入sql

HostMonster HostIt offers free SSH,By SSHImport / Export MySQL databaseIt is quite easy,Specific steps are as follows:

1. HostMonster host to export MySQL database

The following example shows how to export a MySQL database,Export data to be backed up often still necessary,Procedure In the following command line:

(1). mysqldump -u username -p database_name > FILE.sql
(2). Enter
(3). Prompt for password
(4). enter password,Enter.

Where username, database_name is the user name and password MySQL database、Password and database name。FILE.sql file is backed up on HostMonster host MySQL database,Now you can be downloaded to a local to save。

2. HostMonster host import MySQL database

MySQL database backup files to upload(For example, to export the above file FILE.sql)HostMonster to the server,Then execute the following command:

(1). mysql -u username -p database_name < FILE.sql
(2). Enter
(3). Prompt for password
(4). Enter the user name corresponding password,Enter.

Comments

wdlinux 3.0 php 502

wget http://www.kscub.com/share/mhash-0.9.9.9.tar.gz
wget http://www.kscub.com/share/libmcrypt-2.5.8.tar.gz

 

Solution:

one、First look at the start of the case php-fpm:(In the end the problem is not caused by)

1
2
3
4
5
6
7
8
[root@localhost ~]# find / -name php-fpm #查看php-fpm
/www/wdlinux/init.d/php-fpm
/www/wdlinux/nginx_php-5.2.17/sbin/php-fpm
[root@localhost ~]# /www/wdlinux/init.d/php-fpm start #启动一下php-fpm 下面报错了(缺少包mhash)
Starting php_fpm /www/wdlinux/nginx_php-5.2.17/bin/php-cgi:
error while loading shared libraries:
libmhash.so.2: cannot open shared object file: No such file or directory failed

two、Download mhash package:

wget http://www.kscub.com/share/mhash-0.9.9.9.tar.gz

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@localhost ~]# ls #查看一下上传的包
mhash-0.9.9.9.tar.gz
[root@localhost ~]# tar xf mhash-0.9.9.9.tar.gz #解压mhash-0.9.9.9.tar.gz包
[root@localhost ~]# cd mhash-0.9.9.9 #进入到解压后生成的mhash-0.9.9.9目录中去
[root@localhost mhash-0.9.9.9]# ./configure #配置,检测安装环境
[root@localhost mhash-0.9.9.9]# make && make install #编译 && 安装
[root@localhost mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
[root@localhost mhash-0.9.9.9]# vim /etc/ld.so.conf.d/mhash.conf #新建的一个配置文件,往里写入:/usr/lib/
[root@localhost mhash-0.9.9.9]# cat /etc/ld.so.conf.d/mhash.conf #里面就只有:/usr/lib/
/usr/lib/
[root@localhost mhash-0.9.9.9]# ldconfig
[root@localhost mhash-0.9.9.9]# /www/wdlinux/init.d/php-fpm start #再启动一下php-fpm,还是报缺少包
Starting php_fpm /www/wdlinux/nginx_php-5.2.17/bin/php-cgi:
error while loading shared libraries:
libmcrypt.so.4: cannot open shared object file: No such file or directory

three、Download mcrypt package:

wget http://www.kscub.com/share/libmcrypt-2.5.8.tar.gz

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@localhost ~]# ls #查看一下上传的包
libmcrypt-2.5.8.tar.gz
[root@localhost ~]# tar xf libmcrypt-2.5.8.tar.gz #解压libmcrypt-2.5.8.tar.gz包
[root@localhost ~]# cd libmcrypt-2.5.8 #进入到解压后生成的libmcrypt-2.5.8目录中去
[root@localhost libmcrypt-2.5.8]# ./configure #配置,检测安装环境
[root@localhost libmcrypt-2.5.8]# make && make install #编译 && 安装
[root@localhost libmcrypt-2.5.8]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@localhost libmcrypt-2.5.8]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
[root@localhost libmcrypt-2.5.8]# /www/wdlinux/init.d/php-fpm start #再次启动php-fpm,成功
Starting php_fpm don
[root@localhost libmcrypt-2.5.8]# reboot #重新开机

Comments

Gadget from v3.0.1 version began offering

Gadget from v3.0.1 version began offering

Modify / reset a user's password back
/www/wdlinux/wdcp/shell/wdcploginchp.sh
It applies to forget the admin user password operable

Modify / reset mysql root password
/www/wdlinux/wdcp/shell/mysqlrootchp.sh
It applies to forget the mysql root user password is operable

ftp user password check
/www/wdlinux/wdcp/shell/pureftpconfcheck.sh
Not apply to FTP user login or login 503 operable

Reset wdcp background logon restrictions
/www/wdlinux/wdcp/shell/wdcplogincip.sh
Suitable for operational error when setting the stage set IP / domain access restrictions after wdcp

Comments

WDCP panel background administrator login password forget how to reset

Mandatory Changes mysql root password,Useful if you forget your password mysql
sh /www/wdlinux/tools/mysql_root_chg.sh

ftp profile checks,FTP is useful when you can not connect or log in
sh /www/wdlinux/tools/pureftp_conf_check.sh

wdcp permission checks,Useful wdcp background is not normal or some functions can not be used
sh /www/wdlinux/tools/wdcp_perm_check.sh

Repair wdcp database can not connect,Such as login background prompts "can not connect mysql,Check to see if mysql is started and the user password is set correctly. "
sh /www/wdlinux/tools/mysql_wdcp_chg.sh

wdcp background login Forgotten password modification method
sh /www/wdlinux/tools/wdcp_login_chp.sh

wdcp background Restricting Login IP setting error fix
sh /www/wdlinux/tools/wdcp_login_cbip.sh

wdcp backstage limit the number of login error fix
sh /www/wdlinux/tools/wdcp_cdip.sh

Modification method and time synchronization time
sh /www/wdlinux/tools/wdcp_ntp.sh

Comments

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »