Continuing here with point 6 and if you missed previous part you can Read Previous Part -1 Here
- 6. Flexibility
- 7. Modules Support
- 8. Content specific Difference(Static/dynamic)
- 9. Architectural Approach(Distributed/Centralized)
- 10. File vs URI-Based Interpretation
In the matter of flexibility, Apache is much ahead of Nginx because Apache is much more flexible than Nginx because changes to the web servers can be made by writing modules and Apache supports dynamic module loading from a long time.
Well from 2016 Nginx also support dynamic loading of modules but previously NGINX required the to compile the modules into the NGINX binary. But still, there are many modules which do not support dynamic loading.
7. Modules Support (Dynamic)
It has been a long time when both of the web servers were launched and wit the time there are lots of development and as a result, Both Apache and NGINX do have a good number of module and increase of feature every day.
Modules For Apache:
- Apache documentation website have a complete list of its Modules and its features
- List of Apache Modules on Wikipedia
But with the time and open source, Apache don’t have any well maintained third party module library. But As Apache is the king so we can expect this in near future very soon
Modules For Nginx:
- NGINX documentation website have a complete list of its Modules and its features
- Third-Party Modules
Well, till now Apache and Nginx are working with almost same functionality like as a proxy server, cache server, or as a load balancer. As I said Both are good but Nginx has a plus point because it can work as a reverse proxy for TCP connections and email eg SMTP, IMAP, POP3.
8. Static vs Dynamic Content
Now here comes the comparison on the basis of dynamic and static content and for these web servers.
Apache is a traditional server and it uses the file-based method, basically, we can say it’s a function of MPM method describes in PART – 1.
Apache has the capability to process dynamic content when the processor of the dynamic language is embedded into its worker instances. Now Apache works smooth and fast because the processors are Native. Also, its capacity to process dynamic content can be extended with loading dynamic modules like mod_php.
Like Apache, Nginx does not process any dynamic content natively. Now if Nginx has to process any PHP request or needs to handle other dynamic content then Nginx pass its request to an external processor and wait for its execution and result.
Now if Nginx has to process any dynamic content that it should be configured to communicate its process like PHP-FPM over several protocols and its should know how to coordinate with HTTP, FastCGI, SCGI, uWSGI or Memcache). These connection and communication are a bit complicated in comparison with Apache.
Anyway, drawback works in favor of Nginx because there are only pages then it is super fast in generating the response to the users.
9. Distributed vs Centralized Configuration
When a server administrator needs to configure a web server then sometimes it required to set a global configuration and som times directory level configuration is required.
To achieve per-directory level additional configuration apart from global apache configuration. These additional directive are are given in a hidden file called
These files are written in a specific format and kept in the desired location. When a web server hit that directory it read additional and make a decentralized approach. These
.htaccess are often used for implementing URL rewrites, access restrictions, authorization, and authentication, even caching policies.
When .htaccess files are found there is no reload of the web server and got implemented instantly. Also, its allows a non-privileged user to allow access to the content he owns or allowed to change without compromising other content on the web server.
With this feature, CMS is in shape and all shared hosting are running with the help of the same feature, which keeps configuration safe and controls directory user wise.
Here Apace look bigger and heavier than Nginx because NGINX neither support
.htaccess, nor it does have any mechanism to do the same outside of its configuration file like Apache. But because of this Nginx have little advantages.
First, its works fast than Apache because it does not have to read any extra configure like Apache. Second, the advantage is security because in distributed directory level configuration access is distributed and security every user is responsible for its data and directory.
10. File vs URI-Based Interpretation
How the web server interprets requests and maps them to actual resources on the system is another area where these two servers differ.
Apache provides the ability to interpret a request for a physical resource on the filesystem or as a URI location that may need a more abstract evaluation. In general, for the former Apache uses
<Files> blocks, while it utilizes
<Location> blocks for more abstract resources.
Nginx was created to be both a web server and a proxy server. Due to the architecture required for these two roles, it works primarily with URIs, translating to the filesystem when necessary.
This can be seen in some of the ways that Nginx configuration files are constructed and interpreted.Nginx does not provide a mechanism for specifying configuration for a filesystem directory and instead parses the URI itself.