Here is a checklist for those who want to unlock speed by migrating from Apache to Nginx on Cloud Server but have lesser technical knowledge. Nginx initially will appear scary but actually it is easy to use. This checklist really is not intended for comparing performance for the transition from Apache to Nginx on Cloud Platform. This is kind of more practical guide for those who are used with Apache WebServer Software.
Apache to Nginx on Cloud : Our Previous Tutorials and Articles on This Aspect
Nginx sucks lesser resources never means that you will use an underpowered server. We are taking that the reader will move / install WordPress, Joomla or Magento like PHP – MySQL based web software. We have talked about Shifting WordPress From Apache to nginx Web Server, Reasons to Switch to Nginx From Apache on Cloud Server and obviously lot of articles on setup of Nginx for WordPress, tweaks etc.
Basic problem becomes, as a longterm apache2 user => understanding the practical operative functions. This checklist will ensure that your setup and effort does not go on wastage list.
---
Apache to Nginx on Cloud : Checklist
The reader can have a dev setup or before dev setup can make sure about the points we are mentioning. You can perform a search on our website or on Google – does not matter.
- We usually advice to have a two have a two server setup. This is true for both Nginx and Apache. Most importantly, you can actually run three servers – connect Nginx with the constant Application Server (= database server). This will ensure a way to escape plus on Cloud, this is a standard for scalability.
- We think, it is better to use InnoDB Engine for MySQL. Application Server, theoretically should be better performer – all textual data actually are on the Application Server. Nginx can not help much with a slowwwww application server.
- We usually install PHP5-FPM for Nginx. There is difference between installing Nginx with
apt-get install nginx
and building Nginx. A huge difference of Nginx with Apache is that, you simply can not activate amodule
later without shutting down the web server. - So, from the third point you should do a research on what components/modules you’ll run. You can not add Google Page Speed later on Nginx, for example. Those who of us wants higher performance, we use LuaJIT and asynchronously serve the pages. There might be point of compromise for your technical knowledge.
- There is no .htaccess file on Nginx – Nginx supports Pretty Permalinks practically by default.
- There are practically two files for Nginx part –
/etc/nginx/sites-available/default
is like vHost file, which you used various commands to activate a new domain on Apache, the top configuration file isnginx.conf
. A simplelocate nginx.conf
will point out the location – usually/etc/nginx/nginx.conf
- We usually do the tweaks or torture on
/etc/nginx/sites-available/default
and run the commandnginx -t
to check for error. Then just restarting nginx activates the function. - Varnish is usually not required if you configure
PHP5-FPM
caching rightly - There are huge manual works for Nginx to optimize than Apache
- There are lesser documentation and guides on Ngnix than Apache
- Except you, others might not tell you which file, where is creating the problem related to PHP – because it depends on you have build it, tweaked it
PHP5-FPM
needs to be restarted separately by default for clearing any cache, activating PHP related tweak- On Nginx, possibly you’ll never require a soft reboot. It is not that with Apache2 we are forced to soft reboot everyday, but Apache modules can create situation when even you can not even do a SSH, you have to hard reboot from control panel. It is risky. By default Apache2 has lot of modules activated which possibly we never use. If the RAM is on bargain and hundreds, thousands of requests are arriving, Apache will die. The reasons, need of using Nginx is different. Apache2, again is the standard for many web softwares in production website.
- Despite hundreds of complains against Apache, for a beginner, possibly Apache is still great.
- Default public directory of Nginx is
/usr/share/nginx/html
for Debian and Ubuntu apt version. We do not think a beginner needs to change it to/var/www/
; accept the norm, your minute mistake on permission can put security on challenge. - Suppose you want to enable SSL on Nginx, once you have learnt the way, its like a snap. Just place the certs, modify the
/etc/nginx/sites-available/default
, runnginx -t
, if goes right runservice nginx restart
if not right, Nginx will tell you quite nicely. Apache2 usually throws scary log checking advice. - You might have to learn Lua, XCache settings for optimal performance
- Things we wrote – Nginx + PHP5-FPM + LuaJIT is used by many bigger giants because configuring might go difficult
- Some WordPress Plugins do not understand Nginx, very few and mostly uncommon. WP Super Cache poorly supports Nginx. You’ll have to manually write the rules for W3 Total Cache, WordPress SEO plugins for sitemap unlike Apache2.
- It can be tad hard to implement a peculiar logic on Nginx.
.htaccess
is very easy but actually.htaccess
is a shortcut to the required changes to the main configuration file. - Google, possibly will crawl your website more with Nginx, SPDY and IP6 support. Reason is not Google’s love, but excellent warranted page serving by Nginx
- We do not think, Nginx will ever be used for mass Shared Servers. From a point of SEO – you are probably telling Google – its one IP, one server.
- Nginx can be pathetic for subdirectory installation of the same software (like WordPress) depending on the way of configuration.