Month October 2012

nginx redirect single url

Objective Using nginx redirect single url Example ORIGINAL URL: REDIRECT TO: nginx basic php location block example location / { try_files $uri $uri/ @mylocation; } location @mylocation { rewrite ^/foo(.*)$ /bar/ redirect; rewrite ^.*$ last; } nginx…

curl test https redirect

Testing an https redirect In this example we will be testing an https redirect via curl curl test https redirect Syntax curl -k –head http://someurl Example [root@interweb ~]# curl -k –head HTTP 301 Moved Permanently Connection: close Location: …

sed delete all lines after

Objective: Prep dev httpd.conf for production Tasks: Remove jenkins virtual host entry (which starts with a comment line “#Start Jenkins”) Replace .dev with nothing (ex: www.dev.example.com becomes www.example.com) Replace debug with error (ex: Loglevel debug becomes Loglevel error) Sed to…

rollback httpd.conf changes on error

To rollback httpd.conf changes on error use this script: #!/bin/bash #File: deploy_new_httpd_conf.sh #Define this PATH_TO_NEW_HTTPD_CONF=”~” #Backup old httpd.conf file /bin/cp -f #Copy new httpd.conf over the existing one /bin/cp -f ${PATH_TO_NEW_HTTPD_CONF} #Test the Syntax /usr/sbin/apachectl -t if…

wget warm drupal cache

Objective: Warm Drupal Cache I wrote this script to warm the cache of a drupal site Script Contents #!/bin/bash -ex # Locate the binaries MKDIR=”$(which mkdir)” RM=”$(which rm)” WGET=”$(which wget)” #************************************ #### YOU MUST DEFINE THESE PATH_CACHE_ROOT=”/root/some_dir_name_to_store_data” PATH_LOG_FILE=”” URL_TO_CACHE=”” USER_AGENT=”Mozilla…