Migrate Wordpress site from Apache to Nginx?

Joined
Apr 5, 2017
Messages
56
Best answers
0
Points
0
#1
Hello,

Can anyone detail me on the steps to migrate a WordPress site ( on httpd apache ) to NGINX ( on CentOS 6 ) without dataloss and with site data remaining untouched?

Please reply if you know the solution, will be of big help
 

VirtuBox

Global Mod
Staff Member
Joined
May 3, 2016
Messages
1,517
Best answers
4
Ratings
392 12
Points
83
#2
There is no risk of losing your data by replacing apache by nginx, but it's a pretty long configuration and it is will include a downtime and may also require time to fix eventual issues.
In my opinion, you should setup a new server with nginx and migrate your website.
 

BlueLeaf

Well-known member
Joined
Apr 11, 2017
Messages
92
Best answers
1
Ratings
24 4
Points
8
#3
Hi guys. I run several Wordpress websites on Nginx. I didn't need to do any specific configuration on Wordpress for my Wordpress to work on Nginx. They simply work on Nginx just as they would do on Apache, and that's it.
The Nginx configuration is not easy though, if you do it for the first time. I would strongly advise you to follow documentation on how to configure Nginx. When I configured Nginx for the first time several years ago, I had to reconfigure it several times because I always forgot to include parameters in it (e.g. for PHP, for mailserver, etc). But after configure Nginx for a few times, it became easy. I could even configure it with my eyes closed now, if I didn't have to look at the screen :DD:
And yes, you will have downtime for sure if you replace Apache with Nginx. The best thing to do if you want to have no downtime is to configure a new server, put Nginx on it, move your sites to the new server (which has Nginx) and then change the DNS record by making them to point to your new server.
 
Joined
Feb 6, 2015
Messages
55
Best answers
0
Ratings
4
Points
8
#13
miken
Hi guys. I run several Wordpress websites on Nginx. I didn't need to do any specific configuration on Wordpress for my Wordpress to work on Nginx. They simply work on Nginx just as they would do on Apache, and that's it.
Did you use a control panel that supported Nginx on your server? or is it just a LEMP stack?
 

BlueLeaf

Well-known member
Joined
Apr 11, 2017
Messages
92
Best answers
1
Ratings
24 4
Points
8
#14
BlueLeaf
I did not use a control panel that supported Nginx on my server? I have a VPS which came empty. I installed Nginx on it along with PHP and all necessary PHP libraries. Finally it became a LEMP stack, and Wordpress worked perfect on it.
 

Chris Worner

Well-known member
Joined
Apr 15, 2016
Messages
331
Best answers
0
Ratings
31
Points
28
#15
Chris Worner
How long does it take to setup a LEMP stack? I have not setup one before. And after setup completely, how long to migrate Wordress from Apache to Nginx? I am afraid it is longer than setting up on a hosting control panel :)
 

BlueLeaf

Well-known member
Joined
Apr 11, 2017
Messages
92
Best answers
1
Ratings
24 4
Points
8
#16
BlueLeaf
Chris, normally, it takes about 2 hrs to set up Linux, Nginx, MySQL and PHP (+ all PHP libraries). I was able to get to this short time because I've done it dozens and dozens of times, and I could do it with my eyes closed now :). When I wasn't as experienced as now, it was taking me about 4 hrs. However, if you do it for the first time, you should expect it to take anything between 4-8 hrs, because you may do mistakes, and you'll need to start it all over again.

Also, it would help you a lot if you could find tutorials on how to do this. In this way, you may get it done correctly from your first attempt, and save time.

Moving Wordpress from an Apache server to an Nginx server will take you an hour or less, depending on how large your WP site is. Wordpress does not need any specific configuration to run on Apache or Nginx. You just move it from Apache to Nginx, and it works fine all by itself.

Yes, it's longer to configure your own LAMP / LEMP environment than setting up on a hosting panel. Also, keep in mind that you need to secure the server which you configured from scratch, set the right access ports, put a firewall, and then keep the server up-to-date once every few months, otherwise it can get hacked easily. That adds to the whole work time, too.
 

David Beroff

Well-known member
Joined
Jun 14, 2016
Messages
948
Best answers
0
Ratings
75 1
Points
28
#4
Joined
Mar 17, 2017
Messages
60
Best answers
0
Ratings
2
Points
0
#5
Hello,
If you are migrating data from one server to another then downtime will be negligible and for it you need to transfer data (public_html contents , ssl certificates , database dump) but if you want to change webserver on existing sites then it may bring some downtime as the various things configured on apache will needed to be configured on nginx which may take some time.
 
Joined
Apr 5, 2017
Messages
56
Best answers
0
Points
0
#6
StackArcVPS
Can u elaborate with steps on how to do that on centos 6? I want to change my web server of the site already existing on apache to nginx ( on the same server )
 

rankmyhub

Well-known member
Joined
Feb 14, 2017
Messages
191
Best answers
0
Ratings
18
Points
0
#7
Websites can be migrated from one server to the other without any downtime or less downtime, provided that you know what you are doing. We migrate with zero downtime, as we have been doing things since a long time.

1st thing you need to do is to setup you Nginx properly, as rewrite rules work in a different way in Nginx, so if you are a beginner, you must read nginx docs and other stuff, before you do emulation.

After configuring nginx, you should copy the files to new server that includes db as well as wp files. Then use this https://github.com/tg123/chrome-hostadmin

Firefox plugin and you can emulate the website and test if everything is working or not, without doing any dns changes, this is the same procedure we do at rankmyhub. I should not share our tricks, but i thought to help you.

So emulation is best part, you know if things are working or not without making dns changes to original live site. After testing that everything is working fine, you will reduce the TTL at source server records and then do the migration by doing the final step i.e., DNS changes and done.

All the best with migration, also install another firefox addon to flush your computer or laptop dns. Helpful if you do not know how to flush dns manually.

Thanks
 

Hostpad

Well-known member
Joined
Apr 27, 2017
Messages
97
Best answers
0
Ratings
3
Points
8
#10
Here is the solution you need,
Keep old server untouched
Set up new server with nginx server with database applocation, php , phpmyadmin etc
Set up nginx configuration for wordpress like url rewriting
Take back up your all file in old server
Move them to new server
Move database to new server
Now change the ip of our main domain & www of main domain, this will give less downtime & your data will not be lost.
 
Joined
Jan 27, 2017
Messages
47
Best answers
0
Points
0
#12
It will be difficult to replace the web server only, I mean Apache to nginx. Better to get another VPS & configure nginx there & then move your files, databases & so on !
 

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top