Which Web Server Is Being Used Ubuntu?

//

Scott Campbell

Are you curious about which web server is being used on your Ubuntu system? In this tutorial, we will explore different ways to determine the web server running on your Ubuntu machine. Let’s dive in!

Method 1: Using the Command Line

If you prefer using the command line, there are a few simple commands that can help you identify the web server. Open a terminal on your Ubuntu system and try the following:

  • Apache: Use the command apache2ctl -v or apache2 -v. If Apache is installed, it will display its version information.
  • Nginx: Execute nginx -v.

    If Nginx is installed, it will show its version.

  • Lighttpd: Type lighttpd -v. If Lighttpd is installed, it will display its version and other details.

Method 2: Checking Listening Ports

The web server software listens on specific ports to serve requests. By checking which ports are open, we can determine the web server being used. Here’s how:

  1. Apache: Apache typically runs on port 80. You can use the command sudo lsof -i :80 | grep LISTEN.

    If Apache is running, you will see output indicating that port 80 is being listened to.

  2. Nginx: Nginx usually listens on port 80 as well. Run sudo lsof -i :80 | grep LISTEN to check if Nginx is running.
  3. Lighttpd: Lighttpd commonly uses port 80. Execute sudo lsof -i :80 | grep LISTEN to see if Lighttpd is listening on port 80.

Method 3: Looking at Configuration Files

The configuration files of web servers can provide valuable insights. Let’s see how we can examine them:

  • Apache: Apache’s main configuration file is located at /etc/apache2/apache2.conf. Open this file using a text editor and look for lines containing “ServerSignature” or “ServerTokens“. The comments or values associated with these directives will indicate that Apache is being used.
  • Nginx: Nginx’s main configuration file can be found at /etc/nginx/nginx. Open the file and search for "server_name".

    If you find a server name, it means Nginx is being utilized.

  • Lighttpd: Lighttpd's configuration file resides in /etc/lighttpd/lighttpd. Open this file and search for lines beginning with "$HTTP[\"host\"] == \"localhost\" {". If you find such lines, it indicates that Lighttpd is installed.

In Conclusion

In this tutorial, we explored various methods to determine the web server being used on Ubuntu. We learned how to use command line tools, check listening ports, and examine configuration files.

By applying these techniques, you can easily identify the web server running on your Ubuntu system. Happy exploring!