Tuesday, July 9, 2024

12 Apache HTTP Server Interview Questions Answers for 1 to 3 years Experienced

Hello guys, if you are preparing for Java web developer interviews then you must prepare questions on Apache HTTP web server, one of the most popular web server on internet. Knowing how Apache Web Server works not only shows that you have practical experience but also demonstrate your attitude about learning things in depth. The Apache HTTP Server, also known as httpd, has been the most popular web server on the Internet since April of 1996. It is both free and robust and that's the reason that almost half of the world's websites  runs on Apache HTTP web server, ranging from small hobby websites to huge e-commerce giants and big banks. 

There are also many companies which use Apache and Tomcat to host Java web application. In a typical setup, Apache web server receives the HTTP request and depending upon the URL it either route to Tomcat or serve the static files directly from the file system.

These questions are based mostly on that experience. Though Apache is not just famous in Java world it is even more popular with other web technologies e.g. Perl, PHP, and MySQL

It's one of the powerful and secure web servers so anyone can use it to handle HTTP traffic. It supports both HTTP and HTTPS. It's worth noting that Apache is also an HTTP/1.1 compliant web server. 

Recently I got a chance to work with Apache web server along with Tomcat in one of my project, so I also learned a lot about it and I am creating this list of Apache web server question to not just document that knowledge but also create a future reference point for myself and others to revise key concepts quickly. 

My collection contains 12 Apache httpd web server interview questions from Java and web Developer interviews. The questions are focused on practical knowledge of working with apache servers running on Linux environments and they are quiet handy for any developer with 1 to 3 years of experience, including Java developers. 

Since many investment banks and big companies use Apache httpd server together with Tomcat so that they can serve static resources using Apache and dynamic resource using Tomcat, these questions also check your understanding of how Apache httpd web server and Tomcat work together in Linux.




12 Apache Web and HTTP Server Interview Questions and Answers for 1 to 3 years Experienced Developers

Here is my list of Apache web server interview questions. The list is by no means complete or exhaustive, it just contains some essential questions to verify if a candidate has actually worked in Apache web server and Tomcat or not. 

I intend to keep this list up-to-date and add few more questions whenever I find them from my talk with friends and colleagues interviewing. 

You can also share Apache and Tomcat related questions you have faced before on Java or Web development interviews.


1. What is Apache Web Server?
Apache Web Server is one of the most secure, powerful, and popular open-source HTTP servers. It can be used to host anything from personal websites to corporate domains. The Apache HTTP Server, also known as "httpd" (HTTP daemon) was launched in 1995 and it has been the most popular web server on the Internet since April 1996. The latest version of the Apache Web server is Apache httpd 2.4.23 which was released on 2016-07-05.



2. Does Apache support HTTP-only or does it also support HTTPS?
Apache supports both HTTP and HTTPS protocols. It is an HTTP/1.1 specification compliant web server


3. How do you find the port on which Apache Web Server is listening?
You can check the httpd.conf file for the keyword "Listen", which defines the port on which Apache listens. Alternatively, you can use netstat command in Linux to find the port on which the Apache web server is listening as shown below:

$ netstat -nap | grep httpd
tcp 0 0 0.0.0.0:10202 0.0.0.0:* LISTEN 3988/httpd



4. How do you find which requests are forwarded to tomcat?
You can check the mod_jk.conf and workers.properties file to find out about load balancer and the port on which they are listening. So, suppose Tomcat is listening on port 23454 then the request coming on that port to Apache will be forwarded to the Tomcat.

Apache Web Server Interview Questions Answers


5. How do you start and stop Apache Web Server in Linux?
You can use the following commands to start and stop the Apache web server in Linux

$ cd bin -- where bin is apache bin directory
$ ./apache.sh stop
$ ./apache.sh start


6. How do you find which version of Apache Web Server you are using?
Just run the following command in the bin directory of Apache web server, it will display the version

$ ./apache.sh version


7. 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. 


8. What is the main difference between directory and location sections?
Answer: The Directory sections refer to file system objects; Location sections refer to elements in the address bar of the web page

9. 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.


10. How to restart a Apache web server?
Answer: service httpd restart or  /etc/init.d/httpd restart. 


11. What are some important configuration files of Apache HTTP Server?
The httpd.conf is the main config file for Apache web server. If your Apache is communicating to Tomcat then you can also see mod_jk.conf,  workers.properties and alias.properties in conf folder.


12. Which configuration files you will look to understand how Apache communicates to Tomcat?
The mod_jk.conf and the workers.properties file is used to specify tomcat related config like which URL should be routed to tomcat, which port to listen etc


That's all about some basic Apache Web Server Interview Questions and Answers. These questions will help you to understand Apache HTTP server more in little more detail and give you some idea of what you can expect in Java and Web development interview which require developing enterprise web applications using Java technologies like Servlet, JSP, JSF, Spring, or JEE, etc.

Btw, Apache is used not just in Java space but anywhere where a web server is required to serve HTML files or other static resources. You can found Apache with.NET projects or even PHP projects, even most of the internet sites are built using Apache, PHP, MySQL, and Linux. 

You can also read following official guides and documents to learn more about Apache fundamentals, Security, SSL, Performance, and error handling in Apache.

References
http://httpd.apache.org/docs/
http://httpd.apache.org/docs-project/


Some more interview questions articles for Java web developers
  • 10 Essential Spring Framework Interview Questions with Answers (see here)
  • 12 Essential RESTful Web Services Questions from Interviews (read here)
  • 10 Essential Hibernate Interview Questions for Java EE developers (see here)
  • 10 Essential XML Interview Questions for Java Programmers (read here)
  • 20 Essential Java Design Pattern Questions asked on Interviews (see here)
  • 10 popular Struts Interview Questions for Java developers (list)
  • 10 Frequently asked Servlet Interview Questions with Answers (see here)
  • 20 jQuery Interview Questions for Java Web Developers (list)
  • Top 10 JSP Questions  from J2EE Interviews (read here)
  • Top 10 EJB Interview Questions and Answers (see here)
  • Top 10 JMS and MQ Series Interview Questions and Answers (list)
  • 10 Essential JDBC Interview Questions for Java Programmers (questions)
  • Top 10 XSLT Interview Questions with Answers (read more)
Thanks for reading this article so far. If you fined these Apache web server interview questions are helpful in your preparation or you have seen them on your real interviews then please share with your friends and colleagues, I would really appreciate that. 

2 comments :

Anonymous said...

Thanx for article. There is some typo in 8th point.

Anonymous said...

Very interesting and helpful. Thanks.

Post a Comment