25 Junior level questions about Apache

Source: Internet
Author: User
Tags connection reset hosting
Apache Job Interview Questions

This section covers the 25 interesting Apache job interview questions that will be raised, with their answers, so you can easily understand some new things about Apache that you've never seen before.

Before you start reading this article, we strongly recommend that you do not memorize, and that everything must first be tried and understood in a real-world scenario.

1. What is an Apache Web server?

Answer: Apache Web server HTTP is a very popular, powerful and open source for managing Web sites and providing Web file services to the network. It runs based on the HTTP Hypertext Transfer Protocol, which provides the standard for server and client Web browser communication. It supports SSL, CGI files, and virtual hosts with many other features.

2. How do I check Apache and its version?

Answer: First, use the RPM command to check if Apache is installed. If it's already installed, use the HTTPD-V command to check its version.

[Root@tecmint ~]# Rpm-qa | Grep httpdhttpd-devel-2.2.15-29.el6.centos.i686httpd-2.2.15-29.el6.centos.i686httpd-tools-2.2.15-29.el6.centos.i686[ Root@tecmint ~]# httpd-vserver version:apache/2.2.15 (Unix) Server Built:aug 13 2013 17:27:11

3. Is Apache running with that user? Where is the main configuration file located?.

Answer: Apache runs with the "Nobody" user and the httpd daemon. Apache main configuration files are in:/etc/httpd/conf/httpd.conf (Centos/rhel/fedora) and/etc/apache2.conf (Ubuntu/debian).

4. Apache listens for HTTP and HTTPS requests?

Answer: Apache listens for HTTP on port 80 by default and listens on port 443 for HTTPS (requires SSL integer). You can also use the netstat command to check the port.

[Root@tecmint ~]# NETSTAT-ANTP | grep httptcp 0 0::: +:::* LISTEN 1076/httpdtcp 0 0::: 443:::* LISTEN 1076/httpd

5. How do I install Apache server on your Linux machine?

Answer: Quite simply, you can use any of the Rhel/centos/fedora on the Yum and (Debian/ubuntu) apt-get to install the Apache server on your Linux.

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

6. Where can you find all the configuration paths for the Apache Web server?

Answer: Apache default configuration path is placed in: (Rhel/centos/fedora) is in/etc/httpd/on and (Debian/ubuntu) is under/etc/apache2.

[Root@tecmint ~]# cd/etc/httpd/[root@tecmint httpd]# ls-ltotal 8drwxr-xr-x. 2 root root 4096 Dec 21:44 confdrwxr-xr-x. 2 root root 4096 Dec 02:09 conf.dlrwxrwxrwx 1 root root: Oct 19:06 logs. /.. /var/log/httpdlrwxrwxrwx 1 root root Oct 19:06 modules. /.. /usr/lib/httpd/moduleslrwxrwxrwx 1 root root Oct 19:06 run. /.. /var/run/httpd[root@tecmint ~]# cd/etc/apache2[root@tecmint apache2]# ls-ltotal 84-rw-r--r--1 root root 7113 Jul 24 16: Apache2.confdrwxr-xr-x 2 root root 4096 Dec 11:48 conf-availabledrwxr-xr-x 2 root root 4096 Dec 11:45 conf.ddrwxr -xr-x 2 root root 4096 Dec 11:48 conf-enabled-rw-r--r--1 root root 1782 Jul 02:14 envvars-rw-r--r--1 root root 310 02:14 magicdrwxr-xr-x 2 root root 12288 Dec 11:48 mods-availabledrwxr-xr-x 2 root root 4096 Dec 11:48 Mods -enabled-rw-r--r--1 root root 315 Jul 02:14 ports.confdrwxr-xr-x 2 root root 4096 Dec 11:48 SITES-AVAILABLEDRWXR-XR -X 2 root root 4096 Dec 6 00:04 sites-enabled 

7. Can Apache be fixed by the TCP wrapper?

Answer: No, it can not be fixed by the TCP wrapper because it does not support the Linux Libwrap.a library.

8. How do I change the default port in Apache and how do I listen for instructions in it?

Answer: There is an instruction "Listen" in the httpd.conf file that allows us to change the default Apache port. With the help of the listen instruction we can listen to Apache on different ports and on different interfaces.

Assuming you have multiple IPs registered with your Linux machine and want Apache to receive HTTP requests on a special Ethernet port or interface, even this requirement can be done with the listen instruction.

In order to change the Apache default port, please use open your Apache Master profile httpd.conf or apache2.conf.

[Root@tecmint ~]# vi/etc/httpd/conf/httpd.conf[root@tecmint ~]# vi/etc/apache2/apache2.conf

Look for the word "Listen", comment on the original line and write your own instructions under that line.

# Listen 80Listen 8080

OR

Listen 172.16.16.1:8080

Save the file and restart the Web server.

[Root@tecmint ~]# service httpd restart[root@tecmint ~]# service apache2 Restart

9. Can we put two Apache Web servers on a single machine?

Answer: Yes, we run two different Apache servers on a Linux machine at the same time, but only if they should listen on different ports, and we can use Apache's listen instruction to change the port.

10. Do you know what Apache's documentroot means?

Answer: DocumentRoot Apache means the location where the Web files are stored on the server, and the default documentroot is/var/www/html or/var/www. This can be modified, as long as you modify the host's virtual host Configuration "DocumentRoot" on the line.

11. How do I manage files under different folders, and what is the Alias directive?

Answer: Yes, this can be done with the alias directive in the main Apache configuration file. The Alias directive can retrace a resource in the file system, uses a URL path, and replaces it with a file or directory that is redirected to the system.

Using the alias directive, it is part of the Apache Mod_alias module. The default syntax for the alias directive is:

alias/images/var/data/images/

In the above example, the/images URL placed in front of the/var/data/images prefix means that the client requests "Http://www.example.com/images/sample-image.png" Will let Apache take the "sample-image.png" file from the/var/data/images/sample-image.png on the server. It is also known as URL mapping.

12. How do you understand the "DirectoryIndex"?

Answer: DirectoryIndex is the file that Apache will first look for when there is a request from the host. For example: The client sends the request www.example.com, Apache will find the index file (the first file to show) to the site's file root directory.

The default setting for DirectoryIndex is. html index.html index.php, if not the name, you need to change the apache2.conf value in httpd.conf or DirectoryIndex to show it in On your client browser.

# # Directoryindex:sets The file that Apache would serve if a directory# is requested.## the Index.html.var file (a Type-ma p) is used to deliver content-# negotiated documents. The MultiViews Option can be used for the# same purpose, but it's much slower. #DirectoryIndex index.html Index.html.var I ndex.cgi. exe

13. How do I invalidate a directory list when the index file is missing?

Answer: If the primary index file in the site root fails, Apache will list all similar files on the browser to replace the site home page.

In order to close the list of Apache directories, you can set the global settings in the main configuration file, or set the following rules in the. htaccess file section.

<Directory/var/www/html>Options-Indexes</Directory>

What are the different log files for the Apache Web server?

Answer: The default log file for the Apache Web server is the access log "/var/log/httpd/access_log" and the error log:/var/log/httpd/error_log ".

15. How do you understand the "connection reset by peer" in the error log?

Answer: When the server is providing service to the request, the end user interrupts the connection, and we see "Connection reset by peer" in the error log.

16. What is Apache virtual host?

Answer: The Virtual Host section contains information including the site name, document root path, directory index, server administrator mailbox, error log file path, and so on.

You can add the instructions you want to your domain at will, but to run a site, at least configure the parameter server name and document root directory. On a Linux machine, we usually set the configuration of our virtual host section at the end of the httpd.conf file.

Virtual Host Example

<virtualhost *:80>    ServerAdmin webmaster@dummy-host.example.com    documentroot/www/docs/ dummy-host.example.com    ServerName dummy-host.example.com    errorlog logs/dummy-host.example.com-error_log    Customlog Logs/dummy-host.example.com-access_log common</virtualhost>

ServerAdmin: usually refers to the site owner's e-mail, errors and notifications can be sent inside.

The Documentroot:web file is placed on the server (must be configured).

ServerName: The domain name (which must be configured) when the site is accessed through a browser.

Errorlog: The location of the log file, which records all logs associated with the site.

What is the difference between <Location> and <Directory>?

Answer:

<Location> is used to set and url/web the server's address bar related elements.

<Directory> refers to the location of an object on the server in the file system

18. What is Apache virtual hosting?

Answer: Apache virtual hosting refers to hosting multiple Web sites on a single Web server. Apache can set up two types of virtual hosts: name-based virtual hosting and IP-based virtual host hosting.

For more information, see How to create a NAME/IP-based virtual host in Apache.

19. How do you understand Apache's MPM?

The answer: MPM means multi processing Modules, which in fact refers to some of the mechanisms that Apache follows to accept and complete requests for Web servers.

What is the difference between a Worker and a prefork mpm?

Answer: They are all mpm, and the Worker and Prefork have their respective operating mechanisms on Apache. They depend entirely on the mode in which you want to launch your Apache.

The basic difference between Worker and MPM is that they produce the process of processing the child process. In Prefork MPM, a primary httpd is initiated, and the master process manages all other child processes to serve client requests. When a httpd process is activated in the worker mpm, a different thread is used to service the client request.

Prefork MPM uses multiple child processes, each with a single thread and the worker MPM uses multiple child processes, each with multiple threads.

Prefork in MPM, each process processes one connection at a time and each thread in the worker MPM processes one connection at a time.

The memory footprint of Prefork MPM consumes a large amount of memory, while the worker takes up less memory.

What is the "limitrequestbody" application and how do I add restrictions to your uploads?

Answer: The limitrequestbody instruction is used to make a limit on the upload size.

For example: I want to add a 100000-byte limit to the/var/www/html/tecmin/uploads directory. Then you need to include the following instruction in the Apache configuration file.

<directory "/var/www/html/tecmint/uploads" >    limitrequestbody 100000</directory>

What is mod_perl and mod _php?

Answer:

Mod_perl is an Apache module compiled with Apache to make simple integration of Perl scripts and improve their performance.

Mod_php is used to make a simple integration of PHP scripts for Web servers, which embeds PHP interpreters in the Apache process. It forces Apache child processes to use more memory and can only be used on Apache, but is still popular.

What is Mod_evasive?

Answer: It is a third-party module that protects your Web server from web attacks like DDoS, because it performs only one task at a time, and all performs well.

For more information, please read this article, which will guide you on how to install and configure mod_evasive in Apache.

What are the LogLevel debugs in the. httpd.conf file?

Answer: With the help of the loglevel debug option, we can get or record more information in the error log to help us debug the problem.

What is the use of mod_ssl and how does SSL work in Apache?

Answer: MOD_SSL is an Apache module that enables Apache to establish connections and transfer data in a secure, encrypted environment. With SSL certificates, all login information and other important confidential information are transmitted in an encrypted manner over the Internet, which prevents our data from being stolen or IP spoofing.

How to use SSL in Apache

Every time an HTTPS request arrives, Apache performs the following three steps:

Apache generates its private key and converts the private key to a. CSR file (certificate issuance request).

Then Apache sends a. CSR file to the CA (certificate Management Center).

The CA receives the. CSR file and converts it to a. CRT (certificate) and then sends it back to Apache to complete the HTTPS connection request.

This is the most popular 25 questions that are currently being asked by the interviewer, please share the interview questions you have been asked about in the comments section below to help other interviewers.

  • Related Article

    E-Commerce Solutions

    Leverage the same tools powering the Alibaba Ecosystem

    Learn more >

    Apsara Conference 2019

    The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

    Learn more >

    Alibaba Cloud Free Trial

    Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

    Learn more >

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.