• We have a 5 STAR service and only happy clients ! 5 Star Rating
  • sales@plothost.com

Deny ALL connections with CSF

In this article, we will show how you can temporarily block server access with the use of CSF. CSF (ConfigServer Security & Firewall) is a powerful firewall for Linux systems.

First of all, you must make sure to whitelist your own IP. Use:

csf -a yourIP

root@www [/]# csf -a 192.168.11.11
Adding 192.168.11.11 to csf.allow and iptables ACCEPT...
root@www [/]#

To deny all inbound connections to all server services use:

csf -td 0.0.0.0/0 30 -d in "block all inbound connections for 30 seconds"

To deny all inbound connections to port 80 (Apache server), use:

csf -td 0.0.0.0/0 30 -p 80 -d in "block all inbound connections to port 80 for 30 seconds"

root@www [/]# csf -td 0.0.0.0/0 30 -p 80 -d in "block all inbound connections to port 80 for 30 seconds"
csf: 0.0.0.0/0 blocked on port 80 for 30 seconds inbound

To check the status of the previous temporary blocked IP(s), use:

csf -t

root@www [/]# csf -t
DENY  0.0.0.0/0                                 80    in    24s              block all inbound connections for 30 seconds

If you want to remove the IP(s) ahead of time:

csf -tr 0.0.0.0/0

Resources:
https://configserver.com/cp/csf.html

Share this post:

WP-CLI is included on all our web hosting plans

We are glad to announce that the WP-CLI (the command-line interface for WordPress) system is included on all our web hosting plans. Regardless of your web hosting plan, you have access now to the wp-cli commands.

wp cli logo

If you have any questions/comments about WP-CLI, please submit a ticket and we’ll be happy to help you. All our support technicians are provident in working with WP-CLI commands & scripts.

Check out our offers of wp-cli shared hosting and wp-cli reseller hosting plans.

Resources:
https://www.plothost.com/kb/tag/wp-cli/

Share this post:

Block users access to PHP directives

cPanel allows users to modify PHP directives on a per-directory basis. For more information on this feature check the link from the bottom of this article. Mainly a cPanel user will have to create a .user.ini file in the home directory (or any other directory) and he/she will be able to set new values for PHP directives. An example:

max_execution_time=100
memory_limit=128
etc.

.user.ini files

To limit this permission, as an admin, you will need to edit the main PHP configuration file on the server:

  1.  Log into WHM as root
  2. Navigate to Software >> MultiPHP INI Editor >> Editor Mode tab
  3. Choose the PHP version for which you want to disable .user.ini file permission.
  4. Search for “.user.ini” text. You will see the “php.ini Options” section of the configuration file
  5. In order to disable the .user.ini permission, you should comment out the line “user_ini.filename =” The “php.ini Options” section should look like:
    ;;;;;;;;;;;;;;;;;;;;
    ; php.ini Options ;
    ;;;;;;;;;;;;;;;;;;;;
    ; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"
    ;user_ini.filename = ".user.ini" 
    
    ;To disable this feature set this option to empty value
    user_ini.filename =
    
    ; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes)
    ;user_ini.cache_ttl = 300
  6. Click the Save button
If you are using multiple PHP versions you should do the same changes to all PHP configuration files.

Now your cPanel users will not be able to use .user.ini files to modify PHP directives.

Resources:
https://php.net/manual/en/configuration.file.per-user.php
https://documentation.cpanel.net/display/CKB/How+to+Customize+PHP+Directives

Share this post:

Most used wp-cli commands

Probably the most used wp-cli commands are the core, plugin, theme. We will discuss a little each one of them. Before running any wp-cli commands be sure to switch to the right directory:
cd /home/wp_directory

1. wp core – it installs, updates and manages a WordPress installation.
– to download the installation package
wp core download --locale=en_US

– to create the wp-config.php file needed for the installation process
wp config create --dbname=database_name --dbuser=wp_username --dbpass=wp_password

– to install WordPress
wp core install --url=domain.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=name@domain.com

– to check if an update is available:
wp core check-update

-to update to the latest version:
wp core update

2. wp plugin – manages plugins
– to activate a plugin
wp plugin activate plugin-name

– to deactivate a plugin
wp plugin deactivate plugin-name

– to delete a plugin
wp plugin delete plugin-name

– to install and activate a plugin
wp plugin install plugin-name --activate

– to list all plugins
wp plugin list

– to update all plugins
wp plugin update --all

3. wp theme – manages themes
– to install the latest version of a theme and activate it
wp theme install twentynineteen --activate

– to activate a theme already installed
wp theme activate twentynineteen

– to get a list of the installed themes
wp theme list

– to update all the themes installed
wp theme update --all

Related articles:
How to install wp-cli on your server

References:
WP-CLI Commands

Share this post:

How to install wp-cli on your server

WP-CLI is a command-line interface for WordPress.  Through it, you can manage your installations from the command line.

Official requirements you should check prior to installing WP-CLI:

– UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment
– PHP 5.4 or later
– WordPress 3.7 or later. Versions older than the latest WordPress release may have degraded functionality

The first thing we must do is to download the wp-cli phar file. As root, use the command:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

root@web [/]# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5294k 100 5294k 0 0 8635k 0 --:--:-- --:--:-- --:--:-- 8637k
root@web [/]#

Now, let’s check the phar file is in good condition and to get some info about the wp-cli. Use:
php wp-cli.phar --info

root@web [/]# php wp-cli.phar --info
OS: Linux 2.6.32-042stab134.3 #1 SMP Sun Oct 14 12:26:01 MSK 2018 x86_64
Shell: /bin/bash
PHP binary: /opt/cpanel/ea-php73/root/usr/bin/php
PHP version: 7.3.4
php.ini used: /opt/cpanel/ea-php73/root/etc/php.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.1.0
root@web [/]#

We want to use the wp-cli tool with the “wp” command so let’s run the commands:
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

The first command makes the file executable, the second one moves it to /usr/loca/bin/wp folder.

Everything is done now, let’s test it. Use:
wp --info

root@web [/]# wp --info
OS: Linux 2.6.32-042stab134.3 #1 SMP Sun Oct 14 12:26:01 MSK 2018 x86_64
Shell: /bin/bash
PHP binary: /opt/cpanel/ea-php73/root/usr/bin/php
PHP version: 7.3.4
php.ini used: /opt/cpanel/ea-php73/root/etc/php.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.1.0
root@web [/]#

If you are running cPanel on the server, the wp-cli tool is already installed in /usr/local/cpanel/3rdparty/bin/wp. Many times, 3rd party apps are not updated frequently, so you may want to install wp-cli manually, as described above.

 

To update the wp-cli tool, use:
wp cli update

root@web [/]# wp cli update
Success: WP-CLI is at the latest version.
root@web [/]#

Thank you.

Related articles:
Most used wp-cli commands

Resources:
https://wp-cli.org/
https://wp-cli.org/#installing

Share this post:
Page 1 of 52
1 2 3 52
back to top