Interview Q&A for Apache Web Server Part-II


Q21:-What is DocumentRoot? 
Ans:-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 Web Root.

Default DocumentRoot location is /var/www/html

Q22:-How to deploy war or JAVA applications in Apache? 

Ans:-We can integrate Java application server like WebLogic, WebSphere, JBoss by deploy the war, ear files in /webapp/ folder and take a restart of web server

Q23:-What’s difference between Apache Web Server and Apache Tomcat? 

Ans:- Apache Web is HTTP server to serve static contents where Tomcat is servlet container to deploy JSP files.

Q24:-How can Apache act a Proxy Server? 

Ans:-We 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.

Q25:-How to configure Apache log so it captures time taken to serve a request?

Ans:- We 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.

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined

Restart the apache web server after change .

Q26:-What tool do you use for log analysis? 

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

Q27:-What are the Web Servers available ?

Ans:- Below are the few web servers list
    Nginx
    Microsoft IIS
    LiteSpeed
    GWS

Q28:-How to verify httpd.conf file to ensure no configuration syntax error? 

Ans:- httpd –t will help you to verify the syntax.

#/usr/sbin/httpd -t
Syntax OK
#

Alternatively, you may use apachectl command as well.

#/usr/sbin/apachectl configtest
Syntax OK
#

Q29:-How to perform Apache performance benchmark? 

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

Q30:-How to ensure web server is getting started after server reboot? 

Ans:-In Linux, you can put start script in /etc/init.d/ and enable to start on boot using chkconfig command

chkconfig --add apache
chkconfig apache on

In Windows, selected “Automatic” start of service

Q31:-what is a difference between Apache and Nginx web server? 

Ans:- 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 wide range of OS where Nginx doesn’t support OpenVMS and IBMi
 Apache has 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 to check out my articles on Nginx.

Q32:-How would you kill the Apache process if graceful stop doesn’t work? 

Ans:-In Linux, use kill command to stop the Apache process
Find out the PID of Apache by using command
ps -ef |grep http

Then kill it
kill -9 PIDNUMBER

In Windows,you can end the apache task from Task Manager.

Q33:-How to find httpd.conf file if you don’t know installation location? 

Ans:- By find or locate command
find / -name httpd.conf -type f 2>/dev/null
             OR
locate httpd.conf           

Q34:-What are the different flavor of Apache web server you know? 

Ans:- IBM HTTP Server (IHS)– used with IBM WebSphere Application Server
      Oracle HTTP Server (OHS)- used with Oracle Weblogic server

Q35:-How to hide server version details in HTTP response header? 

Ans:- Add the following in httpd.conf file and restart the web server

ServerTokens Prod
ServerSignature Off
This will hide the version and show Server as “Apache” Only.

Q36:-What does 200, 403 & 503 HTTP error code mean?
 Ans:-   200 – content found and served OK
    403 – tried to access restricted file/folder
    503 – server is too busy to serve the request and in another word – service unavailable.
    Refer HTTP Response Code infographic for more.

Q37:-How to disable trace HTTP request?

Ans:-Add the following in the httpd.conf file and restart the instance
TraceEnable off

Q38:-How to troubleshoot port conflict issue? 

Ans:-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 in Listen directive.

7 comments: