NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (2023)

Datum: | Internet

NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (1)

Das Internet, so wie wir es heute kennen, startete seinen Eroberungsfeldzug Anfang der 90iger Jahre. Am 20. September 1990 ging am Genfer Kernforschungszentrum CERN die erste Webseite der Welt online und läutete gleichzeitig auch die Geburtsstunde des World Wide Web ein. Webseiten sind im Prinzip nichts anderes als HTML-Dokumente. Um den Besuchern mehrere unterschiedliche Webseiten zur Verfügung stellen zu können, benötigt der Host eine Server-Software. Diese verarbeitet die Anfragen und analysiert sie um anschließend die angeforderten Dokumente im Browser zurückzuliefern. Zwei der beliebtesten Programme dieser Art sind NGINX und Apache. In diesem Vergleich stellen wir Ihnen die beiden Webserver samt Ihrer Features im Detail vor und zeigen, welcher davon sich besser für welche Zwecke eignet.

Worin unterscheidet sich ein Webserver von einem Application-Server?

Die Aufgabe eines Webservers ist es, eine Verbindung zwischen einem physischen bzw. einem Cloud-Server und den gespeicherten Webseiten (respektive den Browsern) der Internet-Nutzer herzustellen. Der Application-Server ist hingegen dafür zuständig, Anwendungen innerhalb eines Netzwerks zur Verfügung zu stellen.

Eignen sich sowohl NGINX als auch der Apache Webserver für die Bearbeitung von dynamischen Anfragen?

Nein, im Gegensatz zum Apache Webserver unterstützt NGINX nur das Ausliefern von statischen Inhalten. Dynamischer Content wird hingegen an eine andere Software weitergegeben.

Lassen sich die beiden Webserver auch im Verbund nutzen?

Ja, das funktioniert sogar ausgesprochen gut. In der Praxis findet man überwiegend die Kombination NGINX als Reverse Proxy und einen oder mehrere Apache Server im Backend.

Inhalt

  • 1. Apache: Populärer Flexibilist
    • 1.1. Module erweitern die Funktionalität des Webservers
    • 1.2. NGINX vs Apache: Das Leid mit der Performance
  • 2. NGINX: Performantes Leichtgewicht
    • 2.1. Dynamische Inhalte werden nicht unterstützt
  • 3. NGINX und Apache als Verbund
  • 4. Fazit: Apache oder NGINX?

1. Apache: Populärer Flexibilist

Der Open-Source-Webserver Apache ist bereits seit 1995 auf dem Markt vertreten und laut w3techs.com der am weitesten verbreitete Webserver überhaupt. Aufgrund seiner langen Geschichte, der umfangreichen Dokumentation und den flexiblen Einsatzmöglichkeiten ist der Webserver bei Administratoren sehr beliebt. Der enorme Marktanteil ist aber in erster Linie auch darauf zurückzuführen, dass viele Systeme (z.B. CMS) von Haus aus mit Apache funktionieren. Zudem ist dieser auf allen wichtigen Linux-Distributionen wie Red Hat, CentOS oder Ubuntu bereits vorinstalliert.

Gut zu wissen: Seit 1999 übernimmt die Apache Software Foundation die Weiterentwicklung des Web-Servers.

Die Konfiguration des Apache-Webservers wird mithilfe einer .htaccess-Datei durchgeführt. Diese gestattet eine hohe Flexibilität bei der Bearbeitung eingehender Anfragen. So können beispielsweise Speicherlimits und Datei-Upload-Beschränkungen definieren, Umleitungsregeln oder einen Verzeichnisschutz (htpasswd) einrichten oder diverse Sicherheits-Einstellungen für den Umgang mit Cookies vornehmen.

Einer der größten Vorteile von Apache ist aber sicherlich, dass Sie jeder Ebene bzw. jedem Verzeichnis im Baum eine eigene .htaccess-Datei mit einer individuellen Konfiguration zuweisen können. Das erlaubt es beispielsweise Shared-Hosting-Providern, Ihren Kunden auf ein und derselben Maschine eine Konfigurationsmöglichkeit für Ihre Website anbieten zu können, ohne die anderen Nutzer dadurch zu beeinträchtigten. Nimmt ein Nutzer eine Einstellung für seine dedizierte Umgebung vor, bleibt die globale Serverkonfiguration davon unberührt.

1.1. Module erweitern die Funktionalität des Webservers

Dank des dynamischen Modulsystems (das es in der Form auch in NGINX gibt) lässt sich die Funktionalität von Apache zusätzlich erweitern. Die Module können Sie auch dann noch installieren, wenn Sie den Apache Webserver bereit aufgesetzt und in Betrieb genommen haben, und sie bei Bedarf aktivieren oder deaktivieren. Eine offizielle Liste aller Module, die Bestandteil der Apache-Standard-Distribution sind, finden Sie hier.

Tipp: In Debian-basierten Linux-Distributionen können die Module ohne Bearbeitung der Konfigurationsdateien über die Befehle a2enmod und a2dismod aktiviert bzw. deaktiviert werden.

1.2. NGINX vs Apache: Das Leid mit der Performance

NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (2)

Der Apache-Webserver wurde im Laufe der Zeit stetig verbessert und in seiner Leistung optimiert. An die Performance-Benchmark von NGINX kommt er aber bei Weitem nicht heran.

Eine große Schwachstelle von Apache ist die Performance. Denn während der Webserver bei kleineren Webseiten noch zuverlässig und stabil läuft, gerät er mit zunehmender Zahl gleichzeitiger Anfragen regelmäßig ins Straucheln. Das liegt vor allem daran, dass für jede offene Verbindung zum Webserver ein eigener Prozess gestartet wird, der Arbeitsspeicher beansprucht. Dadurch entstehen bei hunderten oder tausenden parallelen Anfragen logischerweise ebenso viele Prozesse. Diese erhöhen die Ladezeiten der Seiten drastisch und können schlimmstenfalls sogar zu einem kompletten Stillstand das Webservers führen können.

Der Apache-Webserver wurde im Laufe der Zeit stetig verbessert und in seiner Leistung optimiert. Mit einem NGINX „Out-of-the-Box“ kann er aber dennoch nicht mithalten.

2. NGINX: Performantes Leichtgewicht

NGINX wurde erst 2004 veröffentlicht und von Anfang an mit Fokus auf Performance, den Core-Server und die Proxy-Funktionen entwickelt. Der Webserver bietet vor allem auf limitierten Systemen entscheidende Vorteile gegenüber Apache, denn er setzt im Gegensatz dazu auf eine asynchrone, eventbasierte Architektur. Das bedeutet, dass nicht für jede Verbindung ein separater Prozess gestartet wird, sondern pro Prozess sogar mehrere tausend Verbindungen abgehandelt werden können. Auf diese Weise ist NGINX in der Lage, eine hohe Anzahl gleichzeitiger Anfragen zu bedienen, ohne dabei an Geschwindigkeit und Stabilität einzubüßen. Der Ressourcenverbrauch bleibt auch bei Lastspitzen relativ konstant, wodurch performanceintensive Seiten mit einer großen Anzahl von Zugriffen auch mit begrenzter Hardware (z.B. auf einem Raspberry Pi) ausgeliefert werden.

2.1. Dynamische Inhalte werden nicht unterstützt

Auch NGINX lässt sich durch Module erweitern. Diese müssen allerdings in das System kompiliert werden, da ein dynamischen Laden wie bei Apache nicht möglich ist. Außerdem unterstützt NGINX im Gegensatz zu Apache nur das Ausliefern statischer Inhalte, wie beispielsweise Bilder, CSS-Stylesheets oder JavaScript und bietet auch keine Möglichkeit, entsprechende Interpreter durch Module einzubinden. Für dynamischen Content (z.B. PHP-, Python oder Perl-Scripts) wird die Anfragen an eine anderen Software weitergegeben (also im Fall von PHP an den entsprechenden Interpreter).

Darüber hinaus werden auch keine Konfigurations-Anpassungen auf Verzeichnisebene (durch .htaccess) unterstützt, wodurch sich die Einrichtung eines NGINX Webserver generell etwas aufwändiger gestaltet als bei Apache. Das spielt allerdings nur dann eine Rolle, wenn Sie sich im Detail mit der Server-Administration auseinandersetzen möchten. Bei Hosting-Anbietern, die NGINX im Portfolio haben, gibt es für gängige Aufgaben in der Regel aber die passenden Module.

3. NGINX und Apache als Verbund

NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (3)

Speziell im WordPress-Umfeld findet man auch sehr häufig die Kombination aus einem NGINX-Reverse-Proxy und einem oder mehreren Apache-Backend-Servern.

Um von den Vorteilen beider Welten zu profitieren, können Sie NGINX und Apache auch in Kombination verwenden. Während NGINX sich beispielsweise besonders gut als Reverse Proxy eignet, kommt der Apache aufgrund seines Umgangs dynamischen Inhalten vornehmlich als Backend-Server zum Einsatz.

In der Praxis schaltet man dazu den NGINX-Server vor einen oder (als Loadbalancer) mehrere Apache-Server. Die eingehenden Verbindungen gehen also erst einmal an den NGINX, der sich um die Auslieferung der statischen Inhalte kümmert. Für dynamischen Content wird die Anfrage hingegen an den Apache-Server weitergereicht, der in diesem Zusammenhang auch auf seine .htaccess-Datei zurückgreifen kann.

4. Fazit: Apache oder NGINX?

Die Frage, welcher Webserver nun der bessere ist, lässt sich pauschal nicht beantworten. Denn während NGINX Apache in Sachen Performance meilenweit den Rang abläuft, hat dieser in Bezug auf den Umgang mit dynamischen Inhalten die Nase vorne. Die Entscheidung hängt also letztendlich auch immer von den individuellen Anforderungen Ihres Web-Projektes ab. In der Praxis setzen auch viele Anwender auf einen Verbund, um von den Stärken beider Webserver zu profitieren.

Gut zu wissen: Die Internet-Community "Stack Overflow" ist eine gute Anlaufstelle für Entwickler und Administratoren. Denn dort finden Sie nicht nur Antworten auf die meisten Fragen zum Thema Webserver, sondern auch zahlreiche Anleitungen, Tutorials und Support-Hinweise in Bezug auf die Einrichtung und den Umgang mit Apache, NGINX und deren Alternativen. Dazu zählen beispielsweise der freie Webserver Lighttpd oder der Open Source-HTTP / 2-fähige Caddy.

Vor- und Nachteile der beiden Webserver finden Sie auch noch einmal im folgenden Video zusammengefasst:

30 Bewertungen

NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (4)NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (5)NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (6)NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (7)NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (8) Ø 4,30
NGINX vs Apache: Die beliebten Webserver im Vergleich - WinTotal.de (9)Loading...

FAQs

Which web server is better Apache or NGINX? ›

The main difference between NGINX and Apache web servers is that NGINX has event-driven architecture handling multiple requests within a single thread, while Apache is process-driven creating a thread per each request. Thus, allowing NGINX to have generally better performance.

Is Apache or NGINX easier to use? ›

Unlike Apache, however, NGINX has a somewhat simpler configuration system. Some of the functionality that would have to be added to an Apache installation using modules is included in NGINX by default, which means that there is less setup for admins to perform.

When to use NGINX instead of Apache? ›

The major difference between the two is how they handle the client request. While Apache provides a different variety of multiprocessing modules to handle client requests and web traffic, Nginx is so designed to handle multiple client requests simultaneously with minimal hardware resources.

What is the advantage of NGINX over Apache? ›

Nginx has since surpassed Apache in popularity due to its lightweight footprint and its ability to scale easily on minimal hardware. Nginx excels at serving static content quickly, has its own robust module system, and can proxy dynamic requests off to other software as needed.

Does Netflix still use NGINX? ›

A Netflix OCA serves large media files using NGINX via the asynchronous sendfile() system call.

Which web server is fastest? ›

Fastest web hosting companies (based on real test data)
  • Namecheap.
  • Cloudways.
  • Hostinger.
  • Liquid Web.
  • Pressable.
  • IONOS.
  • GreenGeeks.
  • SiteGround.
Jan 8, 2023

Is NGINX faster than Apache? ›

It performs 2.5 times faster than Apache according to a benchmark test running up to 1,000 simultaneous connections. Nginx serves the static resources without PHP having to know about this. On the other hand, Apache handles all those requests with that costly overhead.

Does Facebook use Apache or NGINX? ›

WP Engine - We use Nginx and Apache at WP Engine, but we... | Facebook.

Can I run Apache and NGINX at the same time? ›

The most important thing we take from this simple configuration is that Apache and Nginx can and do work together. A problem may arise when they both listen to the same ports. By giving them different ports to listen to, your system functionality is assured.

Does Google use NGINX? ›

NGINX Plus is available on the Google Cloud Platform. Use NGINX Plus as a cloud load balancer, content cache, web server, & secure gateway in one package.

Why do people use NGINX? ›

Because it can handle a high volume of connections, NGINX is commonly used as a reverse proxy and load balancer to manage incoming traffic and distribute it to slower upstream servers – anything from legacy database servers to microservices.

Does NGINX improve performance? ›

Nginx is already one of the fastest web servers, but there are still ways to improve it. You can make it an even more efficient web server that can handle high-traffic loads without using too many resources by tweaking a few settings.

Does Microsoft use NGINX? ›

This announcement is the result of a close collaboration between Microsoft and F5 the company behind the open-source solution Nginx. The NGINX for Azure offering enables a seamless and modern approach to application delivery in the cloud, powered by the Azure native integration of the Nginx SaaS solution.

Is there anything better than NGINX? ›

HAProxy, lighttpd, Traefik, Caddy, and Envoy are the most popular alternatives and competitors to NGINX.

What is faster than NGINX? ›

Conclusion – LiteSpeed Found to be More Impressive than NGINX. In all, we used numerous LiteSpeed vs NGINX benchmarking tests, and LiteSpeed performed to a higher standard than NGINX. Files were transferred faster and less CPU & memory were used.

How do I know if I am using NGINX or Apache? ›

How to Check If You're Running Nginx or Apache. On most websites, you can simply check the server HTTP header to see if it says Nginx or Apache. You can see HTTP headers by launching the network tab in Chrome Devtools. Or you can check headers in a tool like Pingdom or GTmetrix.

Does Netflix use Apache? ›

Apache Kafka is an open-source streaming platform that enables the development of applications that ingest a high volume of real-time data. It was originally built by the geniuses at LinkedIn and is now used at Netflix, Pinterest and Airbnb to name a few.

Is NGINX from Russia? ›

The sale to an American company this year of Nginx, a Russian company that developed web server software now used by more than a third of the world's websites, sent a clear message that Russian programmers can create valuable products for the global market.

Which web server is mostly used? ›

Nginx and Apache are undoubtedly the two most used web servers worldwide. Each of them holds about a third of the market. According to W3Techs' data, Nginx holds about 34.2% of the market and Apache about 31.2% — 28.9% and 22.6% respectively according to Netcraft's data.

Which server is best for website? ›

8 Best Web Servers for Windows and Linux
  1. Apache. Apache is the second most popular web server software, used by 31.5 percent of all known websites. ...
  2. Tomcat. Tomcat is one of the best web server software options for Java applications. ...
  3. NGINX. ...
  4. LiteSpeed. ...
  5. CentOS Stream. ...
  6. Caddy. ...
  7. Lighttpd. ...
  8. Microsoft IIS.
Jul 13, 2022

Which hosting is best for high traffic? ›

5 Best Hosting for High Traffic WordPress Sites in 2023?
  • Kinsta. ✓ Free SSL, CDN & Staging. ✓ Free website migration. ...
  • Nestify. ✓ Unlimited visitors and sites. ✓ Free website migration. ...
  • Cloudways. ✓ Flexible Hosting plans. ✓ User-friendly dashboard. ...
  • Pagely. ✓ Free SSL & Staging environments. ...
  • WordPress VIP.
Dec 16, 2022

How can I speed up NGINX? ›

NGINX Performance Tuning Tips
  1. Adjust NGINX's Worker Processes. ...
  2. Modifying the Number of Worker Connections. ...
  3. Compressing Content to Boost Delivery Time. ...
  4. Static Content Caching. ...
  5. Adjusting the Buffer Size. ...
  6. Enable Log Buffering. ...
  7. Putting a Limit on Timeout Values. ...
  8. File Cache Opening.
Dec 20, 2022

What is the practical difference between NGINX and Apache? ›

NGINX has a single-threaded architecture where multiple client requests are handled in a single thread. On the other hand, Apache has a multi-threaded architecture where one process is created for a request. The event-driven architecture of NGINX ensures better performance even under heavy traffic.

Do people still use Apache? ›

Yes, and right out of the box. Most web hosting companies will default to Apache as the main web server software. Some may offer additional options, but due to the ease of use, popularity, and resources available, most WordPress sites stick with Apache.

Does Facebook still use Apache? ›

It's open source, very customizable, and good for security. Facebook runs the Linux operating system on Apache HTTP Servers.

Does Facebook use NGINX? ›

That's just a fraction of what Nginx is doing. The server technology powers the websites of some of the most well-known brands online. Think the busiest site on the planet: Facebook. And WordPress.

Which web server does Facebook use? ›

Facebook uses Linux, but has optimized it for its own purposes (especially in terms of network throughput). Facebook uses MySQL, but primarily as a key-value persistent storage, moving joins and logic onto the web servers since optimizations are easier to perform there (on the “other side” of the Memcached layer).

Can NGINX run multiple websites? ›

If you are using a dedicated server / VPS and want to host multiple applications on a separate domain and a single server then you will need to host multiple websites on a single server. You can achieve this with Apache / Nginx virtual hosting. Virtual hosting allows you to use a single VPS to host all your domains.

How to use both Apache and NGINX? ›

Here is the answer how to have both Apache and NGINX installed on the same 80 port (on localhost).
  1. Select different IP addresses for each one. Let's setup the hosts file for quick access to start pages. ...
  2. Setup listen IP and port for NGINX. NGINX must listen on one IP address only. ...
  3. Setup listen IP and port for Apache.
Apr 12, 2014

How many simultaneous connections can NGINX handle? ›

NGINX can handle a maximum of 512 concurrent connections. In newer versions, NGINX supports up to 1024 concurrent connections, by default.

Does Google use NGINX or Apache? ›

In May, 2015, GWS was ranked as the fourth most popular web server on the internet after Apache, nginx and Microsoft IIS, powering an estimated 7.95% of active websites.
...
Google Web Server.
Developer(s)Google
LicenseProprietary
5 more rows

How much RAM does NGINX need? ›

The following minimum hardware specifications are required for each node running NGINX Controller: RAM: 8 GB RAM. CPU: 8-Core CPU @ 2.40 GHz or similar.

What websites use NGINX? ›

NGINX powers several high-visibility sites, such as Netflix, Hulu, Pinterest, CloudFlare, Airbnb, WordPress.com, GitHub, SoundCloud, Zynga, Eventbrite, Zappos, Media Temple, Heroku, RightScale, Engine Yard, StackPath, CDN77 and many others.

How secure is NGINX? ›

nginx's core codebase (memory management, socket handling, etc) is very secure and stable, though vulnerabilities in the main binary itself do pop up from time to time. For this reason it's very important to keep nginx up-to-date.

How many threads can NGINX handle? ›

Each NGINX worker can handle a maximum of 512 concurrent connections.

Can Kubernetes replace NGINX? ›

Is NGINX Kubernetes Gateway Going to Replace NGINX Ingress Controller? NGINX Kubernetes Gateway is not replacing NGINX Ingress Controller. Rather, it is an emerging technology based on the alpha release of the Gateway API specification and is intended for evaluation purposes only – it is not for use in production.

Why is NGINX so fast? ›

NGINX handles requests asynchronously with event-driven architecture. NGINX was made to utilize a non-blocking, event-driven handling algorithm, so it can accommodate potentially thousands of connection requests at the same time, in one processing thread. It can also work quickly regardless of resources being minimal.

Does NGINX use TCP or UDP? ›

In NGINX Plus Release 5 and later, NGINX Plus can proxy and load balance Transmission Control Protocol) (TCP) traffic. TCP is the protocol for many popular applications and services, such as LDAP, MySQL, and RTMP. In NGINX Plus Release 9 and later, NGINX Plus can proxy and load balance UDP traffic.

Can NGINX be hacked? ›

NGINX has always been a target for hackers/bug bounty hunters due to a lot of misconfigurations in it, and as a security researcher/bug bounty hunter, hacking a web server always fascinates us.

Is NGINX a good load balancer? ›

Nginx is powerful yet relatively simple to set up to load balance web server. Together with an easy encryption solution, such as Let's Encrypt client, it makes for a great front-end to your web farm.

Is NGINX better than Tomcat? ›

In terms of Performance, Nginx is far better than Apache Tomcat. It can handle multiple requests of both the static and dynamic content concurrently with using the least memory.

Which server is best to use as a web server? ›

8 Best Web Servers for Windows and Linux
  1. Apache. Apache is the second most popular web server software, used by 31.5 percent of all known websites. ...
  2. Tomcat. Tomcat is one of the best web server software options for Java applications. ...
  3. NGINX. ...
  4. LiteSpeed. ...
  5. CentOS Stream. ...
  6. Caddy. ...
  7. Lighttpd. ...
  8. Microsoft IIS.
Jul 13, 2022

Is NGINX the most used web server? ›

Many high-visibility websites and applications, such as Netflix or Pinterest, use the Nginx web server. As of September 2022, Nginx holds 34.2% of the market according to W3Techs and 28.9% according to Netcraft.
...
Stable releases.
Nginx stable releasesRelease date
Nginx 1.20.xApril 2021
Nginx 1.22.xMay 2022
14 more rows
Sep 5, 2022

Is NGINX faster than Apache Wordpress? ›

Apache and NGINX are the most popular web server software options. But in the battle between NGINX vs Apache, which one comes out on top? While they are similar in many ways, the NGINX server does provide better performance for high-traffic websites.

Which is better Tomcat or NGINX? ›

In terms of Performance, Nginx is far better than Apache Tomcat. It can handle multiple requests of both the static and dynamic content concurrently with using the least memory.

Do hackers use web server? ›

So hackers attack on the web server to steal credential information, passwords, and business information by using DoS (DDos) attacks, SYN flood, ping flood, port scan, sniffing attacks, and social engineering attacks.

Which webserver is used by Google? ›

Google Web Server (GWS) is proprietary web server software that Google uses for its web infrastructure. GWS is used exclusively inside Google's ecosystem for website hosting.

Which country server is best for web hosting? ›

Top 100 countries
Ranking 2013CountrySites
1United States421,228
2Germany70,587
3China35,908
4United Kingdom35,500
96 more rows
Mar 14, 2013

How much faster is NGINX than Apache? ›

In terms of performance, NGINX is much better than Apache. NGINX performs 2.5 times faster than Apache — and consumes less memory as well. However, Apache has more functionality and features.

Do companies use NGINX? ›

NGINX powers several high-visibility sites, such as Netflix, Hulu, Pinterest, CloudFlare, Airbnb, WordPress.com, GitHub, SoundCloud, Zynga, Eventbrite, Zappos, Media Temple, Heroku, RightScale, Engine Yard, StackPath, CDN77 and many others.

Top Articles
Latest Posts
Article information

Author: Aracelis Kilback

Last Updated: 08/02/2023

Views: 6220

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Aracelis Kilback

Birthday: 1994-11-22

Address: Apt. 895 30151 Green Plain, Lake Mariela, RI 98141

Phone: +5992291857476

Job: Legal Officer

Hobby: LARPing, role-playing games, Slacklining, Reading, Inline skating, Brazilian jiu-jitsu, Dance

Introduction: My name is Aracelis Kilback, I am a nice, gentle, agreeable, joyous, attractive, combative, gifted person who loves writing and wants to share my knowledge and understanding with you.