A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
We strongly recommend that you do not memorize things by rote, and that everything must first be tried and understood in the actual scene.
1. What is 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 on HTTP Hypertext Transfer Protocol, which provides the standard for communication between server and client Web browsers. It supports SSL, CGI files, virtual hosts, and many other features.
2. What if you check Apache and its version?
Answer: First, use the RPM command to check if Apache is installed. If it is already installed, use the Httpd-v command to ginger its version.
[Root@tecmint ~]# Rpm-qa | grep httpd
[Root@tecmint ~]# Httpd-v
Server version:apache/2.2.15 (Unix)
Server Built:aug 13 2013 17:27:11
3. Apache runs with that user? Where is the main configuration file located?
Answer: Apache runs with the "Nobody" user and the httpd daemon. The main configuration files for Apache are:/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 to HTTP on port 80 and listens on HTTPS on port 443 (SSL integers are required). You can also use the netstat command to check the port.
[Root@tecmint ~]# NETSTAT-ANTP | grep http
TCP 0 0:: £ º::* LISTEN 1076/HTTPD
TCP 0 0::: 443:::* LISTEN 1076/httpd
5. How do I install the Apache server on your Linux machine?
Answer: Very simply, you can use any of the Yum on (Rhel/centos/fedora) and the Apt-get on (debian/ubuntu) 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: The Apache default configuration path is placed in: (Rhel/centos/fedora) in/etc/httpd/on and (Debian/ubuntu) under/etc/apache2.
[Root@tecmint ~]# cd/etc/httpd/
[Root@tecmint httpd]# Ls-l
Drwxr-xr-x. 2 root 4096 Dec 21:44 conf
Drwxr-xr-x. 2 root 4096 Dec 02:09 conf.d
lrwxrwxrwx 1 root Oct 19:06 logs->. /.. /var/log/httpd
lrwxrwxrwx 1 root Oct 19:06 modules->. /.. /usr/lib/httpd/modules
lrwxrwxrwx 1 root Oct 19:06 run->. /.. /var/run/httpd
[Root@tecmint ~]# Cd/etc/apache2
[Root@tecmint apache2]# Ls-l
-rw-r--r--1 root root 7113 16:15 apache2.conf
Drwxr-xr-x 2 root 4096 Dec 11:48 conf-available
Drwxr-xr-x 2 root 4096 Dec 11:45 conf.d
Drwxr-xr-x 2 root 4096 Dec 11:48 conf-enabled
-rw-r--r--1 root root 1782 02:14 Envvars
-rw-r--r--1 root root 31063 02:14 Magic
Drwxr-xr-x 2 root 12288 Dec 11:48 mods-available
Drwxr-xr-x 2 root 4096 Dec 11:48 mods-enabled
-rw-r--r--1 root root 315 02:14 ports.conf
Drwxr-xr-x 2 root 4096 Dec 11:48 sites-available
Drwxr-xr-x 2 root 4096 Dec 6 00:04 sites-enabled
7. Can Apache be fixed by the TCP wrapper?
Answer: No, it cannot be fixed by the TCP wrapper because it does not support the Linux Libwrap.a library.
8. How to change the default port in Apache and how to 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 instructions, we can listen to Apache on different ports and different interfaces.
Suppose you have multiple IP registrations to your Linux machine and want Apache to receive HTTP requests on a particular Ethernet port or interface, even if this requirement can be done with listen instructions.
To change the default port for Apache, 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
looks for the word "Listen", notes the original line, and writes your own instructions under that line.
Save file and restart Web server.
[root@tecmint ~]# service httpd restart
[root@tecmint ~]# service apache2 Restart
9. We can have a machine. Do you have two Apache Web servers on it?
Answer: Yes, we can run two different Apache servers on a single Linux machine, but only if they are listening on a different port, and we can use Apache's listen instructions to change the port.
10. Do you know what the documentroot of Apache means?
Answer: DocumentRoot's Apache means the location where 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 virtual host Configuration "DocumentRoot" on the host.
11. How do I manage files under different folders, and what are the Alias commands?
Answer: Yes, this can be done with the help of the alias command in the main Apache configuration file. The Alias directive can netizens resources 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:
In the example above, 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 called URL mapping.
12. How do you understand the "DirectoryIndex"?
Answer: DirectoryIndex is the file that Apache will look for first 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 be shown) to the site's root directory.
The default setting for DirectoryIndex is. html index.html index.php, if this is not the name, you need to modify the apache2.conf value in httpd.conf or DirectoryIndex to display it in the On your client browser.
# directoryindex:sets The file that Apache would serve if directory a
# is requested.
# The Index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is a much slower.
DirectoryIndex index.html index.html.var index.cgi. exe
13. How do I invalidate the directory list when the index file is missing?
Answer: If the primary index file in the site root directory is invalidated, Apache will list all the similar files on the browser to replace the site home page.
To close the list of Apache directories, you can set the global settings in the main configuration file, or in the. htaccess file, some of the following rules are set up.
what are the different log files for the Apache Web server?
Answer: The default log file for the Apache Web server is to access the log "/var/log/httpd/access_log" and 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 servicing the request, the end user disconnects, and we see "Connection reset by peer" in the error log.
16. What is Apache's virtual host?
Answer: The virtual host part contains information including 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 parameters of the server name and document root directory. On Linux machines, we usually set the configuration of our virtual host part at the end of the httpd.conf file.
Virtual Host Sample
Customlog Logs/dummy-host.example.com-access_log Common
ServerAdmin: usually refers to the site owner's e-mail, errors and notices can be sent to the inside.
Documentroot:web files are located on the server (must be configured).
ServerName: The domain name (must be configured) to access the site through the browser.
ErrorLog: The location of the log file, which records all the logs associated with the site.
What is the difference between <Location> <Directory>?
<Location> is used to set the element associated with the Url/web server's address bar.
<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 two types of virtual hosts: Virtual hosting based on name and virtual host hosting based on IP.
For more information, see How to create a NAME/IP based virtual host in Apache.
19. How do you understand the mpm of Apache?
Answer: MPM means multi processing Modules, which actually refers to some of the mechanisms that Apache follows to accept and complete requests for Web servers.
What is the difference between Worker and prefork MPM?
The answer: They are all mpm, and the Worker and Prefork have their own operating mechanisms on Apache. They depend entirely on which mode you want to start your Apache.
The basic difference between Worker and MPM is that they produce process of subprocess. In Prefork MPM, a primary httpd is initiated, which manages all other child processes to service client requests. In the worker mpm, a httpd process is activated, and different threads are used to service client requests.
Prefork MPM uses multiple subprocess, each with a single thread, and worker MPM uses multiple child processes, each with multiple threads.
In Prefork MPM, each process handles one connection at a time and each thread in the worker MPM processes one connection at a time.
Memory Footprint Prefork MPM consumes a large amount of memory, while a worker consumes less memory.
What is the application of "limitrequestbody" and how can I add a limit to your upload?
Answer: The limitrequestbody directive is used to make a limit on the size of the upload.
For example, I want to add a 100000-byte limit to the/var/www/html/tecmin/uploads directory. Then you need to add the following instructions to the Apache configuration file.
<directory "/var/www/html/tecmint/uploads" >
what is mod_perl and mod _php?
Mod_perl is a Apache module that is compiled with Apache to make simple integration of Perl scripts and improve performance.
Mod_php is used to do a simple integration of Web server PHP scripts, which embed PHP interpreters in the Apache process. It forces the Apache subprocess to use more memory and can only be used on Apache, but it is still popular.
What is mod_evasive?
Answer: It's 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 confidence, please read this article, which will guide you through how to install and configure mod_evasive in Apache.
What is LogLevel debugging 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's 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 transmit data in a secure cryptographic environment. With an SSL certificate, all login information and other important confidential information are transmitted over the Internet in an encrypted manner, preventing our data from being stolen or IP spoofing.
How to use SSL in Apache
Each time the HTTPS request arrives, Apache performs the following three steps:
Apache generates its private key and converts the private key to a. CSR file (a certificate issuance request).
Apache then 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 question currently asked by the interviewer, please share your recent interview questions in the comments section below to help other interviewers.
Start building with 50+ products and up to 12 months usage for Elastic Compute Service