A few days back, I wrote about WebSphere Interview Questions, and many of you requested to write about Apache Web Server so here you go. The following questions are often asked in an interview from beginner to expert level. Most of the organization will have Web Server managed by Middleware/System administrator along with Application Server and other components. Let’s get started with real-time interview questions & answers…

1. How to stop/start Apache Web Server?

You can restart by going to Apache instance location » bin folder and execute apachectl script. You may also use a script located in /etc/init.d/. Mostly it will be named either “apache” or “httpd” Another procedure would be using services

2. What is the default port for HTTP and HTTPS?

The default port for HTTP is 80 and HTTPS 443. Checkout default ports for other applications listed here.

3. Can you tell me the important configuration file name?

httpd.conf is the main configuration file used in Apache.

4. How to check the version of running Apache Web Server?

There are multiple ways to find this but more accurately would be;

Login to a web server Go to apache instance and bin folder Executed httpd with -v to get the version details.

Alternatively, you can also use the rpm command to check the installed version.

5. How to know if a web server is running?

There are multiple ways to find this. Ex: http://yourapacheserver.com

6. How to install Apache HTTP?

There are three possible ways to get this installed. Using source code – you can download the source and compile it.

Download the latest release from http://httpd.apache.org/download.cgi Extract the source with tar utility or gzip utility depending on the file type: .tar or .tar.gz

 Navigate to where you extracted the source via the cd command and configure it using the  ./configure  command on the terminal Then compile it using the make command. Finally, use the make install command to install it.

If you want to find out more options on how to configure it, you can make use of the configure –help command. YUM repository – if your server is connected to the Internet or has an internal repository then you can use yum to install it. RPM – You can download the necessary RPM package and use the rpm command.

7. How to ensure Apache listens to only one IP address on the server?

This is often needed when you have multiple IPs on the server. To ensure Apache listens only on specified IP then you need to explicitly mention IP and port in Listen directive. Ex:

8. How to ensure the Apache run with non-root/nobody user?

This is doable by adding User & Group directive in httpd.conf file The above configuration example will ensure it starts with “apache” user. You must ensure users exist on the server before configuring it.

9. How do I disable directory indexing?

You can use “Options -Indexes” in the respective directory directive. Ex:

10. Which module is required to have redirection possible?

mod_rewrite is responsible for the redirection, and this must be uncommented in httpd.conf file.

11. Can you change the listening port from default to something else?

Yes, it’s possible by specifying the port number in the Listen directive. Ex: to make Apache listen on 9000 port to 10.10.10.10 IP address.

12. How to secure a Website hosted on Apache Web Server?

There are multiple ways to secure the Apache webserver including the following.

Implementing SSL Integrating with WAF (Web Application Firewall) like ModSecurity, etc. Using cloud-based security provider

13. What are the log files generated by Apache?

There are two popular log files created;

access.log – all request details with the status code error.log – capture all the errors within apache or connecting to the backend

14. How to create a CSR?

You can either use the following OpenSSL command or generate CSR online. To create new CSR with a private key Check out the OpenSSL cheat sheet for more commands.

15. What is Virtual Hosting?

Virtual Hosting in Apache allows you to host multiple websites on a single instance. You can either create IP based or Name based on virtual hosting.

16. What module is needed to connect to WebSphere?

mod_was_ap22_http.so must be added in httpd.conf file to integrate with IBM WAS.

17. How to put Log level in Debug mode?

Often needed when you are troubleshooting the issue and wish to capture more details. You can change the logging level to debug by ensuring the following in httpd.conf file.

18. Which module is required to enable SSL?

The mod_ssl module must be uncommented before SSL implementation.

19. What’s the WebLogic module name?

mod_wl_22.so

20. What is the log level available in Apache?

The default configuration is set to “warn” however, the following is possible too.

debug info warn notice crit alarm emerg error

21. What is DocumentRoot?

DocumentRoot directive is the configuration where you can specify the folder location from where the static files will be served. It’s also called as WebRoot.

22. How to deploy war or JAVA applications in Apache?

I am afraid, Apache is a Web Server, and Java-based application deployment is not possible with it. However, you can integrate Java application servers like WebLogic, WebSphere, JBoss where you can deploy war, ear files.

23. What’s a difference between Apache Web Server and Apache Tomcat?

Apache Web is an HTTP server to serve static contents where Tomcat is a servlet container to deploy JSP files. You can always integrate Apache HTTP with Tomcat, however, based on the requirement you need to choose either one. If you need a proper web server, then Apache HTTP else Tomcat for JSP-Servlet Container.

24. How can Apache act as a Proxy Server?

You can use a mod_proxy module to use as a proxy server. The mod_proxy module can be used to connect to the backend server like Tomcat, WebLogic, WebSphere, etc.

25. How to configure Apache log, so it captures the time taken to serve a request?

You can add “%D” in httpd.conf file under LogFormat directive to capture the response time taken to serve the request. It will show time in microseconds. Restart the Apache web server, and you can see the results.

26. What tool do you use for log analysis?

You got to speak the truth but to give you an idea you can use GoAccess, SumoLogic or few mentioned here.

27. What are the Web Servers you’ve worked on along with Apache?

Again, you better tell the truth but to make you aware, there are many web servers in the market including the following.

Nginx Microsoft IIS LiteSpeed GWS

28. How to verify httpd.conf file to ensure no configuration syntax error?

httpd –t will help you to check the syntax. Alternatively, you may use the apachectl command as well.

29. How to perform Apache performance benchmark?

You can use a tool like ApacheBench, SIEGE to perform the load test on web servers including Apache. Another option to perform stress test online to see the overall how web application performs under load.

30. How to get support for Apache Web Server if something wrong?

Apache is an Open Source web server, so there is no enterprise-level support. However, you can raise a bug report or ask a question on Stack Overflow.

31. How to ensure the webserver is getting started after a server reboot?

If running Linux, then you can put a script in /etc/init.d/ and enable to start on boot using chkconfig command Let’s say you create a file called apache and put under /etc/init.d if on Windows, then ensure startup type is selected “Automatic.”

32. what is a difference between Apache and Nginx web server?

Both are categorized as a Web Server and here are some of the main differences.

Nginx is event-based web server where Apache is process based Nginx is known for better performance than Apache Apache supports a wide range of OS where Nginx doesn’t support OpenVMS and IBMi Apache has a large number of modules integration with backend application server where Nginx is still catching up Nginx is lightweight and capturing the market share rapidly. If you are new to Nginx, then you may be interested in checking out my articles on Nginx.

33. How would you kill the Apache if graceful-stop doesn’t work?

If running on Linux, then can use kill command. Find out the PID of Apache by using ps -ef |grep http Then kill it if normal kill doesn’t work then try kill -9 If on Windows, then end the Apache task from Task Manager.

34. How to find httpd.conf file if you don’t know the installation location?

In Linux, you can use find command. Let’s assume, you know it must be in /apps file system then you can use the following command. But if you are not sure about which file system then you can do find on / file system but keep it in mind it may take a long time based on the overall file system size.

35. What are the different flavors of Apache webserver you know?

IBM HTTP Server – known as IHS and often used with IBM WebSphere Application Server Oracle HTTP Server- known as OHS often used with Oracle Weblogic server

36. Where is the Apache located in the data center location?

You can explain based on your experience, however, typically for Internet-facing applications, it would be in the Internet DMZ network and for intranet, core network. But again this will differ based on application/organization.

37. How to hide server version details in the HTTP response header?

Add the following in httpd.conf file and restart the webserver This will hide the version and show the Server as “Apache” Only.

38. What does 200, 403 & 503 HTTP error codes mean?

200 – content found and served OK 403 – tried to access restricted file/folder 503 – the server is too busy to serve the request and in other words – service unavailable. Refer HTTP Response Code infographic for more.

39. How to disable trace HTTP requests?

Add the following in httpd.conf file and restart the instance

40. How to troubleshoot port conflict issue?

netstat would be useful to troubleshoot the port conflict issue. If running multiple instances on a single server then it would be recommended to have absolute IP:Port configured for Listen directive.

41. How to install the third-party module?

You can make use of Apache Toolbox. Once downloaded, extract it using the tar utility. Navigate to the folder Apachetoolbox-1.5.72 using the cd command and run the command below to select modules for your Apache server. It provides modules such as  mod_ip_forwarding, mod_auth_mysql and mod_auth_samba to compile with the Apache webserver. Although you can include these modules manually, it is easier with Apache Toolbox.

42. How to assign multiple names to virtual hosts?

You can make use of the ServerAlias directive as shown below.

43. How to limit upload size?

I have a web application that allows users to upload files such as word documents, pdf and so on.  How do I limit file upload by users? You can make use of the LimitRequestBody directive to limit upload file size. The value assigned to the LimitRequestBody allows Apache to accept and store file uploads of 9000 bytes by users. You can adjust the value based on the requirement. 44. How to restrict access by IPs? You may want some of the context root to be accessible by allowed IPs. To do so, you can make use of mod_authz_core or mod_authz_host modules to restrict access using the Require directive. By doing above, Apache will serve requests only if requests are made from the listed IPs. You need to specify the Require directive within the directory where you want to allow or deny access to resources.

Conclusion

I hope the above questions and answer help you to prepare for a web server administrator interview.

44 Practical Apache Web Server Interview Questions with Answers - 4144 Practical Apache Web Server Interview Questions with Answers - 9044 Practical Apache Web Server Interview Questions with Answers - 2944 Practical Apache Web Server Interview Questions with Answers - 5144 Practical Apache Web Server Interview Questions with Answers - 8944 Practical Apache Web Server Interview Questions with Answers - 14