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

DocumentRoot /ipbasehost/
DirectoryIndex index.html

Save the file and exit.

Let me explain above four lines

=> This indicates we are creating a virtualhost who's IP addresse is

DocumentRoot /ipbasehost/ => This indicates where is my document root i.e., all my web content should be placed under /ipbasehost/ So this content will be published through website.

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.

=>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.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Archive

    Translate this page


    The Linux Juggernaut | Copyright 2006-2009 Surendra Kumar Anne | Surendra's Home Page | Give us feedback how we are doing, Click here