How To Access Web Server Through IP Address?

How to access web server through ip address(not the default site)?

Step1 : check for the package installed or not

#rpm -qa | grep httpd

Step2 : Install the package

#yum install httpd

Step3 : Create the root web directory and a test index.html for this testing.

I want to create my web directory in /ipbasehost

#mkdir /ipbasehost

Now create index.html and try to write something in to that file then save the file.

#vi /ipbasehost/index.html

save and exit the file.

Step4 : Now edit the httpd.config file

#vi /etc/httpd/conf/httpd.conf

Go to last line and write the below content
Save the file and exit.

Let me explain above four lines


DocumentRoot /ipbasehost/

DirectoryIndex index.html


DirectoryIndex index.html => This indicates what is the default file to be open when this site is accessed. So when you type ip address(here its in browser it will present with
index.html content.

</VirtualHost> This is to specify the end of that virtual host.

Now save the file and exit.

Step5 : Check for the syntax errors in the httpd.conf file before restarting the apache service.

#httpd -t


#httpd -k graceful

Step6 : Now start the service and then add it to booting scripts so that it will start automatically at every boot of the system

#service httpd restart

#chkconfig httpd on

Step7 : Now check the site using ip address in your browser.