Author:
erics , September 24th, 2015
The key is to send a response header like this: Access-Control-Allow-Origin: * In the Apache web server, one enables this via the following directive: Header set Access-Control-Allow-Origin * This requires the use of mod_headers, which is enabled by default in Apache. For example:
LoadModule headers_module modules / mod_headers . so
. . .
< VirtualHost * : 80 >
ServerName www . your . domain
ServerAlias * your . domain
DocumentRoot / var / www / yourdomain
DirectoryIndex index . php index . html
Header set Access - Control - Allow - Origin *
< / VirtualHost >
Categories: How-To's , Technology Tags: Access-Control-Allow-Origin , ajax , apache , cross , cross-site , cross-site javascript , headers , howto , http , javascript , Load , mod_headers , tips , xsite
| No comments
Author:
erics , September 15th, 2015
The script to check and restart apache…works on CentOS – YMMV!
#!/bin/bash
MAXLOAD = 6
check = $ ( uptime | awk - F 'average: ' '{print $2}' | awk '{print $1}' | tr - d ',' )
if [ [ $check > $MAXLOAD ] ] ; then
/ sbin / service httpd stop
HOST = ` hostname `
echo $HOST | mailx - s "$HOST load alert - apache STOPPED by cron script" load .alert @ your .domain
sleep 300
/ sbin / service httpd start
echo $HOST | mailx - s "$HOST load alert - apache STARTED by cron script" load .alert @ your .domain
fi
Add to cron * * * * * /root/restart_apache_if_load_hits_threshold.sh >> /var/log/restart_apache_if_load_hits_threshold.log 2>&1
Categories: How-To's , Technology Tags: apache , AWK , bash , CentOS , howto , httpd , Load , load average , Restart , Stop , tips , Uptime
| No comments
Author:
erics , September 5th, 2015
SELECT DISTINCT `meta_value` FROM `wp_postmeta` WHERE `meta_key` LIKE '_wp_page_template'
Categories: How-To's , Technology Tags: File , File Name , howto , Page , Template , tips , WordPress
| No comments