Configuring VPS | Moving wordpress from old hosting to new VPS | Part 2

Part 2:
As now, you have configured VPS, Now its time to move your old wordpress site to our new VPS(Which is already configured with LAMP). If you have not configured till yet, then it is my suggestion that you go back to my first tutorial
Configure VPS | Install LAMP on Centos VPS Part 1

So now lets begin the tutorial
As now, you know the basics on how to handle putty software and the ssh commands,
So lets start

First we will create the backup of the folder in your old server/hosting,
This is can be much easier through Cpanel, but if you don't have, then you have to enable the ssh by asking your hosting people.
Then connect to your old servers ssh and follow these steps
Code:

cd public_html/your_directory_of _your_website_folder
tar -cvf foldername.tar
Remember your_directory_of _your_website_folder should be your wordpress folder and foldername.tar foldername will be the wordpress folder name, and your backup will be created in the name of that folder.

Now exit and connect to your new VPS, and follow these commands
Code:

cd /var/www/html
wget http://nirajmchauhan.blogspot/wordpress.tar
tar -xvf wordpress.tar

In the first line we are giving the command to change the directory.
Second line, is used to download the compressed backup file from your old server.
REMEMBER:The URL and the back-up-file-name should be perfect, don't directly copy-paste mine
Third line is used to extract the backup

Till now we were successful to bring the wordpress to our new VPS, now we will bring the database of the wordpress.

The very first thing is to create the back-up of the wordpress mysql database, by logging into your old servers phpmyadmin, selecting the appropriate database and exporting that.
For this I ll suggest you to follow this link,
Backing up database

Now if you are ready with the mysql database backup, its time to bring it on our new VPS.

Code:

cd /var/www/html
wget http:nirajmchauhan.blogspot.com/mysql.tar
tar -xvf mysql.tar


after extraction of database backup we will integrate it with phpmyadmin.
Before doing this, you have log in to new VPS php-my-admin window and create a new database, lets consider it as niraj

Sample of the code:

mysql -u user -p dbname < {path}/backup.sql 

Actual Code:

mysql -u root -p niraj < /var/www/html/backup/niraj.sql
Just assuming my username to be root, my roots password to be password, niraj to be my new database in php-my-admin, which we created, and niraj.sql is the database sql file which we extracted before few steps.

Done,
You have successfully installed your old site to new VPS,
just after this you need to configure your wordpress wp-config file and add user to your php-my-admin for your database.
If any questions, feel free to ask

Wordpress-Publish new post redirecting to homepage | While saving edited code redirecting to home-page

This is a hectic bug for us, whenever a user tries to publish the post or save any code changes, it redirects to the homepage without publishing and saving the code,

This problem I also faced, many people recommends of redirection plugin fixes, but in many cases people are not using that, and then also they facing this kinds of problems.

The only solution to this writing a simple code in .htaccess file

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

Just copy paste the above code and then done, you are free without any errors to publish post and save the codes without any home-page redirection.

This usually happens when on server, some changes are made on `mod_security` rule.
So next time if you face this problem, no worries, just follow this post

Configure VPS | Install LAMP on Centos VPS Part 1

Few days before when I had a VPS and needed to install wordpress, I found it very difficult because very few resources were available on google
So I am here now with my new post, On HOW TO INSTALL LAMP ON CENTOS
First buy an unmanaged VPS, and get ssh access
Then install Putty software in your computer, and start it
Then Follow the further steps

Start Putty software and then enter your IP for eg. 255.255.255.254
it will ask for username
generally its root and then enter the password
after that start typing the following code

IMPORTANT: IF YOU ARE NOT FAMILIAR WITH SSH COMMAND THEN BE CAREFUL. JUST COPY PASTE THE CODES.

First we will install yum
code:

yum install -y yum-priorities

After this we need to download updated repositories for php and mysql packages
code:
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Then we will extract that by following command
code:
rpm -Uvh epel-release-5-4.noarch.rpm

rpm -Uvh remi-release-5.rpm

After This we give priorities to repo and exclude php mysql and phpmyadmin from repository
code:

vi /etc/yum.repos.d/CentOS-Base.repo

After this a file will be opened, press I from the keyboard to edit it, and after editing press esc button and type :x to save it
code:
priority=1
exclude=*php* *mysql* *phpmyadmin*

Copy paste this above code five times before the following lines

#released updates
#packages used/produced in the build but not released
#additional packages that may be useful
#additional packages that extend functionality of existing packages
Copy paste the next lines before this line #contrib - packages by Centos Users

Code:
priority=2
exclude=*php* *mysql* *phpmyadmin*
Just one line above priority=2 their will be a line enabled=0 just make that to 1

After this press esc and type :x to save the file
Now same thing for epel and remi repository
code:

vi /etc/yum.repos.d/epel.repo

Just Above this line [epel-debuginfo] insert this code(inserting and saving is been explained on top)
Code:

priority=3

Now after saving that, we will now edit the same code with just different filename

Code:
vi /etc/yum.repos.d/remi.repo

And now in this, just above [remi-test] line, change the value of enable=0 to 1
and paste this code exactly above the [remi-test] line

Code:

priority=3

Save it and now we will install apache web server,

Code:

yum install -y httpd

After this we will install php,

Code:

yum install php

During the installation it will prompt you for importing GPG key for the new repositories, just type y and press enter, this will be come for two times

Now we will start the Apache server

Code:
/etc/init.d/httpd start

Just to test our Apache and php, we will create a phpinfo file

Code:
vi /var/www/html/info.php

A new file will be created, insert this code into it, and then save it

Code:
<?
phpinfo();
?>

Now in your browser, enter this URL, http://your IP or localhost/info.php
Now a PHP INFO file should open, where it will display php and servers information
if not then restart the apache server,
To restart the server,

Code:

/etc/init.d/httpd restart

Now we will install MySql

Code:

yum install -y mysql-server mysql php-mysql

Now the next code is used to configure Apache , to start MySql when server is rebooted.

Code:
chkconfig httpd on
chkconfig mysqld on

Fire up MySql Server

Code:

/etc/init.d/mysqld start

Now we will set the root password of mysql

Code:
mysql -u root password password

Here the second password is the actual root password, you can change it with your's own.

Now its time to do last job, thats installing phpmyadmin

Code:

yum install -y phpmyadmin

Now we have to edit phpMyAdmin config file to avoid the Forbidden Access Error

Code:

vi /etc/httpd/conf.d/phpMyAdmin.conf

Search for a line,

deny from all
Comment the above line just by inserting # before the line, so after that, it should look like the following,

# deny from all

Save it and restart the Apache server

Code:

/etc/init.d/httpd restart

Done
Now goto the browser and type this URL
http://IP or localhost/phpmyadmin
Now the page will appear, just enter username as root and password as password

Feel free to give suggestions.

Wordpress showing blank WHITE PAGE

what! My wordpress Site Showing White Blank Page! No Errors !
Are you having this kind of problem ????
Don't panic, this the the Wordpress White Screen Of Death
The name looks dangerous, but it is not,
Many times, mostly when transferring wordpress site from one hosting to another, people find that when running their website, they find wordpress is displaying White Blank Screen
This is caused because of damaged files in Wordpress.
The following are the solutions for it:-
  • Reinstall Wordpress
  • Check wp-config file
  • Deactivate All plugins
  • Change the theme to default
  1. Reinstall the wordpress, just go to your file manager through FTP or cpanel and reinstall the wordpress manually by copy pasting files.
    Remember Dont copy Wp-Content Folder.
  2. WP-CONFIG.PHP check your wp-config file, it should start with <? and end with ?>

    their should be no space or blank line before <? and after ?>
  3. DEACTIVATE PLUGINS AND THEMES, just through your file manager rename the folder of your plugin and themes to any other name in my case i used Plugins_temp and Themes_temp
    this deactivated all the plugins, and it made my theme to default Twenty-ten theme
Thats it you are done, these answer's will solve your problem,
Any problem persists, feel free to ask
Sharing is Caring

Blog Archive

About Me

My Photo
NiRaJ (asp or php)!!!!!!
I am basically a software engineer and Website designer & developer (final year student)
View my complete profile

Woooo

WooThemes - Made by Designers