Migrate Wordpress site from Apache to Nginx?

StackArcVPS

Member
Registered
Hosting Provider
Joined
Apr 5, 2017
Messages
56
Points
0
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

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
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
Registered
Joined
Apr 11, 2017
Messages
161
Points
18
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.
 

miken

Member
Registered
Joined
Feb 6, 2015
Messages
61
Points
8
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
Registered
Joined
Apr 11, 2017
Messages
161
Points
18
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
Registered
Joined
Apr 15, 2016
Messages
612
Points
28
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
Registered
Joined
Apr 11, 2017
Messages
161
Points
18
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
Registered
Joined
Jun 14, 2016
Messages
1,477
Points
63

iserveradmin11

Member
Registered
Joined
Mar 17, 2017
Messages
60
Points
8
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.
 

StackArcVPS

Member
Registered
Hosting Provider
Joined
Apr 5, 2017
Messages
56
Points
0
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
Registered
Joined
Feb 14, 2017
Messages
193
Points
18
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
Registered
Hosting Provider
Joined
Apr 27, 2017
Messages
97
Points
8
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.
 

David Beroff

Well-known member
Registered
Joined
Jun 14, 2016
Messages
1,477
Points
63
David Beroff
Your steps are right to migrate Wordpress site from Apache to Nginx, even if you are using a DNS service as Cloudflare
you will not get any downtime for your site :)
 

Mahfuz

Member
Registered
Joined
Jan 27, 2017
Messages
47
Points
0
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 !
 
Recommended Threads
Replies
5
Views
2,626
jwn
Replies
6
Views
2,602
Replies
20
Views
7,148
Replies
4
Views
1,318
fwh
Replies
0
Views
2,644
Similar Threads

Latest Hosting OffersNew Reviews

Sponsors

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