THE IT IDEAS

  • Home

Tuesday, 16 December 2014

How to resolve mcrypt extension missing error.

 THE IT IDEAS     14:46     error   

Error Message
"The mcrypt extension is missing. Please check your PHP configuration"

#apt-get install php5-mcrypt
#ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available    or    If this command not work fire below one for latest apache.
#ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/mods-available/
#php5enmod mcrypt
#service apache2 restart

Reload and check error message gone.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to upload EC2 Data to S3 Bucket with s3cmd

 THE IT IDEAS     14:36     aws   

Install s3cmd third party software in EC2 Instance.

#apt-get install s3cmd
Configure s3cmd to access your S3 Bucket with below prodecure.

#s3cmd --configure


Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key : PASTE YOUR ACCESS KEY
Secret Key : PASTE YOUR SECRET KEY

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password:    ENTER
Path to GPG program [/usr/bin/gpg]:    ENTER

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]:   ENTER

On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't conect to S3 directly
HTTP Proxy server name:     If your your are using internet proxy to connect internet provide details here or just press ENTER

New settings:
  Access Key: YOUR ACCESS KEY
  Secret Key: YOUR SERCET KEY
  Encryption password:
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: False
  HTTP Proxy server name:
  HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] Y
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Not configured. Never mind.

Save settings? [y/N] y
Configuration saved to '/root/.s3cfg'

s3cmd Setup is completed.

#s3cmd ls             <--- This command will show your Buckets in your account.
2014-12-16 08:33  s3://bucketwork


<---     Now setup your Source folder and Destination S3 Bucket.      --->

#s3cmd sync /home/ubuntu/backup/ s3://bucketwork/
WARNING: Redirected to: bucketwork.s3-ap-southeast-1.amazonaws.com
WARNING: Module python-magic is not available. Guessing MIME types based on file extensions.
/home/ubuntu/backup/2014-12-16/mysql.gz -> s3://bucketwork/2014-12-16/mysql.gz  [1 of 1]
 375 of 375   100% in    0s     5.43 kB/s  done
Done. Uploaded 375 bytes in 0.1 seconds, 5.19 kB/s


Its Done you can set this command as Cron to run whenever you need.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Friday, 12 December 2014

How to move github local folder to another location.

 THE IT IDEAS     11:12     github   

Open your GitHub Clone folder and move ".git" folder to your destination folder.

Eg. Clone folder :: /var/www/html/htmwebsite
      Destination folder :: /var/www/html

#cd /var/www/html/htmlwebsite
#mv .git ../        or     mv .git /var/www/html

Then you can move your all files and folder from htmlwebsite to destination folder

#cd /var/www/html/htmlwebsite
#mv * ../           or     mv * /var/www/html

Thats It !! Now run status command to check git is recognise your destination folder or not.

#cd /var/www/html
#git status           <--- If GitHub is recognize folder it will showing message like below ...
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working directory clean



All Done !!!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Basic GitHub Commands

 THE IT IDEAS     11:09     github   

Clone remote github repository.
#git clone https://github.com/accountnameexample/example.git


After modify files or folder commit your changes on github repository.

#git add filename
#git commit -a     <-- Once you fire this command it will open nano editor to make note of this changes. Just write your note and save the file.

#git push https://github.com/accountnameexample/example.git   <-- This command will upload all your changes to github repo.


To Receive changes from github Repo.
#git pull https://github.com/accountnameexample/example.git     <-- This commnad will receive all changes from github repo to local repo.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Thursday, 11 December 2014

Installation and configuration of GeoIP module in php

 THE IT IDEAS     15:13     geoip, php   

After installation of Apache2 and php follow below step to achive country wise redirection.

#apt-get install libapache2-mod-geoip

Edit geoip.conf file and uncomment mentioned line.
#nano /etc/apache2/mods-available/geoip.conf

<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPDBFile /usr/share/GeoIP/GeoIP.dat        <-- uncomment this line with remove # from starting of line.
</IfModule>

save and exit. Once restart apache server

#/etc/init.d/apache2 restart

Now, Make one file to test.

#nano /var/www/html/example.php

Enable mod rewrite module in php

#a2enmod rewrite

Again restart the apache server.

#service apache2 restart

Edit default apache host file and add below mentioned lines before </VirtualHost> tag to redirect url country wise.
#nano /etc/apache2/sites-available/000-default.conf 


<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
</IfModule>
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^IN$
RewriteRule . /example.php [L]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^DE$
RewriteRule . /2.php [L]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
RewriteRule ^(.*)$ http://www.yahoo.com$1 [R,L]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
RewriteRule ^(.*)$ http://www.google.com$1 [R,L]


Save and exit. Once restart apache server.
#service apache2 restart



Brief Information about the lines.

1)  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^IN$
     RewriteRule . /example.php [L]

Above line will redirect your default page to example.php in your root directory (html folder) If opened with INDIAN IP.

2) RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^DE$
    RewriteRule . /2.php [L]

Above line will redirect your default page to 2.php in your root directory (html folder) If opened with GERMANY IP.

3) RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
    RewriteRule ^(.*)$ http://www.example.co.us$1 [R,L]

Above line will redirect your default page to another URL. If opened with US IP.


4) RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
    RewriteRule ^(.*)$ http://www.google.com$1 [R,L]

Above line will redirect your default page to another URL. If opened with CANADA IP.



Use your desire setting to achive your goal !!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Tuesday, 9 December 2014

Install MongoDB php driver in XAMPP/LAMPP

 THE IT IDEAS     15:57     apache2, mongodb   

To install the php driver for MongoDB

Prerequisite ::

#sudo apt-get install autoconf
#export PHP_AUTOCONF=/usr/bin/autoconf
#sudo apt-get install gcc
#sudo apt-get install make

Installing mondodb phpdriver

#sudo /opt/lampp/bin/pecl install mongo
It will download and installing mongo php driver and given message as below


Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/mongo.so'
install ok: channel://pecl.php.net/mongo-1.5.8
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini


Now, Just add below mentioned line into php.ini file.

extension=mongo.so

and restart the lampp

#sudo /opt/lampp/lampp restart
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Wednesday, 3 December 2014

How to redirect HTTP to HTTPS

 THE IT IDEAS     11:50     apache2   

First you need to install SSL Certificate Successfully. Once your done that choose any of example to do redirect url.

Example : 1

In this example you don't need mod rewrite module to be enabled.

Open your apache configuration file 

#nano /etc/apache2/sites-enabled/000-default.conf

Modify your VirtualHost Tag as followed 

<VirtualHost *:80>
    ServerName www.example.com (your domain name)
    Redirect / https://www.example.com/
</VirtualHost>

Save and exit. Restart apache service once
#service apache2 restart

Check your domain url with http it will redirect automatically on HTTPS.


Example : 2

In this Example you have to enable mod rewrite module first with below command

#a2enmod rewrite

Now, Copy below code in your .htaccess file without any changes on beginning of .htaccess file.


# BEGIN REWRITE SITEWIDE HTTP TO HTTPS

# This will enable the Rewrite capabilities
RewriteEngine On

# This checks to make sure the connection is not already HTTPS
RewriteCond %{HTTPS} !=on

# This rule will redirect users from their original location, to the same location but using HTTPS.
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]

# END REWRITE SITEWIDE HTTP TO HTTPS

Save and exit from file.

Now open your apache configuration file and make mentioned changes in your file.

1) "AccessFileName .htaccess" tag should be open.

2) Check Directory tag and change "AllowOverride None" to "AllowOverride All"

e.g.

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Save and exit the file.

Restart Apache service once

#service apache2 restart


All Done Check now !!!




Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to Create VirtualHost in Apache 2.4

 THE IT IDEAS     10:53     apache2   

Install Apache2 with below command.

#sudo apt-get install Apache2

Create Demo VirtualHost Directory

#sudo mkdir -p /var/www/html/example.com
#sudo mkdir -p /var/www/html/theitideas.com

Create Demo Pages for Each Virtual Host

#nano /var/www/html/example.com/index.html

Paste Below code in index.html file

<html>
  <head>
    <title>Welcome to Example.com!</title>
  </head>
  <body>
    <h1>It works!  Example.com</h1>
  </body>
</html>

Save the file and exit.

Now for theitideas.com

#nano /var/www/html/theitideas.com/index.html

Paste Below code in index.html file

<html>
  <head>
    <title>Welcome to theitideas.com!</title>
  </head>
  <body>
    <h1>It works!  theitideas.com</h1>
  </body>
</html>

Save the file and exit.



Now Create the First Virtual Host File

#sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf

Edit the file with below command and edit file as mentioned below.

#sudo nano /etc/apache2/sites-available/example.com.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName example.com
        ServerAlias www.example.com
        DocumentRoot /var/www/html/example.com
</VirtualHost>

Again to the same process for theitideas.com VH.

#sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/theitideas.com.conf

Edit the file with below command and edit file as mentioned below.

#sudo nano /etc/apache2/sites-available/theitideas.com.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName theitideas.com
        ServerAlias www.theitideas.com
        DocumentRoot /var/www/html/theitideas.com
</VirtualHost>


Now Turn to enable both Virtual Host 

#sudo a2ensite theitideas.com.conf
#sudo a2ensite theitideas.com.conf

Restart Apache Service

#sudo service apache2 restart
or
#sudo /etc/init.d/apache2 restart

Virtual Host is set in apache server. Now you have to make changes in your machine to check Virtual Machine.

#sudo nano /etc/hosts

Add line in you hosts file.

your IP example.com
your IP theitideas.com

e.g. 
192.168.0.101  example.com
192.168.0.101  theitideas.com


Save and exit. Now Open your browser and open example.com and theitideas.com

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Like Us !!!

Recent Posts

Blog Archive

  • ►  2016 (1)
    • ►  April (1)
  • ►  2015 (12)
    • ►  August (1)
    • ►  May (2)
    • ►  April (8)
    • ►  March (1)
  • ▼  2014 (23)
    • ▼  December (8)
      • How to resolve mcrypt extension missing error.
      • How to upload EC2 Data to S3 Bucket with s3cmd
      • How to move github local folder to another location.
      • Basic GitHub Commands
      • Installation and configuration of GeoIP module in php
      • Install MongoDB php driver in XAMPP/LAMPP
      • How to redirect HTTP to HTTPS
      • How to Create VirtualHost in Apache 2.4
    • ►  November (12)
    • ►  April (2)
    • ►  March (1)
  • ►  2013 (7)
    • ►  December (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (3)
  • ►  2012 (15)
    • ►  December (6)
    • ►  November (9)

Categories

apache2 EC2 error mysql php ubuntu aws aws rds browser github installation linux mount s3 AWS Bucket CentOS Computer DocumentRoot change How to Benchmarking Webserver IP LAMP Restart Computer SCP command SQL SERVER XRDP administrator amazon rds backup basic commands chat command line disable download drupal ec2.chroot environment external storage device fstab functions geoip gmail google home page iis instance internet java mod rewrite mongodb multiple login network password one password php5 php5-fpm php7 private browsing python repair filesystem repo reset password rhel sa password same computer script sftp share skype ssh tomcat ubuntu 16.04 ubuntu16 visudo windows 8 youtube
JobsMagBlogJobsMag.InThingsGuide

Popular Posts

  • Install MongoDB php driver in XAMPP/LAMPP
    To install the php driver for MongoDB Prerequisite :: #sudo apt-get install autoconf #export PHP_AUTOCONF=/usr/bin/autoconf #sudo apt...
  • How to Install PHP 7.0, Apache 2.4.18, & MySQL 5.7 on Ubuntu 16.04 LTS
    Update your repo list with below command $ sudo apt-get update -- > Install Apache 2.4.18 $ sudo apt-get install apac...
  • Share Internet from one PC to another PC
    Open Network Connections by clicking the Start button , clicking Control Panel , clicking Network and Internet , clicking Network and S...

Copyright © THE IT IDEAS | Powered by Blogger