Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Top 50 Apache HTTPD Interview questions and answers

Apache Httpd

Table of Contents

1) What do you mean by Apache Web Server?


Apache web server is the HTTP web server that is open source, and it is used for hosting the website.

2) How to check the Apache version?

You can use the command httpd -v

3) What is the port of HTTP and https of Apache?

The port of HTTP is 80, and https is 443 in Apache.

4) How will you install the Apache server on Linux Machine?

This is the common Apache Interview Question asked in an interview. We can give the following command for Centos and Debian, respectively:
Centos: yum install httpd
Debian: apt-get install apache2.

5) Where are the configuration directories of the Apache webserver?

You can use the following command:
cd /etc/HTTP and type ls -l

6) What do you mean by the Alias Directive?

The alias directive is responsible for mapping resources in the file system.

7) What do you mean by the log files of the Apache webserver?

we can access the log files of Apache server from the below location: /var/log/httpd/access_log and error log from /var/log/httpd/error_log.

8) What do you mean by a virtual host is Apache?

The virtual host section contains the information regarding your Website name, Directory Index, Server Admin and Email, and information of error logs.

9) Explain the difference between location and Directory.

For setting the element related to the URL, we use:: Location.
It refers to the location of the files system of the server:: Directory.

10) What do you mean by Apache Virtual Hosting?

Hosting multiple websites on a single web server is known as Apache Virtual Hosting. There are two types of virtual hosting: Name-Based Virtual Hosting and IP Based Virtual Hosting.

11) How to start and stop the Apache Web server?

This is the most popular Apache Interview Question asked in an interview. Inside the Apache instance location, there is a bin folder, and inside the bin folder, there will be an executable script. We can use the below command in the bin folder via terminal:
For start: ./apachectl start
For stop: ./apachectl stop

12 What is the command to change the default Listen port?

We can give a command like this Listen 9.126.8.139:8000. This command will change the default listen port and make the listening port is 8000.

13) What do you mean by these error code 200, 403 and 503?

200 – the server is ok.
403 – Server is trying to access the restricted file.
503 –Server is busy.

14) How you will check the httpd.conf consistency?

By giving the below command:
httpd -t

15) How will you enable the PHP scripts on the server?

We have to follow the steps :
First, install mod_php.
Second run the command : AddHandler application/x-httpd-PHP .phtml .php

16) What is the log level of Apache?

The log level is: debug, info, warn, notice, crit, alarm, emerg, error.

17) What do you mean by Mod_evasive?

It is the module that helps the webserver to prevent web attacks, e.g., DDOS.

18) How will you kill the Apache process?

We can use the below command:
Kill $PIDNUMBER

19) What do you mean by MPM in Apache?

In Apache, MPM stands for Multi-Processing Modules.

20) Where are the configuration directories of the Apache webserve

You can use the following command:
cd /etc/HTTP and type ls -l

21) How to stop/start Apache Web Server?

You can restart by going to Apache instance location >> bin folder and execute apachectl script.

./apachectl stop
./apachectl start

You may also use a script located in /etc/init.d/. Mostly it will be named either “apache” or “httpd”

/etc/init.d/apache stop
/etc/init.d/apache start

Another procedure would be using services

httpd stop
service httpd start

22) 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:

Listen 10.10.10.10:80

23) How to ensure the Apache run with non-root/nobody user?

This is doable by adding User & Group directive in httpd.conf file

User apache
Group apache

The above configuration example will ensure it starts with “apache” user. You must ensure users exist on the server before configuring it.

24) How do I disable directory indexing?

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

Ex:


Options -Indexes


25) Which module is required to have redirection possible?

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

LoadModule rewrite_module modules/mod_rewrite.so

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

Listen 10.10.10.10:9000

27) 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

28) 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

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

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

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

LogLevel debug

32) Which module is required to enable SSL?

The mod_ssl module must be uncommented before SSL implementation.

LoadModule auth_basic_module modules/mod_ssl.so

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

Default DocumentRoot location is /var/www/html

34) 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

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

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

37) 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

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

httpd –t will help you to check the syntax.

[root@lab httpd]# /usr/sbin/httpd -t
Syntax OK
[root@lab httpd]#

Alternatively, you may use the apachectl command as well.

[root@lab ~]# /usr/sbin/apachectl configtest
Syntax OK
[root@lab ~]#

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

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

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

42) Apache runs as which user? and location of main config file?.

Apache runs with the user “nobody” and httpd daemon. Apache main configuration file: /etc/httpd/conf/httpd.conf (CentOS/RHEL/Fedora) and /etc/apache2.conf (Ubuntu/Debian).

43) How do you install Apache Server on your Linux machine?

Simply, you can use any package installer such as yum on (RHEL/CentOS/Fedora) and apt-get on (Debian/Ubuntu) to install Apache server on your Linux machine.

[root@tecmint ~]# yum install httpd

[root@tecmint ~]# apt-get install apache2

44) Can Apache be secured with TCP wrappers?
No, It can’t be secured with the TCP wrappers since it doesn’t support libwrap.a library of Linux.

45) Can we have two Apache Web servers on a single machine?

Yes, we can run two different Apache servers at one time on a Linux machine, but the condition for that is they should listen on different ports and we can change the ports with Listen directive of Apache.

46) What do you mean by DocumentRoot of Apache?

DocumentRoot in Apache means, it’s the location of web files are stored in the server, the default DocumentRoot of Apache is /var/www/html or /var/www. This can be changed to anything, by setting up “DocumentRoot” in a virtual host of configuration file of domain.

47) How to disable Directory listing when an index file is missing?

If, the main index file is missing in the website root directory, then the Apache will lists all the contents like files and folder of the website on the browser instead of Main website pages.

To stop Apache directory listing, you can set the following rule in the main configuration file globally or in .htaccess file for a particular website.

Options -Indexes

48) What do you understand by “connection reset by peer” in error logs?

When the server is serving any ongoing Apache request and end user terminates the connection in between, we see “connection reset by peer” in the Apache error logs.

49) What’s the difference between <Location> and <Directory>?

<Location> is used to set element related to the URL / address bar of the web server.
<Directory> refers that the location of file system object on the server

50) What do you understand by MPM in Apache?

MPM stands for Multi Processing Modules, actually Apache follows some mechanism to accept and complete web server requests.

Rajesh Kumar
Follow me
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Abdul Wahid
Abdul Wahid
2 years ago

Can you update this answer .
>>>
13) What do you mean by these error code 200, 403 and 503?200 – the server is ok.
403 – Server is trying to access the restricted file.
503 –Server is busy. —> service temporarily unavailable

1
0
Would love your thoughts, please comment.x
()
x