Wednesday, July 26, 2017

Linux, BSD, Unix

nginx introduced dynamic module support in v. 1.9.11. This brief article provides step-by-step procedure to enable GeoIP support on your CentOS server.

Tagged under:

There are multiple reasons to switch off your WiFi router at night - from lowering the risk to affect your health or cause insomnia to save planet's energy resources. Most routers do not have this feature, so you will have to do it manually. However, if you own a MikroTik RouterBOARD one, you can easily do it. Moreover, you can even make this automated!

Another alternative is to lower WiFi output power to minimal values. I usually run my router with 100mW output during the working hours, and 8 mW at night. Fortunately, Mikrotik RouterOS also allows to change this setting from scripts, so you can program your own power scheme.

Tagged under:

In some cases you have to run multiple services on a domain secured by SSL certificate, on various ports.

Users, who want to access your server at https://example.com:1337 often type just example.com:1337, which leads to plain HTTP request and the error specified above.

A single line in nginx configuration can prevent nginx from showing this error message, and redirect user user using the correct scheme instead. Just add

error_page 497 https://$host:$server_port$request_uri;

to your host configuration inside server { ... } block and reload the configuration:

[[email protected] #]service nginx reload
Tagged under:

The following script may help you to transfer or mirror your existing PHP+MySQL website completely from one server to another. You will need SSH accounts on both servers, with public key authentification set up (server 2 has public key in its ~/.ssh/authorized_keys for corresponding server 1's ~/.ssh/id_dsa (id_rsa)  ).

Save the following script as ~/transfer-site.sh, make it executable (chmod +x ~/transfer-site.sh) and launch it on server 1:

#!/bin/sh echo "Starting syncronization..." echo "Starting file transfer" rsync -rvz -e 'ssh -p 22' /PATH/TO/YOUR/EXISTING/SITE/ This email address is being protected from spambots. You need JavaScript enabled to view it.:/PATH/TO/YOUR/NEW/SITE/ --exclude="configuration.php" echo "Starting MySQL transfer" mysqldump --add-drop-table -u dbuser_1 -h mysql.example.com database_1 -pPASSWORD1 | ssh new-server mysql -h mysql.example.org -u dbuser_2 -pPASSWORD2 database_2 echo "All done!"

Is is assumed that you are transferring data from server 1 (example.com) to server 2 (example.org). And, sure, you do not need --exclude="configuration.php" in most cases. This will be useful only if you are synchronizing master Joomla! website with its mirror.

 

To use

ssh new-server

syntax you will need add the following to your ~/.ssh/config:

Host new-server Hostname example.org User username Port 22 PasswordAuthentication no
Tagged under:

Keywords: Apache MPM ITK PHP MySQL VPS CentOS

In this article I'm going to describe a typical configuration for a private web server. I assume you use CentOS 6 as your operating system, in other *nix distributions some paths and commands may vary. However, the idea remains intact:)

Most servers require PHP as scripting language, and MySQL for databases

If you run multiple websites, it is always better to run them as different users. Even if a hacker gets access to one of your sites, there's a high chance that the others will remain intact.

Tagged under:

Welcome!

Here I publish articles related to my areas of interest, my brief notes that may save some time to others, as well as some of my works.

This site is a work in progress. I will add more sections in the future, such as

  • More photos to photogallery
  • More Joomla!-related articles
  • ...

 

themeforest

New Posts

Using dynamic GeoIP module with nginx (CentOS)

nginx introduced dynamic module support in v. 1.9.11. This brief article provides step-by-step procedure...

13-04-2016 in Linux, BSD, Unix

READ MORE

Visual difference between pseudo and true random data

This is is "random" image generated using PHP rand() function: And this is an image...

20-11-2015 in Blog

READ MORE

Best EEPROM practices

(this article is a work in progress). My own advice will be added later...   Having...

12-10-2015 in Arduino

READ MORE
Scroll to top

We use cookies, just to track visits to our website, we store no personal details Privacy policy