How to Install Memcached & PHP-Memcache on Debian 5.0.x 64bit DirectAdmin installed
#1. Install library libevent cd /tmp #wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz #tar xzvf libevent-1.4.13-stable.tar.gz #cd libev..
apt-get update; apt-get upgrade -y
cd /tmp
wget http://vestacp.com/pub/vst-install.sh
#wget http://vestacp.com/pub/vst-install-debian.sh
#sed -i 's/php5/php7.0/g' vst-install-debian.sh
bash vst-install.sh --nginx yes --phpfpm yes --apache no --vsftpd no --proftpd no --exim yes --dovecot yes --spamassassin no --clamav no --named yes --iptables no --fail2ban no --mysql yes --postgresql no --remi no --quota no --hostname nodexxx.domain.com --email [email protected] --password password123456 --force
#or https://vestacp.com/install#install-configure
#watch -d -t -g ls -lR /usr/local/vesta/data/templates/web/php5-fpm/ && cp -a /usr/local/vesta/data/templates/web/php5-fpm /usr/local/vesta/data/templates/web/php7.0-fpm && cp -a /usr/local/vesta/data/templates/web/nginx/php5-fpm /usr/local/vesta/data/templates/web/nginx/php7.0-fpm
vim /etc/nginx/nginx.conf
gzip on;
gzip_vary on; #add
gzip_comp_level 9;
#php5
vim /etc/php5/fpm/php.ini
#or php7
vim /etc/php/7.0/fpm/php.ini
post_max_size = 200M
upload_max_filesize = 200M
#or
sed -i 's/date.timezone = UTC/date.timezone = "Asia\/Bangkok"/' /etc/php/7.0/fpm/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 200M/' /etc/php/7.0/fpm/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 200M/' /etc/php/7.0/fpm/php.ini
#sed -i 's/short_open_tag = Off/short_open_tag = On/' /etc/php/7.0/fpm/php.ini
in Debian 7/8 if v5.4.x & upgrade to v5.6.x
#php5.6+debian7/8
echo "deb http://packages.dotdeb.org wheezy-php56-zts all" >> /etc/apt/sources.list
echo "deb-src http://packages.dotdeb.org wheezy-php56-zts all" >> /etc/apt/sources.list
#php7+debian8
echo "deb http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
echo "deb-src http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
cd /tmp
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
rm dotdeb.gpg
#wget http://www.dotdeb.org/dotdeb.gpg -O- |apt-key add –
apt-get update;apt-get upgrade -y
apt-get install php5 -y
#for upgrade //forum.vestacp.com/viewtopic.php?f=11&t=14376
x="$(dpkg --list | grep php | awk '/^ii/{ print $2}')"
y="$(sed 's/php5/php7.0/g' <<<$x)"
echo New PHP7 packages name: $y
apt-get -y install $y
apt-get -y install php7.0-xml php7.0-mbstring
install Redis
#php5
apt-get install redis-server php5-redis -y
#or php7
apt-get install redis-server php-redis -y
echo "maxmemory 256mb" >> /etc/redis/redis.conf
echo "maxmemory-policy allkeys-lru" >> /etc/redis/redis.conf
#addition https://forum.vestacp.com/viewtopic.php?f=11&t=14647
#usermod -g www-data redis
#chown -R redis:www-data /var/run/redis
nginx -t && service nginx reload
#nginx -t && /etc/init.d/nginx reload
#nginx -t && nginx -s reload
#php5
service nginx restart
service php5-fpm restart
service redis-server restart
#or php7
service nginx restart
service php7.0-fpm restart
service redis-server restart
more trick
#ubuntu+php7 bug when add domain first*2
#nginx permission tail /var/log/nginx/domains/*.error.log
#> /var/log/nginx/domains/vcp8.psychodev.net.log; > /var/log/nginx/domains/vcp8.psychodev.net.error.log ; >/var/log/nginx/domains/vcp8.psychodev.net.bytes
ls -l /home | grep '^d' | awk '{print "chown", $3 ":www-data /home/" $9 "/web/*/public_html"}'
#copy code showed and paste in command line again.
chown admin:www-data /home/admin/web/*/public_html
#or
cd /home && for i in `ls`; do { chown $i:www-data /home/$i/web/*/public_html;}; done;
#fix phpmyadmin error 500 https://forum.vestacp.com/viewtopic.php?t=14464
vim /etc/apache2/sites-available/000-default.conf
#Anywhere after "DocumentRoot /var/www/html" insert these line:
Alias /phpmyadmin "/usr/share/phpmyadmin/"
<Directory "/usr/share/phpmyadmin/">
Order allow,deny
Allow from all
Require all granted
</Directory>
service apache2 restart
apt-get install -y php-mbstring php7.0-mbstring php-gettext
service apache2 restart
#or
chmod 644 /var/lib/phpmyadmin/blowfish_secret.inc.php
chmod 644 /var/lib/phpmyadmin/config.inc.php
chmod 644 /etc/phpmyadmin/config-db.php
apt-get remove --purge phpmyadmin
apt-get install phpmyadmin
# deny .user.ini for wordfence plugin
vim /home/admin/conf/web/nginx.conf
location ~ ^/\.user\.ini {
deny all;
}
#http auth
vim /home/admin/conf/web/nginx.conf
location /dl {
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file /home/admin/web/domainblabla.com/.htpasswd; #For Basic Auth
}
#cache control font
vim /home/admin/conf/web/nginx.conf
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js|ttf|ttc|otf|eot|woff|woff2)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
#nginx status
vim /home/admin/conf/web/nginx.conf
location /nginx-status {
stub_status on;
access_log off;
allow 1.10.218.143; # Real IP here
# allow 127.0.0.1;
deny all;
}
#wp plugin name: "Redis Object Cache"
vim /home/admin/web/domain.ltd/public_html/wp-config.php
define('WP_CACHE_KEY_SALT', 'domain.ltd');
define('WP_CACHE', true);
#install ubuntu+php7
vim vst-install-ubuntu.sh
# php_fpm=$(ls /etc/init.d/php*-fpm* |cut -f 4 -d /)
php_fpm="php7.0-fpm"
January 8, 2017
Blog | #Command #Debian #MySQL #Nginx #PHP #Ubuntu #VestaCP
#1. Install library libevent cd /tmp #wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz #tar xzvf libevent-1.4.13-stable.tar.gz #cd libev..
find mysqld.log/mysql.log & slowly log file in DirectAdmin(Debian) 1.Login mysql command mysql -u dbuser -p 2.Query mysql variables mysql> show variab..
upgrade Ubuntu apt-get update apt-get upgrade -y apt-get dist-upgrade -y apt-get install update-manager-core do-release-upgrade reboot ..
Ploblem: “PHP Warning: PHP Startup: Unable to load dynamic library ‘./usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so’ - ./usr/..
Monitor service up/down & auto restart //httpd (apache) vim /root/apacherestart.sh #!/bin/bash PGREP=/usr/bin/pgrep CHKSERVICE=httpd $PGREP ${CHKS..
วิธีซ่อมแซม Database ง่ายๆ (Repair Database) ด้วยการเข้า SSH แล้วไปยังโฟลเดอร์ mysql ที่ OS Linux แต่ละอย่างเก็บไว้ Debian myisamchk -r /home/mysql/*/..