Apache Interview Questions & Answers part 2

0
8139

Q: – What is the use of mod_perl module?

mod_perl scripting module to allow better Perl script performance and easy integration with the Web server.

Q: – If you have added “loglevel Debug” in httpd.conf file, than what will happen?

It will give you more information in the error log in order to debug a problem.

Q: – Can you record the MAC (hardware) address of clients that access your server.

No

Q: – If you have only one IP address, but you want to host two web sites on your server. What will you do?

In this case I will use Name Based Virtual hosting.

ServerName 10.111.203.25
NameVirtualHost *:80

<VirtualHost *:80>
ServerName web1.test.com
DocumentRoot /var/www/html/web1
</VirtualHost>

<VirtualHost *:80>
ServerName web2.test2.com
DocumentRoot /var/www/html/web2
</VirtualHost>

Q: – Can I serve content out of a directory other than the DocumentRoot directory?

Yes, by using “Alias” we can do this.

Q: – If you have to more than one URL map to the same directory but you don't have multiple Alias directives. What you will do?

In this case I will use “AliasMatch” directives.
The AliasMatch directive allows you to use regular expressions to match arbitrary patterns in URLs and map anything matching the pattern to the desired URL.

Q: – Can you record all the cookies sent to your server by clients in Web Server logs?

Yes, add following lines in httpd.conf file.
CustomLog logs/cookies_in.log "%{UNIQUE_ID}e %{Cookie}i" CustomLog logs/cookies2_in.log "%{UNIQUE_ID}e %{Cookie2}i"

Q: – Can we do automatically roll over the Apache logs at specific times without having to shut down and restart the server?

Yes
Use CustomLog and the rotatelogs programs
Add following line in httpd.conf file. CustomLog "| /path/to/rotatelogs /path/to/logs/access_log.%Y-%m-%d 86400" combined

Q: – What we can do to find out how people are reaching your site?

Add the following effector to your activity log format. %{Referer}

Submitted By:-Raj Rathi            Email-ID: – rajrathi568@gmail.com
SHARE

LEAVE A REPLY