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

Discussion in 'Open Source' started by mediator, Jan 24, 2006.

Thread Status:
Not open for further replies.
  1. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    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 http://localhost/date.php, but http://localhost/index.html gives me the reported error!

    Help please..Thanx in advance!
     
  2. praka123

    praka123 left this forum longback

    Joined:
    Sep 7, 2005
    Messages:
    7,513
    Likes Received:
    24
    Trophy Points:
    0
    Location:
    -
    Did U entered the dir containing index.html in the Apache config file
     
  3. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    U mean documentroot..then yes!
     
  4. desertwind

    desertwind New Member

    Joined:
    Nov 2, 2004
    Messages:
    1,096
    Likes Received:
    10
    Trophy Points:
    0
    Location:
    Hyderabad
    Have you set read permissions to all ?

    try

    Code:
    $ chmod 755 index.html
     
  5. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    i'll try that n post again...but what do u mean by all?
     
  6. desertwind

    desertwind New Member

    Joined:
    Nov 2, 2004
    Messages:
    1,096
    Likes Received:
    10
    Trophy Points:
    0
    Location:
    Hyderabad
    Read it as

    Have you set read permissions to all users?

    Thats what the code is meant for.
     
  7. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    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 http://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 http://med.dl and http://localhost/med.dl it gave "The requested URL /zwat was not found on this server." error!.
    When I tried http://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 http://localhost/med it points to /home/mediator/www

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

    desertwind New Member

    Joined:
    Nov 2, 2004
    Messages:
    1,096
    Likes Received:
    10
    Trophy Points:
    0
    Location:
    Hyderabad
    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
     
  9. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    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!
     
  10. desertwind

    desertwind New Member

    Joined:
    Nov 2, 2004
    Messages:
    1,096
    Likes Received:
    10
    Trophy Points:
    0
    Location:
    Hyderabad
    Also try changing userDir to public_html
     
  11. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    I didnt get that one! Can u explain?
     
  12. desertwind

    desertwind New Member

    Joined:
    Nov 2, 2004
    Messages:
    1,096
    Likes Received:
    10
    Trophy Points:
    0
    Location:
    Hyderabad
    The default value of userDir in httpd.conf is set to disable. comment that line and uncomment the line userDir public_html
     
  13. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    Yea tried that one but still no luck! HElp!
     
  14. theKonqueror

    theKonqueror CCIE# 20863

    Joined:
    Dec 24, 2004
    Messages:
    166
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Outside the Matrix
    R U having SELinux???? in that case, u gotta check the security context...
     
  15. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    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!
     
  16. desertwind

    desertwind New Member

    Joined:
    Nov 2, 2004
    Messages:
    1,096
    Likes Received:
    10
    Trophy Points:
    0
    Location:
    Hyderabad
    Thats a bit tough. ;)

    request a mod to do that.
     
  17. mehulved

    mehulved 18 Till I Die............

    Joined:
    Jul 15, 2004
    Messages:
    5,790
    Likes Received:
    44
    Trophy Points:
    0
    Location:
    India, Mumbai, Marine Lines
    Or to request a mod status :-D if you want a longer way around.
     
  18. OP
    OP
    mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    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
    "http://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!!
     
Thread Status:
Not open for further replies.

Share This Page