0% found this document useful (0 votes)
9 views2 pages

Apache Conf

This document provides a step-by-step guide to install and configure the Apache HTTP server on a Linux system. It includes commands for starting the server, configuring firewall settings, creating a basic HTML page, and setting up virtual hosting for multiple domains. The final steps involve editing the httpd configuration file and updating the hosts file for domain resolution.

Uploaded by

singhsachin2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Apache Conf

This document provides a step-by-step guide to install and configure the Apache HTTP server on a Linux system. It includes commands for starting the server, configuring firewall settings, creating a basic HTML page, and setting up virtual hosting for multiple domains. The final steps involve editing the httpd configuration file and updating the hosts file for domain resolution.

Uploaded by

singhsachin2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

yum install httpd* -y

systemctl start httpd


systemctl enable httpd
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
netstat -tunlp | grep httpd
cd /var/www/html [ it's a default documant root]
vim index.html
<html>
<title> linux admin </title>
<body>

<marquee> Redhat Training center ........ </marquee>

</body>

</html>

# systemctl restart httpd


# httpd -t
# then goto browser and run command => http://example.node1.com # localhost # ip

## curl http://example.node1.com
if this comand is running so your apache server is ok.

=============================================================================
=============================================================================

now we are going to configure virtual hosting ?

## cd /var/www
# mkdir google
# mkdir yahoo
# cd google
# echo "this is my google page" > google.html
# cd yahoo
# echo "this is my yahoo page" > yahoo.html
# cat yahoo.html
# pages are ready then edit main file.

# vim /etc/httpd/conf/httpd.conf
============================================
<VirtualHost 192.168.65.133:80>
ServerAdmin [email protected]
ServerName example.node1.com
DocumentRoot /var/www/html
</VirtualHost>

<VirtualHost 192.168.65.133:80>
ServerAdmin [email protected]
ServerName google.node1.com
DocumentRoot /var/www/google
DirectoryIndex google.html
ServerAlias google.com
CustomLog "logs/google_access.log" combined
ErrorLog "logs/google_error.log"
</VirtualHost>

<VirtualHost 192.168.65.133:80>
ServerAdmin [email protected]
ServerName yahoo.node1.com
DocumentRoot /var/www/yahoo
DirectoryIndex yahoo.html
ServerAlias yahoo.com
CustomLog "logs/yahoo_access.log" combined
ErrorLog "logs/yahoo_error.log"
</VirtualHost>
<Directory /var/www/google>
require all granted
</Directory>
<Directory /var/www/yahoo>
require all granted
</Directory>
============================================
# systemctl restart httpd
# httpd -t
# vim /etc/hosts
192.168.65.133 example.node1.com
192.168.65.133 google.node1.com
192.168.65.133 yahoo.node1.com

You might also like