Wednesday, March 18, 2015

To change the siteurl value in wordpress using mysql

While during a wordpress migration, here i need to change the domain name. Currently, after WP migration all the links are pointing to the old domain name. We can solve this my updating a field in mysql DB.

Changing WordPress Home URL and Site URL via MySQL database.

Login to Mysql
use Database_name;
SELECT * FROM wp_options WHERE option_name = 'home';
       This will show the current site url
UPDATE wp_options SET option_value="http://newdomain.com" WHERE option_name = "home";
       Verify whether the change got reflected
SELECT * FROM wp_options WHERE option_name = 'siteurl';

Tuesday, January 20, 2015

tar: Removing leading `/' from member names

When I write a script to tar a folder, I am getting the following error

tar: Removing leading `/’ from member names

Here is the script line /bin/tar czf “/data1/backups/$DATE/html_$DATE.tar.gz” /var/www/html/

Solution: Use the option P, will solve this error

New Code : /bin/tar czPf “/data1/backups/$DATE/html_$DATE.tar.gz” /var/www/html/

Wednesday, January 7, 2015

http_client.h:26:25: error: openssl/ssl.h: No such file or directory

I got this error while installing Skipfish on Centos

http_client.h:26:25: error: openssl/ssl.h:No such file or directory

Solution is to install the following packages
 yum install pcre-devel openssl-devel libidn-devel libidn2-devel

How to install skipfish on centos

Skipfish is a good tool for website vulnerability checking

Login to server
cd /opt
wget http://skipfish.googlecode.com/files/skipfish-1.01b.tgz
tar zxvf skipfish-1.01b.tgz

yum install pcre-devel openssl-devel libidn-devel libidn2-devel
cd skipfish
make
cp dictionaries/default.wl skipfish.wl
./skipfish -o output_folder http://www.example.com

you’ll want to less README to understand all the options.

Monday, January 5, 2015

PHP mail issue

From CLI (server terminal) I could send mails using php
ie:
[root@ip-IP html]# php sendmail.php (It is working fine)
But when i try http://IP/sendmail.php mail won’t work.
I am using postfix, using a gmail account to relay mails.
In /var/log/maillog I can see the following
Jan 5 07:27:38 ip-ipaddress sSMTP[9847]: Creating SSL connection to host
Jan 5 07:27:38 ip-ipaddress sSMTP[9847]: SSL not working: unknown protocol (0)
Jan 5 07:27:38 ip-ipaddress sSMTP[9847]: Cannot open smtp.gmail.com:587
Jan 5 07:32:03 ip-ipaddress sSMTP[9850]: Creating SSL connection to host
Jan 5 07:32:03 ip-ipaddress sSMTP[9850]: SSL not working: unknown protocol (0)
Jan 5 07:32:03 ip-ipaddress sSMTP[9850]: Cannot open smtp.gmail.com:587
Jan 5 07:54:12 ip-ipaddress sSMTP[9893]: Creating SSL connection to host
Jan 5 07:54:12 ip-ipaddress sSMTP[9893]: SSL not working: unknown protocol (0)
Jan 5 07:54:12 ip-ipaddress sSMTP[9893]: Cannot open smtp.gmail.com:587
How I fix this issue:
vi /etc/php.ini
Edit sendmail_path to
sendmail_path = /usr/sbin/sendmail.postfix -t -i
/etc/init.d/httpd restart
This solved my issue.

http://skynetclouds.com/blog/cant-send-php-mail-using-browser-can-send-via-cli/

Sunday, October 19, 2014

How to solve HTTP Error 503. The service is unavailable in IIS

I am getting "Service Unavailable" error while loading IIS, port 80 is listening fine from locally and public.

Solution:
Open inetmgr
Double click "application pools" from lest side
Right click and start the "DefaultAppPool"

I got my application is working fine

Saturday, September 6, 2014

Nginx as a load balancer

How to configure Nginx as a Load balancer

sudo apt-get install nginx

nano /etc/nginx/sites-available/default

First we need to include the upstream module which looks like this:

upstream backend  {
  server backend1.example.com;
  server backend2.example.com;
  server backend3.example.com;
}

We should then reference the module further on in the configuration:

 server {
  location / {
    proxy_pass  http://backend;
  }
}

sudo service nginx restart