WEb Server....Adding virtual...host how?

Status
Not open for further replies.

mediator

Technomancer
Post has been edited
Please If u have experience in making web server then please post else dont post by copying articles from net ect.! Coz I'm really frustrated reading samething again n again! My first question below has been solved..answer my 2nd one...scroll down below!
Forbidden
You don't have permission to access /index.html on this server.


This is the error that is killin me now whenever I try to access the the page!
The index.html page resides in /var/www/html.... I tried to run it through different browsers but no luck.

Previosly it was working fine but when I removed the index.html and made a new one the problem started! I tried index.htm with no luck. I added date.php to /var/www/html and can access it with *localhost/date.php, but *localhost/index.html gives me the reported error!

Help please..Thanx in advance!
 
OP
mediator

mediator

Technomancer
Thanx man...that really worked...755 worked!

And can explain what is 755..I forgot that! I remember it has somethin to do with user,group,others like that!


One thing more I wanna set up virtual hosts..can u explain how to do that?
my configuration file for *med.dl is as..
<VirtualHost 127.0.0.2>
DocumentRoot /home/mediator/www
ServerName med.dl
DirectoryIndex index.html index.htm index.shtml
</VirtualHost>
I thought it wud be OK..but when i tried *med.dl and *localhost/med.dl it gave "The requested URL /zwat was not found on this server." error!.
When I tried *127.0.0.2 it said "You don't have permission to access / on this server" error again!

I want to setup a virtual host "med"...So that whenever i try to browse *localhost/med it points to /home/mediator/www

I also tried 755 permission for this one bt v.host cudnt bed established!
 

desertwind

Cyborg Agent
755 stands for -rwxr-xr-x

Its sets permisions in the following order. owner, group, others
4 for read, 2 for write and 1 for execute. simply add the numbers for which all permissions you need to set up. for allowing read and execute, 4+1=5. for allowing read and write, 4+2=6.

755 stands for read,write and execute to owner, read and execute to group, read and execute to others.

Regarding virtual Hosts, read this
 
OP
mediator

mediator

Technomancer
Tried...
# Virtual host 127.0.0.2
<VirtualHost 127.0.0.2>
DocumentRoot /home/med/www
<Directory "/home/med/www">
Options all
AllowOverride none
</Directory>
ServerPath /med
ServerName localhost

DirectoryIndex index.html index.htm index.shtml
<Directory "/home/med/www">
Options all
AllowOverride none
</Directory>
</VirtualHost>

But no Luck!
 

desertwind

Cyborg Agent
The default value of userDir in httpd.conf is set to disable. comment that line and uncomment the line userDir public_html
 
OP
mediator

mediator

Technomancer
Yea Already know now how to configure everything...neways thanx for concern! Now I need to know how to lock the topic!
I had initially configured selinux to allow the virtual host...but the problem persisted.....so i configured host file and permissions...added a entry in it and hooray it worked!
 
OP
mediator

mediator

Technomancer
OK here's the complete process I learnt after years of research to setup a web server completely on a local machine (loopback) ! To setup network http server u dont have to edit host file!



Setting Web server
"*mediator" ..... on local machine ...loopback


1.
HOST FILE
/etc/host

127.0.0.1 localhost.localdomain localhost Machine_Name
127.0.0.2 mediator


2.
READ PERMISSIONS
755 stands for -rwxr-xr-x

Its sets permisions in the following order. owner, group, others
4 for read, 2 for write and 1 for execute. simply add the numbers for which all permissions you need to set up. for allowing read and execute, 4+1=5. for allowing read and write, 4+2=6.

755 stands for read,write and execute to owner, read and execute to group, read and execute to others.

So that the error "You do not have permission to..." doesnt occur for new directory such as /home/user1/www the whole path must be readable and code executable. Apache by default doesnt have permission to read into /home/user1 directory
permission -> 755 or 745
command...."chmod 755 /home/user1"..."chmod 755 /home/user1/www"
command...."chomd 755 /home/user1/www.index.html"


3.
HTTPD FILE
~../httpd.conf

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


If problem Still persists..Then configure the seLinux to allow the document directory...or disable selinux for http service as last resort!!
 
Status
Not open for further replies.
Top Bottom