Introduction to Web Servers The World Wide Web, as it is known today, began as a project of Tim Berners-Lee at the European Center for Particle Physics (CERN). The original goal was to provide one consistent interface for geographically dispersed researchers and scientists who needed access to information in a variety of formats. From this idea came the concept of using one client (the Web browser) to access data (text, images, sounds, video, and binary files) from several types of servers (HTTP, FTP, SMTP, Gopher, NNTP, WAIS, Finger, and streaming-media servers). The Web server usually has a simpler job: to accept HTTP (HyperText Transfer Protocol) requests and send a response to the client. However, this job can get much more complex (as the server can also), executing functions such as: Performing access control based on file permissions, user name/password pairs, and host name/IP address restrictions. Parsing a document (substituting appropriate values for any conditional fields within the document) before sending it to the client. Spawning a CGI (Common Gateway Interface) script or custom API (Application Program Interface) program to evaluate the contents of a submitted form, presenting a dynamically created document, or accessing a database. Sending a Java applet to the client. Logging any successful accesses, failures, and errors. The Apache Web server Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development, it quickly became the most popular HTTP client on the web. Apache is also the base for several other Web servers, most of which use Apache's freely available source code and add improved security features such as SSL (Secure Sockets Layer) for encrypted data transfer or advanced authentication modules. The main features of the Apache Web server include: The stability and rapid development cycle associated with a large group of cooperative volunteer programmers. Full source code, downloadable at no charge. Ease of configuration using plain-text files. Access-control based on client host name/IP address or user name/password combinations. Support for server-side scripting as well as CGI scripts. A custom API that enables external modules (for example, for extended logging capabilities, improved authentication, caching, connection tracking, and so on) to be utilized by the server daemon. Apache is not the only Web server available for Red Hat Linux, but it is the one most commonly used with Red Hat Linux, and is the most popular server used on the Internet. In addition to Apache, Red Hat Linux comes with the TUX Web server.
Step 1: Installation of Apache webserver: To install apache use following code [raju@localhost ~]$ sudo yum install httpd To check whether apache service is already installed or not use following command [raju@localhost html]$ rpm -q httpd httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64 Step 2: Start the Http process After installation of apache start the httpd service and to enable apache service even after system reboot use following command respectively: [raju@localhost ~]$ systemctl start httpd [raju@localhost ~]$ systemctl enable httpd Finally to check Apache service status use following command: [raju@localhost ~]$ systemctl status httpd Step 3: Allow through firewall Configure firewall to allow http and https services which will allow port 80 and 443 incoming connection use following command [raju@localhost html]$ sudo firewall-cmd --add-service=http --permanent [raju@localhost html]$ sudo firewall-cmd --add-service=https To ensure these services are allowed use following command. [raju@localhost html]$ sudo firewall-cmd --list-all Step 4: Create index.html file Once all above processes are executed now create index.html using any text editor by going to [raju@localhost html]$ cd /var/www/html #index.html
My First Heading
My first paragraph.
Step 5: Configuring the Apache Server The primary file for configuring your Apache Web server is httpd.conf (located in the /etc/httpd/conf directory). All Apache configuration files are plain-text files and can be edited with your favorite text editor. Some individual modules within Apache, such as perl, php, and mysql, have individual configuration files that may interest you. Those files are contained in the /etc/httpd/conf.d directory. Configuring the Web server (httpd.conf) The httpd.conf file is the primary configuration file for the Apache Web server. It contains options that pertain to the general operation of the server. The default filename (/etc/httpd/conf/httpd.conf) can be overridden by the -f filename command-line argument to the httpd daemon or the ServerConfigFile directive. The following sections list the contents of the httpd.conf file and describe how to use the file. Important httpd.conf file Settings The following are some of the essential blocks in the httpd.conf file. It is good to note that some of the blocks stated in this section might not be in the default apache config file. AccessFileName – This directive defines the name of the file used for access control information in each directory. The default value is set to .htaccess. AddType – This directive overrides the default MIME type and file extension pair. Listen – The listen directive specifies which port the webserver will listen from for incoming requests. By default, this value is set to port 80 for HTTP and port 443 for HTTPS. LoadModule – The load-module directive is used to load Dynamic Share Objects. Location – The location tags (
and ) are used to create a container for access control based on an URL. MaxClients – This directive defines the limit for the total number of server processes or the number of simultaneously connected clients.
VirtualHost – The VirtualHost tag block creates a container for virtual hosts, allowing multiple sites to run in one server. The
block can accept other blocks. ServerRoot – This directive is used to define the top-level dir for the website contents. The default value is set to /etc/apache2 or /etc/httpd. ServerName – defines the hostname and port for the server. PidFile – defines the filename for the server PID file. By default, the value is set to /var/run/apache2/apache2.pid or /var/run/httpd/httpd.pid LogLevel – determines the log verbosity level. MaxKeepAliveRequests – this directive defines the maximum number of requests per one persistent connection. The value is set to 100 by default. DocumentRoot – The document root is the directory containing the HTML files served to the clients. This value is set to /var/www/html by default. ErrorLog – The location where the log file is stored. By default, this value is set to /var/log/apache2/erro.log or /var/log/httpd/error.log DirectoryIndex – This directive sets the default page served to the clients when the index location is requested. By default, this value is set to index.html. If no index value is found, the server will list directories (if enabled) or a 403 forbidden error if the directory listing is disabled. Allow – This defines the client given access to a specific directory. The client can be a domain name, IP address, network mask, etc. Works similar to Deny. AllowOverride – This directive determines if the value of a specific directive is overridable in the .htaccess file. AddHandler – The handler extension maps file extensions to their respective handlers. For example, .cgi files can be mapped to a cgi-script handler. Step 6: Monitoring Server Activities Apache provides two unique built-in methods to check the performance of your Web server. The server-status handler can be configured to show information about server processes. The server- info handler can be configured to display a detailed summary of the Web server's configuration. You can activate these services by adding the following lines to the /etc/httpd/conf/httpd.conf file, respectively:
SetHandler server-status Order deny,allow Deny from all Allow from bcadepartment.com SetHandler server-info