IPTables rules for the web server

To open the web server port in IPTables, execute the following command:

iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

If HTTPS is used, then also:

iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

To open only a particular network, for example 192.168.0.0/24:

sudo iptables -A INPUT -s 192.168.0.0/24 -p tcp -m tcp --dport 80 -j ACCEPT

You can also restrict access by the IP configuration of the web server itself, for example, as I described for Apache2 in this article – Access Control Apache2.

To set the connection limit on port 80:

iptables -A INPUT -p tcp --dport 80 -m limit --limit 50/second -j ACCEPT

To remove a rule, we’ll specify the same command, replacing -A with -D, for example:

sudo iptables -D INPUT -p tcp -m tcp --dport 80 -j ACCEPT

To view the list of rules, use the command:

sudo iptables -nvL

See also:
Configuring IPTables

Installation Kloxo-MR – a free control panel for servers

Kloxo-MR – a free control panel for servers based on Kloxo (https://github.com/lxcenter/kloxo).

At hand I had CentOS 6.9, the recommended version of Minimal.
The official source of Kloxo-MR is mratwork.com and github.com/mustafaramadhan.

Switch to the root user, if not under it:

su -

Update the system:

yum update -y

Install the necessary components:

yum install yum-utils yum-priorities vim-minimal subversion curl zip unzip telnet wget -y

Download the installation script:

cd /tmp
rpm -ivh https://github.com/mustafaramadhan/rpms/raw/master/mratwork/release/neutral/noarch/mratwork-release-0.0.1-1.noarch.rpm

Remove the cached packages and update the RPM mratwork:

yum clean all
yum update mratwork-* -y

Install the Kloxo-MR:

yum install kloxomr7 -y
sh /script/upcp

The installation process can take a long time – we wait.

When the installation is complete, restart the server:

reboot

Kloxo-MR can be opened in the browser http://SERVER:7778 and https://SERVER:7777.
The default login and password are admin.

You can restart it like this:

sh /script/restart-all -y

Check this:

netstat -tulpn | grep :7777

How to record games clips in Windows using the Xbox panel?

Since the Xbox gaming panel is built into Windows 10, no additional programs are needed to record the video, just by pressing two Win+G keys simultaneously in the game.
After pressing Win+G, the Xbox gaming panel should open, in which you must click on the red circle (you can also use the combination of keys Win+Alt+R to start and stop video recording).
Using the keys Win+Alt+PrntScr, you can take a screenshot, and Win+Alt+T – show or hide the timer.

The Xbox game panel can also be opened by pressing the Xbox button on the gamepad.

Video clips are saved in MP4 format, to the \Video\Clips\ current user’s directory.

See also:
How to record games clips

How to change a WordPress theme through MySQL

To change the WordPress theme via MySQL, first see what theme is specified at the moment, for this, execute the SQL query via phpMyAdmin or MySQL client:

SELECT * FROM wp_options
WHERE option_name = 'template'
OR option_name = 'stylesheet'
OR option_name = 'current_theme';

Next, see what themes are in the /wp-content/themes/ directory.

For example, to change to the standard Twenty Fifteen theme, let’s execute three SQL queries:

UPDATE wp_options SET option_value = 'twentyfifteen' WHERE option_name = 'template';
UPDATE wp_options SET option_value = 'twentyfifteen' WHERE option_name = 'stylesheet';
UPDATE wp_options SET option_value = 'Twenty Fifteen' WHERE option_name = 'current_theme';

How to create an ad unit that supports AMP pages

Here is an example of placing AdSense ad units on the AMP-pages of the WordPress site:

1) Add an AMP script in the page code between the head tags that will load the required libraries:

<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>

If you use the recommended AMP plugin from Automattic, then the head tags are here /wp-content/plugins/amp/templates/html-start.php

2) Create an adaptive ad unit in your AdSense account. Let’s find in its code the identifier of the publisher (for example ca-pub-0066847942845019) and the ad unit ID (for example 1234567890).
Insert the code below into the page where you want to place the ad unit, replacing the value data-ad-client with the previously found publisher ID and data-ad-slot with the ad unit ID:

<amp-ad width="100vw" height=320
type="adsense"
data-ad-client="ca-pub-0066847942845019"
data-ad-slot="1234567890"
data-auto-format="rspv"
data-full-width>
<div overflow></div>
</amp-ad>

If you use the recommended AMP plug-in from Automattic, then the code should be inserted in /wp-content/plugins/amp/templates/single.php.

How to disable the WordPress plug-in via MySQL

To disable all WordPress plugins via MySQL, you must:

1) Be sure to make a backup copy of the database.

2) Open the phpMyAdmin or MySQL client from the terminal:

mysql -u USER -p

3) Execute the SQL query (if necessary, specify the correct prefix wp_):

UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';

After that, all plug-ins will be disabled and you can activate them again one by one in the admin panel.

You can also temporarily disable the plugin by renaming the directory with its files, the plugins are in the /wp-content/plugins/ directory.

How to restart services in cPanel

The services must be restarted through the WHM interface, by opening “Home” > “Restart Services”.

If the restart of the service through the WHM interface failed, then the script should be used:

/usr/local/cpanel/scripts/restartsrv_*

If you are using IPv6 and the command was executed:

service network restart

That IPv6 does not work to solve the problem:

/etc/init.d/cpipv6 restart (for cPanel & WHM version 11.52 and earlier)
/usr/local/cpanel/scripts/restartsrv_cpipv6 (for cPanel & WHM version 54 and later)

In extreme cases, you can try to restart the service directly:

/etc/rc.d/init.d/service restart
systemctl restart service-name.service

See also:
Location of log files cPanel

IPTables rules for SSH

To enable access to the SSH server in IPTables, you must add a rule:

sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT

To open only a particular network, for example 192.168.0.0/24:

sudo iptables -A INPUT -s 192.168.0.0/24 -p tcp --dport 22 -j ACCEPT

You can also restrict access by the IP configuration of the SSH itself.

To remove a rule, we’ll specify the same command, replacing -A with -D, for example:

sudo iptables -D INPUT -p tcp --dport 22 -j ACCEPT

To view the list of rules, use the command:

sudo iptables -nvL

See also:
Installing and Configuring SSH
Configuring IPTables