September 2018
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

Categories

September 2018
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

MySQL: Calculate the free space in IBD files

If you use MySQL with InnoDB, chances are you’ve seen growing IBD data files. Those are the files that actually hold your data within MySQL. By default, they only grow — they don’t shrink. So how do you know if you still have free space left in your IBD files?

There’s a query you can […]

Apache 2.4 AH01762 & AH01760: failed to initialize shm (Shared Memory Segment)

Apache 2.4 AH01762 & AH01760: failed to initialize shm (Shared Memory Segment)

Mattias Geniar, Tuesday, January 12, 2016

I recently ran into the following problem on an Apache 2.4 server, where after server reboot the service itself would no longer start.

This was the error whenever I tried to start it:

$ tail -f error.log […]

time difference

Time difference res1=$(date +%s.%N) sleep 1 res2=$(date +%s.%N) echo “Start time: $res1” echo “Stop time: $res2” echo “Elapsed: $(echo “$res2 – $res1″|bc )” printf “Elapsed: %.3F\n” $(echo “$res2 – $res1″|bc )

ELASTICSEARCH: LISTEN ALL NETWORK INTERFACES ON CENTOS 7

ELASTICSEARCH: LISTEN ALL NETWORK INTERFACES ON CENTOS 7

 

 

y default elasticsearch listens to localhost.

# netstat -na|grep LISTEN |grep 9200 tcp6 0 0 127.0.0.1:9200 :::* LISTEN tcp6 0 0 ::1:9200 :::* LISTEN

If you want to access over the network you need to edit network.host parameter /etc/elasticsearch/elasticsearch.yml file

———————————- Network ———————————– # […]

Hotlink Protection

Enable Hotlink Protection on Apache

If your WordPress site is running on Apache, all you need to do is open the .htaccess file in your site’s root directory (or create it) and add the following:

RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com […]

Implementing Content Security Policy in Apache

Header unset Content-Security-Policy Header add Content-Security-Policy “default-src ‘self'” Header unset X-Content-Security-Policy Header add X-Content-Security-Policy “default-src ‘self'” Header unset X-WebKit-CSP Header add X-WebKit-CSP “default-src ‘self'”

You may also be interested in adding those headers:

Header set X-Content-Type-Options “nosniff” Header set X-XSS-Protection “1; mode=block” Header set X-Frame-Options “DENY” Header set Strict-Transport-Security “max-age=631138519; includeSubDomains”

 

 

 

Along […]

HTTP Strict Transport Security for Apache, NGINX and Lighttpd

HTTP Strict Transport Security (often abbreviated as HSTS) is a security feature that lets a web site tell browsers that it should only be communicated with using HTTPS, instead of using HTTP. This tutorial will show you how to set up HSTS in Apache2, NGINX and Lighttpd. It is tested with all mentioned webservers, NGINX […]