Running Simple Apache Web Server on Linux!

Status
Not open for further replies.

mediator

Technomancer
Simple Apache Web Server on Linux!

HI,
This is a simple tutorial to get ur http server running with installed apache!
This covers 2 things
1. Problems dealt with getting apache running
2. making virtual hosts, "*mediator" etc like the default "*localhost"!


Part A - Setting up local host, getting defaults to run and dealing with problems

1. First of all u have to get the httpd daemon up and running.
Code:
/etc/init.d/httpd start
2. Next...open up the browser type "localhost" an enter. If its running with default page then ur blessed!
3. If problem start then check Selinux protection! U shud disable SELinux protection for httpd daemon! For fedora5 u can do that by "System->Administration->security level and firewall"
4. It shud work now! Proceed to step 2
5. Next if still it encounters problems, then check for path permission! and give the "Document root" path a permission of 755!

Code:
chmod 755 /whatever_path
Code:
chmod 755 /whatever_path/www
where www is the directory where ur html,php files exist!


Part B -Setting up simple Virtual hosts that can run on loopback

Now to make simple aliases that u can use to test ur project and sites workings!
1. Here's my code that u shud put append to ur httpd.conf file!
This works when u open up ur browser and type "*mediator"!

Code:
# Virtual host mediator
<VirtualHost 127.0.0.2:80>
DocumentRoot /home/kareena/www
ServerName mediator
<Directory /home/kareena/www>
order allow,deny
allow from all
</Directory>
<Location /home/kareena/www>
order allow,deny
allow from all
</Location>
DirectoryIndex index.html index.htm index.shtml index.php
</VirtualHost>

Here kareena is the username of ur normal account, www is the directory where ur files(html,php etc) are and mediator is the name of the virtual host!

2. Next u shud proceed similarly like the stuff posted in Part A
3. One most important thing is "127.0.0.2" added here! Where will be this IP looked for? For simple loopback we have "/etc/hosts" file that keep telling the browsers that 127.0.0.1 is a loopback! All the Linux distros have this "127.0.0.1" entry in this file. But I was surprised to see that my previous Knoppix distro didnt had this entry because of which neither mah http server started nor the mysql database/daemon!
So append "127.0.0.2" at the end of "/etc/hosts".

The final file shud look something like this!

Code:
127.0.0.1 localhost.localdomain localhost Ozone
127.0.0.2               mediator
where mediator again is the name of the Virtual Host!



Well thats it for now :) ! If u have any further problem then the MODS will be happy to solve it for u :D!

All those who already know such stuff can stop making comments like "I Already know that " etc!
 
Last edited:
Status
Not open for further replies.
Top Bottom