- Part One Chapter 04 – Optimize Web Servers
Part One Chapter 04
Whenever you have a choice, you should always choose the web server (i.e. software) that can enable your web pages to load with optimal speed.
Assume the choice of your operating system is Linux, and your web server options may be Apache, or Nginx.
Apache is open source web server and is free. It is the mostly used web server in the world since its first release in 1996.
- Apache is easy to install and configure. For configuration, it has large amount of free documentation online.
- PHP runs slower on Apache than on Nginx.
Nginx is an open source web server and is free. The official release was in 2004.
- PHP runs faster on Nginx than on Apache.
- Normally, a Nginx web server uses less resources and can handle much more web traffic than Apache and any other web servers. This improvement of Nginx over Apache fits the modern web requirement of being able to handle 10,000+ concurrent connections.
Nginx vs. Apache
Obviously, Nginx is a better choice than Apace in terms of speed optimization.
- If you are starting a new mobile website, you should use Nginx as the web server.
- If your current mobile website is already on Apache, consider changing to Nginx.
|Server Response Time||Average||Better|
|Server Response Time (if running PHP)||Average||Better|
In short, if you are hosting your personal website which has minimal web traffic, Apache will be sufficient. If you are hosting an ecommerce website that will scale up to 10,000+ concurrent connections (i.e. users at the same time), then Apache may not be good enough and you should go for Nginx.
Upgrade to the Latest Versions
An example is you are likely to be using some web frameworks or database servers for your mobile website.
- Assume PHP is installed and running on the web server, make sure you always upgrade PHP to the latest version.
- Assume MySQL Server is installed and running on the web server, make sure you always upgrade the MySQL database to the latest version.
Gordon Choi's Mobile Website Book has been available since November 2016.
Content on Gordon Choi's Mobile Website Book is licensed under the CC Attribution-Noncommercial 4.0 International license.