Apache web server is world’s most popular open-source cross platform web server . It is also known as httpd . Virtual hosting allows one Apache installation to serve many different website .If you are working as a system or web administrator then you must be familiar with Apache web server . In this article i will explain 50 Apache web server interview questions and answers . You must read this carefully , this will help you a lot in your interview .

Before proceeding to this article , we take some common information about Apache web server .

Developer : Apache software foundation

Operating System : Windows, Unix-like

Written in : C , XML

Home Page : https://httpd.apache.org/

Apache web server download page

So now , Let’s get started with Apache web server interview questions and answers

50 Apache Web Server Interview Questions and answers

1.  What is Apache web server ?

Apache web server is one of the most popular , open source , powerful http server. It can be used to host any website from a small website to large ecommerce website .

2. How to check version of Apache web server ?

#apachectl -V

Alternatively , you can also use rpm command to check Apache web server version

#rpm -qa |grep httpd

3. Which command you use to install Apache web server in your machine ?

#yum install httpd

you can also install Apache web server through rpm command

# rpm -ivh packagename.rpm

4. How to start or stop httpd service ?

#service httpd start

#service httpd stop

5. How to configure httpd to start automatically at boot time in rhel ?

#chkconfig httpd on

6. How to verify httpd service status ?

#service httpd status

7. What is the main configuration file of httpd ?

/etc/httpd/conf/httpd.conf

8. What is location of log files of httpd ?

/var/log/httpd

9. What is the port number of Apache web server ?

http works on port number 80 and https work on port number 443

10. Which module is required to have redirection possible ?

mod_rewrite module is required to have redirection possible .

11. Can you change the default port of Apache web server ?

Yes , I can change the default port of Apache web server .

For this, you have to specify port number is Listen directive .

example – suppose ip address is 192.168.103.5 and port number  is 8000

12. What is DocumentRoot ?

DocumentRoot directive is the folder location of configuration from where static files will be served . Default DocumentRoot location is /var/www/html

13. How to use Log level as Debug mode ?

When you are troubleshooting any issue occurs in your web server , you can make Log level as debug mode by changing the configuration file of Apache web server .

In httpd.conf you have to change Log level

14. What do you about virtual hosting ?

Virtual hosting allows one Apache installation to serve many different website .

15. Which module is required to enable SSL ?

mod_ssl module is required to enable SSL .

16. What is difference between restart and graceful restart ?

In normal restart, server is stopped and after that start , cause some request is lost . but in graceful restart Apache keeps on working continuously until it will replaced by new process. That’s why there are no loss occurs in graceful restart .

17. Which command is used to check error in httpd.conf file ?

httpd -t

18. Which module is used to enable php script on web server ?

mod_php

19. How we can find out how people are reaching to your site ?

Add following line to your activity log format

%{Referer}

20. How to hide server version details in http response header ?

Add following line in http.conf and restart web server

21. What is the meaning of Listen in httpd.conf file ?

Port number on which to listen for nonsecure (http) transfer .

22. Which module is used for Apache to act as a proxy server ?

mod_proxy

23. Why we use mod_perl module ?

mod_perl module allow better perl scripting performance .

24. What are the important error code ?

200 – content found and served ok

403 – tried to access restricted files or folder

503 – server is too busy or unavailable

25. What is difference between Apache web server and Apache tomcat ?

Apache http serve simple http request but Apache tomcat is used as a servlet container to deploy JSP files .

26. What is the port number of Apache tomcat ?

8080

27. What is use of htpasswd ?

htpasswd is used to create and update files used to store user name and password for basic authentication of http users .

28. What are the types of virtual hosts ?

There are two types of virtual hosts . These are –

IP-based virtualhosts and Name-based virtual hosts.

29. What do you mean by IP-based virtual hosts ?

It uses IP address to determine correct virtual host to serve . Therefore you need to have separate IP address for each hosts.

30. What do you mean by Name-based virtual host ?

Using this technique , many different hosts can share same IP address .

31. How you can disable .htaccess file ?

You can disable .htaccess files by setting AllowOverride directive to none .

32. What is use of .htaccess file ?

It provide a way to make configuration changes on a per directory basis .

33. What is mod_evasive module ?

It detects Denial of Service (DoS) attack and prevent from that attack . When a single client makes multiple requests in short interval of time , It denies further request from that client .

34. What is mod_vhost_alias ?

It allows hosting multiple sites on the same server via simpler configuration .

35. Which command is used to install mod_ssl ?

# yum install mod_ssl

36. How to manage fcontext if the DocumentRoot is not default ?

Suppose the DocumentRoot is /srv/net6/vhosts

You can manage fcontext by following command  –

#semanage fcontext -a -t httpd_sys_content_t ‘/srv/net6/vhosts(/.*)?’

#restorecon -Rv /srv/net6/vhosts

37. Which module is used to configure for dynamic web page ?

mod_wsgi

38. What are the log files generated by Apache web server ?

There are mainly two log files are generated by Apache web server . These are –

access_log and error_log

access_log capture all request details .  error_log capture all error within Apache web server .

39. What is difference between Directory directive and Location directive ?

Directory directive works only for filesystem objective where as Location directive works only for URLs .

40. What is ServerName directive ?

The DNS system is map IP address to domain name . The value of ServerName is returned when the server generates a URL. You must include you domain name in your DNS system .

41. What is mod_status ?

This module allows you to view detailed status of web server

42. How i can set , my web server is access by only particular domain ?

order allow,deny

allow from domain_name

43. Which tool you used for Apache benchmarking ?

ab (Apache bench)

44. Is there any size limit for URL rewriting and alias in Apache web server ?

no, There is no any limit .

45. How to make the server accept connection on both port 80 and 8000 on all interface ?

Listen 80

Listen 8000

46. How to make the server accept connection on port 80 for one interface and port 8000 on other ?

Listen 192.168.2.5:80

Listen 192.168.2.9:8000

47. How to check web server running process ?

#ps -ef | grep httpd

48. What are the log level available in Apache ?

debug, alarm, error , notice, warn , emerg , info

49. How to kill apache process ?

kill -9 process_id

50. How to disable trace HTTP request ?

Add the given line in httpd.conf and restart the server

You may also like to read following article :

In this article we discuss about 50 Apache web server questions and answers. I hope this is useful for you.