Interview Q&A for Apache Web Server Part-I

Interview Q&A on Apache Web Server

Q1:-How can we stop/start Apache Web Server?
Ans:-You can restart by going to Apache instance location >> bin folder and execute apachectl script.

./apachectl stop
./apachectl start

You may also use 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

service httpd stop
service httpd start

Q2:-What is the default port for HTTP and HTTPS? 

Ans:-The default port for HTTP is 80 and HTTPS 443.

Q3:-Which is the most important configuration file for Apache Web Server? 

Ans:- httpd.conf is the main configuration file used in Apache.

Q4:-How can we check the version of running Apache Web Server? 

Ans:- Below is the way to get the version of Apache Web Server
1st Method:-
# ./httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Jul 18 2016 15:24:00
#

2nd Method:-
# rpm -qa |grep httpd
httpd-2.2.15-54.el6.centos.x86_64
httpd-tools-2.2.15-54.el6.centos.x86_64
#

Q5:-How can we check that  web server is running or not? 

Ans:- ps -ef |grep httpd

Q6:-How can we  install Apache web server? 

Ans:- By yum or rpm package installer

yum -y install httpd
       OR
rpm -ivh packagename.rpm

Q7:-How can we ensure that Apache listen on only one IP on the server?
Ans:-This is often needed when you have multiple IPs on the server. In order to ensure Apache listen only on specified IP then you need to explicitly mention IP and port in Listen directive.

Example:- Listen 10.10.10.10:80

Q8:-How can we ensure that Apache process is running with non-root user? 

Ans:- by adding User & Group directive in httpd.conf file

User apache
Group apache

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

Q9:- How do I disable directory indexing? 

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

Example:-

       Options -Indexes


Q10:-Which module is required to have redirection possible? 

Ans:- mod_rewrite is responsible for the redirection and this must be un-commented in httpd.conf file.

LoadModule rewrite_module modules/mod_rewrite.so

Q11:-Can you change the listening port from default to something else? 

Ans:- Yes, it’s possible by specifying the port number in Listen directive.

Example:- To make Apache listen on 9000 port to 10.20.50.12 IP address.
Listen 10.20.50.12:9000

Q12:-How to secure Website hosted on Apache Web Server? 

Ans:- By implemented SSL or intregrated WAF (Web Application Firewall)

Q13:-What are the log files generated by Apache? 

Ans:-There are two log files created by Apache
1) access.log – all request details with the status code
2) error.log – capture all the errors within apache or connecting in backend

Q14:-How to create a CSR? 

Ans:- By openssl command

Example:-To create new CSR with private key
openssl req -out mynewweb.csr -newkey rsa:2048 -nodes -keyout mynewweb.key

Q15:-What is Virtual Hosting? 

Ans:-Apache allows us to host multiple websites on a single instance. We can either create IP based or Name based in virtual hosting.

Q16:-What module is needed to connect to WebSphere? 

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

Q17:-How to put Log level in Debug mode? 

Ans:-We can change the logging level to debug by changing the following in httpd.conf file.
LogLevel debug

Q18:-Which module is required to enable SSL? 

Ans:- mod_ssl module must be uncommented prior to SSL implementation.
LoadModule auth_basic_module modules/mod_ssl.so

Q19:-What’s the WebLogic module name? 

Ans:- mod_wl_22.so

Q20:-What are the log level available in Apache? 

Ans:-Below are the log level available in Apache
    debug
    info
    warn
    notice
    crit
    alarm
    emerg
    error
Note:-The default configuration is set to “warn”.   

No comments:

Post a Comment