If you are using eZ Publish, it can be database issue. Like database server down.
Category Archives: Hosting
lazy load images
Lazy Load Plugin for jQuery
This is really useful stuff for havy loading websites with a lot of images: http://www.appelsiini.net/projects/lazyload
cpanel apache graceful restart every two hours
cp -rp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf_backup
vi /var/cpanel/cpanel.config
enable_piped_logs=1
/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
directadmin change nginx
./build set webserver nginx
./build set php1_mode php-fpm
./build update
./build all d
./build rewrite_confs
linux comment line which start with some string
sed s/^character-set-server=utf8/#character-set-server=utf8/’ -i /etc/my.cnf
If you want comment on this this line “character-set-server=utf8” on all your servers, you should use something like ansible:
ansible mysql_servers -m shell -a “sed -e ‘s/^character-set-server=utf8/#character-set-server=utf8/’ -i /etc/my.cnf”
linux check if website is hosted on destination server
If you know server IP you can check if website is there, it useful when website is hidden under cloudflare:
curl -v -H “Host: linux4you.tk” 5.199.164.77 | less
cpanel set exiim IP per account
awk ‘{ print $2″: “$1 }’ /tmp/domianips | sed ‘s/:$//’ >> /etc/mailips
prestashop change admin password
UPDATE `ps_employee` SET `passwd` = MD5('(COOKIE_KEY)mypassword') WHERE `ps_employee`.`id_employee` = 1;
(OOKIE_KEY) you can get from settings.inc.php file in your prestashop website directory
apache add virtualhost from cli
This works for Debian and Ubuntu apache create/delete virtual host:
#!/bin/bash
### Set Language
TEXTDOMAIN=virtualhost
### Set default parameters
action=$1
domain=$2
rootdir=$3
owner=$(who am i | awk '{print $1}')
email='webmaster@localhost'
sitesEnable='/etc/apache2/sites-enabled/'
sitesAvailable='/etc/apache2/sites-available/'
userDir='/var/www/'
sitesAvailabledomain=$sitesAvailable$domain.conf
### don't modify from here unless you know what you are doing ####
if [ "$(whoami)" != 'root' ]; then
echo $"You have no permission to run $0 as non-root user. Use sudo"
exit 1;
fi
if [ "$action" != 'create' ] && [ "$action" != 'delete' ]
then
echo $"You need to prompt for action (create or delete) -- Lower-case only"
exit 1;
fi
while [ "$domain" == "" ]
do
echo -e $"Please provide domain. e.g.dev,staging"
read domain
done
if [ "$rootdir" == "" ]; then
rootdir=${domain//./}
fi
if [ "$action" == 'create' ]
then
### check if domain already exists
if [ -e $sitesAvailabledomain ]; then
echo -e $"This domain already exists.\nPlease Try Another one"
exit;
fi
### check if directory exists or not
if ! [ -d $userDir$rootdir ]; then
### create the directory
mkdir $userDir$rootdir
### give permission to root dir
chmod 755 $userDir$rootdir
### write test file in the new domain dir
if ! echo "" > $userDir$rootdir/phpinfo.php
then
echo $"ERROR: Not able to write in file $userDir/$rootdir/phpinfo.php. Please check permissions"
exit;
else
echo $"Added content to $userDir$rootdir/phpinfo.php"
fi
fi
### create virtual host rules file
if ! echo "
ServerAdmin $email
ServerName $domain
ServerAlias $domain
DocumentRoot $userDir$rootdir
AllowOverride All
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
ErrorLog /var/log/apache2/$domain-error.log
LogLevel error
CustomLog /var/log/apache2/$domain-access.log combined
then
echo -e $"There is an ERROR creating $domain file"
exit;
else
echo -e $"\nNew Virtual Host Created\n"
fi
### Add domain in /etc/hosts
if ! echo "127.0.0.1 $domain" >> /etc/hosts
then
echo $"ERROR: Not able to write in /etc/hosts"
exit;
else
echo -e $"Host added to /etc/hosts file \n"
fi
if [ "$owner" == "" ]; then
chown -R $(whoami):$(whoami) $userDir$rootdir
else
chown -R $owner:$owner $userDir$rootdir
fi
### enable website
a2ensite $domain
### restart Apache
/etc/init.d/apache2 reload
### show the finished message
echo -e $"Complete! \nYou now have a new Virtual Host \nYour new host is: http://$domain \nAnd its located at $userDir$rootdir"
exit;
else
### check whether domain already exists
if ! [ -e $sitesAvailabledomain ]; then
echo -e $"This domain does not exist.\nPlease try another one"
exit;
else
### Delete domain in /etc/hosts
newhost=${domain//./\\.}
sed -i "/$newhost/d" /etc/hosts
### disable website
a2dissite $domain
### restart Apache
/etc/init.d/apache2 reload
### Delete virtual host rules files
rm $sitesAvailabledomain
fi
### check if directory exists or not
if [ -d $userDir$rootdir ]; then
echo -e $"Delete host root directory ? (y/n)"
read deldir
if [ "$deldir" == 'y' -o "$deldir" == 'Y' ]; then
### Delete the directory
rm -rf $userDir$rootdir
echo -e $"Directory deleted"
else
echo -e $"Host directory conserved"
fi
else
echo -e $"Host directory not found. Ignored"
fi
### show the finished message
echo -e $"Complete!\nYou just removed Virtual Host $domain"
exit 0;
fi
mysql 5.5 enable slow query log
slow-query-log = 1
slow-query-log-file = /var/log/mysql/mysql-slow.log
long_query_time = 1
log-queries-not-using-indexes
directadmin /usr/include/openssl/conf.h:132:7: note: expected ‘struct lhash_st_CONF_VALUE *’ but argument is of type ‘int *
If you are running Debian and face this error with directadmin php compilation, please try:
./build set php5_cgi yes
./build set php5_cli no
./build all d
./build rewrite_confs
centos install hiphop
yum install hiphop-php
start mysql manually
cd ‘/usr’ ; /usr/bin/mysqld_safe –datadir=’/var/lib/mysql’ &
[ERROR] mysqld: Can’t find file: ‘./mysql/plugin.frm’ (errno: 13)
chown -R mysql.mysql /var/lib/mysql/
remove duplicated DNS zones from cPanel cluster servers
#!/bin/bash
# Find and remove duplicated DNS zones from cPanel cluster servers
cp -r /var/named /var/named_$(date +%F)
cp /etc/named.conf /etc/named.conf_$(date +%F)
> /tmp/all_zones
> /tmp/good
> /tmp/bad
find /var/named -maxdepth 1 -name '*.db' -exec basename {} .db \; > /tmp/all_zones
for z in $(cat /tmp/zonos.txt); do
grep -qE "DNS[0-9]*=$z" /var/cpanel/users/* && echo $z >> /tmp/good
done
grep -vwf /tmp/good /tmp/all_zones > /tmp/bad
wc -l /tmp/good /tmp/bad
wc -l /tmp/all_zones
for z in $(cat /tmp/bad); do
rm -f /var/named/$z.db
done
rm -f /var/named/cache/*
mv -f /etc/named.conf /tmp/
/scripts/rebuilddnsconfig
service named restart
sleep 5
service named status