
This article explains how MySQL settings can be optimized following a set of predetermined steps. The results are pretty reliable and we keep using this with a very high degree of success. This is something regularly done at Leanservers.

This article explains how MySQL settings can be optimized following a set of predetermined steps. The results are pretty reliable and we keep using this with a very high degree of success. This is something regularly done at Leanservers.
NGINX’s default behavior for rewrite rules (at least up to version 0.7.65) is to redirect if the replacement part begins with ‘http://’. Let me quote some info from NGINX’ wiki:
rewrite
syntax: rewrite regex replacement flag
[...]
If the replacement string begins with
http://then the client will be redirected, and any further rewrite directives are terminated.
It is important to take this into consideration while designing new rules because the behavior of the rule itself is bound to the place we are retrieving data from.
Apache does this differently since it offers a flag that can be set per rule which instructs the web server to just “proxy” the request (i.e. do not redirect, just get the response of that request in the background and send it back to the client). Taken from Apache’s site, this flag is:
‘
proxy|P‘ (force proxy)
This flag forces the substitution part to be internally sent as a proxy request and immediately (rewrite processing stops here) put through the proxy module. You must make sure that the substitution string is a valid URI (typically starting withhttp://hostname) which can be handled by the Apache proxy module. If not, you will get an error from the proxy module. Use this flag to achieve a more powerful implementation of the ProxyPass directive, to map remote content into the namespace of the local server.Note:
mod_proxymust be enabled in order to use this flag.
How to implement this under NGINX
I have been able to get similar behavior under NGINX using ‘rewrite’ and ‘proxy_pass’ directives.
The following example implements a regular expression based rewrite rule serving content from domain2 to the client’s request on domain1.
|
1 2 3 4 5 6 7 8 9 |
server { listen 1.2.3.4:80; server_name domain1.com; location / { rewrite ^/([0-9][0-9]/[0-9][0-9]/.+)$ /example/?t=$1 last; proxy_pass http://domain2.com; } } |
Using that NGINX configuration, the client can request:
|
1 |
http://domain1.com/12/34/test |
which will be proxied to:
|
1 |
http://domain2.com/exanple?t=12/34/test/ |
and served back to her “apparently” from http://domain1.com/12/34/test (i.e. there won’t be any URL redirection).
Usage:
|
1 2 |
mysql> revoke PRIVILEGES [, GRANT OPTION] from 'USERNAME'@'SERVER'; mysql> flush privileges; |
Example:
|
1 2 |
mysql> revoke all privileges, grant option from 'comsiteuatusr'@'10.135.7.114'; Query OK, 0 rows affected (0.00 sec) |
|
1 2 |
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) |
See Also
The syntax to pass parameters to PHP scripts executed command line is:
|
1 |
php script.php arg1 arg2 arg3 |
For more information:
I covered on a previous post how to keep the clock synchronized for VMware Linux guest(s). Well this seems to not work at least for recent versions VMware Server 2 (i.e. the one with web based management console). For now the quick& dirty solution I am using is putting a cron job that executes ntpdate pretty often…
My cron job looks like this:
|
1 2 3 4 |
# # Temporary fix for the time getting lost # 0-59/10 * * * * /usr/sbin/ntpdate north-america.pool.ntp.org > /dev/null 2>1 |
Yes, this fix requires to have NTPDATE installed (apt-get install ntpdate under Debian).