Apache Interview Questions and Answers

Prepare Apache interview questions for freshers and experienced candidates. This page includes important questions, answer previews, preparation guidance, related interview topics and cached content for faster page loading.

💡
51+ Apache questions available

About Apache Interview Preparation

Apache interview questions and answers for freshers and experienced candidates, including basic concepts, advanced topics, practical examples, project discussion points and common HR preparation guidance.

For better preparation, read each question carefully, understand the concept, prepare one real example, and connect your answer with your project or work experience.

Apache Questions List

Quick list of important Apache interview questions. Detailed answer previews are available below.

  1. Apache Interview Questions & Answers
  2. What is apache
  3. What is use of Apache in Web Server?
  4. From where Apache names comes?
  5. What are feature of Apache?
  6. Is Apache opensource?
  7. Who is Initial Author of Apache?
  8. In which language Apache is written?
  9. What is offical website of Apache?
  10. Do I need Programming Skills to install Apache in my system?
  11. What is location of log files for Apache server ?
  12. What are the types of virtual hosts ?
  13. Command to restart/start Apache web server ?
  14. Comamnd to check the version of Apache server ?
  15. What is meaning of "Listen" in httpd.conf file ?
  16. What is Document Root ?
  17. Apache server works on which ports ?
  18. Tell me name of main configuration file of Apache server ?
  19. On which version of apache you have worked ?
  20. What do you mean by a valid ServerName directive?
  21. What is the main difference between and sections?
  22. What is the difference between a restart and a graceful restart of a web server ?
  23. What is the use of mod_perl module ?
  24. If you have added "loglevel Debug" in httpd.conf file, than what will happen ?
  25. Is it possible to record the MAC (hardware) address of clients that access your server ?
  26. If there is one IP address, than how to host two web sites on server ?
  27. Can I serve content out of a directory other than the DocumentRoot directory?
  28. If you have to more than one URL map to the same directory but you don't have multiple Alias directives. What you will do ?
  29. Can you record all the cookies sent to your server by clients in Web Server logs?
  30. What we should do to find out how people are reaching your site ?

Question 1: Apache Interview Questions & Answers

Answer: Apache Interview Questions & Answers Q: – What is location of log files for Apache server ? Ans- /var/log/httpd Q: – What are the types of virtual hosts ? Ans- a. name-based b. IP-based. Name-based virtual host means that multiple names are running on each IP address. IP-based virtual host means that a different IP address exists for each website served. Most configurations are named-based because it only requires one IP address. Q: – Command to restart/start Apache web server ? Ans- service httpd restart/start Q: – Comamnd to check the version of Apache server ? Ans- rpm -qa |grep httpd Q: – What is meaning ...

View detailed answer →

Question 2: What is apache

Answer: The Apache HTTP Server, colloquially called Apache, is a Web server application notable for playing a key role in the initial growth of the World Wide Web.Originally based on the NCSA HTTPd server, development of Apache began in early 1995 after work on the NCSA code stalled. Apache quickly overtook NCSA HTTPd as the dominant HTTP server, and has remained the most popular HTTP server in use since April 1996. In 2009, it became the first Web server software to serve more than 100 million Web sites.

View detailed answer →

Question 3: What is use of Apache in Web Server?

Answer: Apache's role is all about communication over networks, and it uses the TCP/IP protocol (Transmission Control Protocol/Internet Protocol which allows devices with IP addresses within the same network to communicate with one another).

View detailed answer →

Question 4: From where Apache names comes?

Answer: The name "Apache" derives from the word "patchy" that the Apache developers used to describe early versions of their software development.

View detailed answer →

Question 5: What are feature of Apache?

Answer: Following are modules supported by Apache mod_access,  mod_auth,  mod_digest,  mod_auth_digest Secure Sockets Layer  Transport Layer Security support (mod_ssl),  proxy module (mod_proxy) URL rewriter (mod_rewrite) custom log files (mod_log_config) mod_ext_filter.

View detailed answer →

Question 12: What are the types of virtual hosts ?

Answer: a. name-basedb. IP-based.Name-based virtual host means that multiple names are running on each IP address.IP-based virtual host means that a different IP address exists for each website served. Most configurations are named-based because it only requires one IP address.

View detailed answer →

Question 15: What is meaning of "Listen" in httpd.conf file ?

Answer:  Port number on which to listen for nonsecure (http) transfers.

View detailed answer →

Question 16: What is Document Root ?

Answer: It is a location of files which are accessible by clients. By default, the Apache HTTP server in RedHat Enterprise Linux is configured to serve files from the /var/www/html/ directory.

View detailed answer →

Question 20: What do you mean by a valid ServerName directive?

Answer: The DNS system is used to associate IP addresses with domain names. The value of ServerName is returned when the server generates a URL. If you are using a certain domain name, you must make sure that it is included in your DNS system and will be available to clients visiting your site.The DNS system is used to associate IP addresses with domain names. The value of ServerName is returned when the server generates a URL. If you are using a certain domain name, you must make sure that it is included in your DNS system and will be available to clients visiting your site.

View detailed answer →

Question 21: What is the main difference between and sections?

Answer: Directory sections refer to file system objects; Location sections refer to elements in the address bar of the Web Page.

View detailed answer →

Question 22: What is the difference between a restart and a graceful restart of a web server ?

Answer:  During a normal restart, the server is stopped and then started, causing some requests to be lost. A graceful restart allows Apache children to continue to serve their current requests until they can be replaced with children running the new configuration.

View detailed answer →

Question 23: What is the use of mod_perl module ?

Answer: mod_perl scripting module to allow better Perl script performance and easy integration with the web server.

View detailed answer →

Question 24: If you have added "loglevel Debug" in httpd.conf file, than what will happen ?

Answer:  It will give you more information in the error log in order to debug a problem.

View detailed answer →

Question 25: Is it possible to record the MAC (hardware) address of clients that access your server ?

Question 26: If there is one IP address, than how to host two web sites on server ?

Answer: In this case I will use Name Based Virtual hosting. ServerName 10.111.203.25NameVirtualHost *:80 ServerName web1.test.comDocumentRoot /var/www/html/web1 ServerName web2.test2.comDocumentRoot /var/www/html/web2

View detailed answer →

Question 27: Can I serve content out of a directory other than the DocumentRoot directory?

Answer: Yes. We can do it by using “Alias” command.

View detailed answer →

Question 28: If you have to more than one URL map to the same directory but you don't have multiple Alias directives. What you will do ?

Answer: In this case I will use “AliasMatch” directives.The AliasMatch directive allows you to use regular expressions to match arbitrary patterns in URLs and map anything matching the pattern to the desired URL.

View detailed answer →

Question 29: Can you record all the cookies sent to your server by clients in Web Server logs?

Answer: Yes, add following lines in httpd.conf file.CustomLog logs/cookies_in.log “%{UNIQUE_ID}e %{Cookie}i” CustomLog logs/cookies2_in.log “%{UNIQUE_ID}e %{Cookie2}i”

View detailed answer →

Question 30: What we should do to find out how people are reaching your site ?

Answer: Add the following effect or to your activity log format. %{Referer}

View detailed answer →

Question 31: How you will put a limit on uploads on your web server ?

Answer: This can be achieved by LimitRequestBody directive.

View detailed answer →

Question 32: LimitRequestBody 100000 Here I have put limit of 100000 Bytes Q: – I want to stop people using my site by Proxy server. Is it possible?

Answer: Order Allow,DenyDeny from allSatisfy All

View detailed answer →

Question 33: What is mod_evasive module?

Answer: mod_evasive is a third-party module that performs one simple task and performs it very well. It detects when your site is receiving a Denial of Service (DoS) attack and it prevents that attack from doing as much damage. mod_evasive detects when a single client is making multiple requests in a short period of time and denies further requests from that client. The period for which the ban is in place can be very short, because it just gets renewed the next time a request is detected from that same host.

View detailed answer →

Question 34: How t to enable PHP scripts on your server?

Answer:  If you have mod_php installed, use AddHandler to map .php and .phtml files to the PHP handler. AddHandler application/x-httpd-php .phtml .php

View detailed answer →

Question 35: Which tool you have used for Apache benchmarking?

Answer: ab (Apache bench)ab -n 1000 -c 10 http://www.test.com/test.html

View detailed answer →

Question 36: Can we cache files which are viewed frequently?

Answer: Yes we can do it by using mod_file_cache module.CacheFile /www/htdocs/index.html

View detailed answer →

Question 38: What is DocumentRoot ?

Answer: it is a location of files which are accessible by clients. By default, the Apache HTTP server in RedHat Enterprise Linux is configured to serve files from the /var/www/html/ directory.

View detailed answer →

Question 40: What is the main difference between and sections?

Answer: Directory sections refer to fileDirectory sections refer to file system objects; Location sections refer to elements in the address bar of the Web page system objects; Location sections refer to elements in the address bar of the Web page

View detailed answer →

Question 41: If you have only one IP address, but you want to host two web sites on your server. What will you do?

Answer: In this case I will use Name Based Virtual hosting. ServerName 10.111.203.25NameVirtualHost *:80 <VirtualHost *:80>ServerName web1.test.comDocumentRoot /var/www/html/web1</VirtualHost> <VirtualHost *:80>ServerName web2.test2.comDocumentRoot /var/www/html/web2</VirtualHost>

View detailed answer →

Question 42: Can we do automatically roll over the Apache logs at specific times without having to shut down and restart the server?

Answer: YesUse CustomLog and the rotatelogs programsAdd following line in httpd.conf file. CustomLog “| /path/to/rotatelogs /path/to/logs/access_log.%Y-%m-%d 86400″ combined

View detailed answer →

Question 43: What we can do to find out how people are reaching your site?

Answer: Add the following effector to your activity log format. %{Referer}

View detailed answer →

Question 44: I want to stop people using my site by Proxy server. Is it possible?

Answer: <Directory proxy:http://www.test.com/myfiles>Order Allow,DenyDeny from allSatisfy All</Directory>

View detailed answer →

Question 45: If Some One want Apache server should handle multiple requests over a single TCP connection. Which of the following would allow to do this?

Answer: A. ExpirationsB. BrowserMatchC. KeepAliveD. PersistentConnectE. ChunkEncode

View detailed answer →

Question 46: How to install it?

Answer: How to install Apache There are numerous ways of installing the package or application.  There are enlisted below - One of the features of this open source web application is that anyone can make installer as per their own environment. This has allowed various vendors like Debian, Red Hat, FreeBSD, Suse etc. to customize the file location and configuration of apache taking into account other installed applications and base OS. Apart from installing it from a vendor based installer, there is always the option of building and installing it from the source code. Installing Apache from source file is a platform independent & works for al...

View detailed answer →

Question 47: What is Virtual Host?

Answer: An Apache web server can host multiple websites on the SAME server. You do not need separate server machine and apache software for each website. This can achieved using the concept of Virtual Host. Any domain that you want to host on your web server will have a separate entry in apache configuration file.   There are two types of virtual hosts supported by Apache – Name-based virtual host Address-based or IP based virtual host and. Name-based Virtual Host Name based virtual hosting is used to host multiple websites on a single IP address.    In order to configure name based virtual hosting, you have to set the IP address...

View detailed answer →

Question 48: How to Run PHP/Ruby with Apache ?

Answer: Running Php files on Apache needs mod_php enabled on your server.  It allows Apache to interpret .Php files.  It has Php handlers that interpret the Php code in apache and send HTML to your web server.  If mod_php is enabled on your server, you will have a file named php.conf in /etc/httpd/conf.d/ directory.  You can also check it with: ? 1 httpd -M | grep "php5_module" The output will be similar to:   At present there are four php handlers available in Apache i.e. mod_php CGI FastCGI suPHP mod_phpis the oldest PHP handler, it makes PHP part of apache and does not call any external PHP process. This module is installe...

View detailed answer →

Question 49: How to secure your Apache Web Server ?

Answer: Securing your web server is very important, it means allowing others to see only the intended information & protecting your data and restricting access. These are common things that enhance your web servers’ security. 1) Hiding Apache version and OS information: Apache displays its version and the name of the operating system   A hacker can use this information to launch an attack using the publicly available vulnerabilities in the particular version of the server or OS. In order to prevent Apache webserverfromdisplaying this information, we have to modify “server signature” option available in the apache configurat...

View detailed answer →

Question 50: How to manage Apache Logs ?

Answer: Apache logs provide detailed information that help to detect common issues with server. In order create logs, mod_log_configmodule must be enabled. There are three directives available in apache configuration file i.e. TransferLog: Creating a log file. LogFormat : Specifying a custom format. CustomLog : Creating and formatting a log file. TransferLog directive is available in the apache configuration file and it rotates virtual host log files as per set parameters. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <VirtualHost www.example.com>     ServerAdmin webmaster@example.com     DocumentRoot /usr/www/exampl...

View detailed answer →

Question 51: How to Configure your very first Production Web Sever ?

Answer: 1.  In order to have a running production web server, you need a dedicated node (Physical/Virtual or cloud instance) running Linux/Unix, Windows, MacOS etc.  2.  The Web Server must have a direct network connection and a staticIP address configured on it. 3.  It needs to have all the modules required for running web pages.  If a web server processes PHP pages, it needs to have PHP  module enabled. It also needs to have a good Antivirus application configured and running for securing the Web Server from Malware or Virus attacks.  You also need mechanism to update the configured antivirus/anti malware applicat...

View detailed answer →
Apache interview preparation tip: Start with basic definitions, then prepare practical examples, common mistakes, project usage, scenario-based questions and HR discussion points.