Posted by: Master Will | January 9, 2019

Verify if named records still good

To check if DNS (named) service contain bad records, then run below

named-checkconf -z /etc/named.conf

Advertisements

If php 5.6

systemctl restart php-fpm56.service

If php 7.2
systemctl restart php-fpm72.service
Posted by: Master Will | October 4, 2018

Openvz failed to mount image error in e2fsck

If you try to start VPS and got error messages like below then

vzctl start 192
Dump file /vz/dump/Dump.192 exists, trying to restore from it
Restoring container ...
Opening delta /vz/private/192/root.hdd/root.hdd
Data cluster 1112 beyond EOF, vsec=47137...
FATAL
Error in ploop_check (check.c:547): Fatal errors were found, image /vz/private/192/root.hdd/root.hdd is not repaired
Error in check_deltas (check.c:631): /vz/private/192/root.hdd/root.hdd : irrecoverable errors
Failed to mount image: Error in check_deltas (check.c:631): /vz/private/192/root.hdd/root.hdd : irrecoverable errors [11]
Starting container...
Opening delta /vz/private/192/root.hdd/root.hdd
Data cluster 1112 beyond EOF, vsec=47137...
FATAL
Error in ploop_check (check.c:547): Fatal errors were found, image /vz/private/192/root.hdd/root.hdd is not repaired
Error in check_deltas (check.c:631): /vz/private/192/root.hdd/root.hdd : irrecoverable errors
Failed to mount image: Error in check_deltas (check.c:631): /vz/private/192/root.hdd/root.hdd : irrecoverable errors [11]

 

Try these command to fix it.

# ploop check -F /vz/private/192/root.hdd/root.hdd
# ploop mount /vz/private/192/root.hdd/DiskDescriptor.xml
# fdisk -l /dev/ploop46026
# e2fsck /dev/ploop46026p1
# vzctl start 207

 

Source: https://serverfault.com/questions/666443/openvz-containers-will-not-start-after-a-reboot

Posted by: Master Will | August 15, 2018

Network Unavailable with CentOS 7 (SolusVM)

There is a bug in SolusVM that the network settings for CentOS 7 and Fedora 20 do not get provisioned properly when you initially order your VPS. This is due to the change in the way these operating systems use their network config files. Even though there is nothing we can do to fix this automated error, fortunately, you can fix the problem yourself with ease!

First, login to your virtual machine as root using VNC through your SolusVM control panel (since networking is not working, this is the only way).

Next, change your working directory to /etc/sysconfig/network-scripts/, you may do this by running the following command:

cd /etc/sysconfig/network-scripts

Next, you will need to rename your ifcfg-eth0 file to the new format used by CentOS 7 or Fedora 20 to the new one, ifcfg-ens3. That command for this change is as follows:

mv ifcfg-eth0 ifcfg-ens3

Next, you will need to edit the file and replace any occurrence of eth0 with ens3. You may do this with the following command:

sed -i — ‘s/ifcfg-eth0/ifcfg-ens3/g’ ifcfg-ens3

Alternatively: You can edit the file using vim and replace the ifcfg-eth0 occurrence by hand.

We also need to add the DNS servers. Do to this, edit the file /etc/sysconfig/network-scripts/ifcfg-ens3 and enter the following:

DNS1=8.8.8.8
DNS2=8.8.4.4

You also need to edit your resolv.conf file located at /etc/resolv.conf and add the following:

nameserver 8.8.8.8
nameserver 8.8.4.4

These addresses are the Google DNS resolvers so they are extremely fast no matter where you are in the world due to anycasting.

Next, restart networking with:

service network restart

You should now have Internet access! If you have any questions or problems regarding this fix, please feel free to contact the support department as the difficulty of this change may be difficult for beginners. We hope SolusVM has a fix for this soon!

 

Credit: https://www.meanservers.com/billing/knowledgebase/19/Network-Unavailable-with-CentOS-7-or-Fedora-20.html

Posted by: Master Will | January 23, 2018

How to install missing ifconfig command on CentOS 7

yum install net-tools

Posted by: Master Will | December 8, 2017

Force HTTPS On All Pages Of Your Website and WordPress Site

This is the thing that got me when I was making the full transition to HTTPS for my blog. After changing the site name, all my CSS and JavaScript assets were still coming in with the HTTP URL path rather than HTTPS. This caused my site to appear broken in pretty much every browser.

These site asset files can easily be corrected by fixing the rewrite rules in your .htaccess file found at the root of your WordPress application.

# BEGIN WordPress
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{SERVER_PORT} !^443$    <---- Add this line
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]   <---- Add this line
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Notice the highlighted lines in the above code. We’re saying that if the current port isn’t 443, then rewrite the URL to use HTTPS with a 301 redirect. The rest of the above code should already exist in your WordPress .htaccess file. Usually it will be found at the bottom of the file.

 

—– For non-Wordpress site ——

If you want to force a given website or path to use https, redirected from http, you can create an .htaccess file in the DocumentRoot for that domain or hostname, and add the following code:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

which will redirect any non-https connections to https using the same request and GET variables.

If your site is running through CloudFlare, your https requests to it may actually hit your server in plaintext (http), which is confusing.
For that case, you might need something like this for an http to https redirect:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

where the only usable header is X-Forwarded-Proto, because the %{HTTPS} variable is “off” for requests from the CloudFlare network.


If you’re running nginx, go to:

Admin Level -> Custom Httpd Config -> domain.com

and in token |CUSTOM4|, add:

|*if SSL_TEMPLATE=”0″|
return 301 https://$host$request_uri;
|*endif|

 

 

 

 

Posted by: Master Will | November 23, 2017

Forcing FTP SolusVM backups to run on a SolusVM slave

TP SolusVM backups can get stuck on a SolusVM slave. The way SolusVM backups run is it creates an image of the server whilst it’s still running then places that image into a dump file where it stays whilst it is uploaded to your backup server. If the upload is interrupted then the image will stay in the dump file and take up space. You should remove this file and follow the below to restart the SolusVM backups.

First, let’s remove the file that the server uses to run backups

rm -rf /usr/local/solusvm/tmp/ftpbackup.pid

Then you need to restart the FTP service again by issuing;

php /usr/local/solusvm/includes/autoftpbackup.php
or
/usr/bin/php /usr/local/solusvm/includes/autoftpbackup.php --debug=1
If you see errors you can run this command with debugging to find out what is causing them;
php /usr/local/solusvm/includes/autoftpbackup.php --mode=all --debug=1
Posted by: Master Will | October 21, 2017

IMAP on DirectAdmin

If you need imap compiled into php, run these pre-install commands:
CentOS

yum -y install pam-devel

Debian

apt-get install libc-client-dev

Once pre-install is done for your OS, run the following:

cd /root
wget files.directadmin.com/services/all/imap_php.sh
chmod 755 imap_php.sh
./imap_php.sh

supports both CustomBuild 1.x and 2.x.
For CB2, it will automatically detect the configure.phpX path.

Posted by: Master Will | October 4, 2017

Speed Test CLI on Linux

#### Install software
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli

#### Run speed test
./speedtest-cli –server 2953 –share

 

Credit: https://www.cyberciti.biz/faq/install-speedtest-cli-on-centos-redhat-fedoa-scientific-to-measure-internetspeed/

Posted by: Master Will | October 2, 2017

Using Curl to upload file instead of FTP

curl -T /vz/dump/vzdump-001.tgz ftp://yourhostname.com/backups/ –user root:yourrootpass

Older Posts »

Categories