Find the answer to your Linux question:
Results 1 to 4 of 4
hi, I just installed FC4 and followed someonline tutorials to get Apache running. Yes, I can see the default Apache welcome page that comes with Fedora. Reading more in Virtual ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Nov 2004
    Posts
    167

    Needs help - Virtual Hosting


    hi,

    I just installed FC4 and followed someonline tutorials to get Apache running.

    Yes, I can see the default Apache welcome page that comes with Fedora.
    Reading more in Virtual hosts, I was able to set up a sample virtual host after editing the following:
    * httpd.conf at /etc/httpd/conf/httpd.conf,
    * hosts file at /etc/hosts

    and then the actual "virtual-host-example" DIR whose content is "index.html" - hello world. The DIR is placed at /var/www/html......from all that I read.

    It works fine, and I was able to set up another sample virtual hosts site.....with a different DIR name at /var/www/html.....I can access this second sample host via my web browser.

    I then tried a third, however the DIR(virtual-host-5) is placed at /home/toks, modified the :
    * httpd.conf at /etc/httpd/conf/httpd.conf,
    * hosts file at /etc/hosts

    accordingly. I also did a "chmod -R 755 /home" for permissions.

    Q1) when i try to access "http://virtual-host-5.com" i Get the error
    Forbidden...You dont have permission to access / on this server....additionally, a 403 Forbidden error was encoutnered while trying to use and ErrorDocument to handle the request........Apache 2.0.54 Fedora server at virtual-host-5.com Port 80
    Q2) how do I access the working virtual-host examples from another computer within my lan.

    For an index.html file on the server, by typing the IP address of my server on my browser of another PC(WinXP), i can see Fedoras default page etc....I also tried the "server-IPaddress/virtual-host-example" from my LAN PC, but it results in page cannot be displayed.

    Note i can access all the working virtual-host-examples on my FC4 browser directly.

    pls help
    Toks

  2. #2
    wfw
    wfw is offline
    Just Joined!
    Join Date
    Jan 2005
    Location
    Bulgaria
    Posts
    26
    A1) maybe the user which runs apache has no permission to read the /home/blabla directory.
    A2) there are two ways to do that: first in every computer you should edit the hosts file... YES in windows DOES have that file... in ~ c:\windows\system32\drivers\net\hosts maybe... the second way is to setup a DNS server which should be setup to all computers which you want to access the virtual hosts.
    A3) you can make symlinks in /var/www/html to all virtual domains.
    ex. /var/www/html/www.domain.com points to /home/virtual/www.domain.com

  3. #3
    Linux Newbie
    Join Date
    Nov 2004
    Posts
    167
    thanks wfw,

    1) the user which runs my apache is "apache".

    How do i give it a permission to read the /home/blabla DIR....?
    i already have chmod 777 /home on my home DIR.....will this suffice?

    2) Yeah, theres a 'hosts' file on my windows pc....how do i edit it? what do i add/delete? i hope this will not screw up my winxp....

    3) I read up about the symlinks stuff. I think ill be more comfortable with this. how do i make a symlink from /var/www/html to all virtual hosts....do i have to create some file there, or ?

    toks

  4. #4
    wfw
    wfw is offline
    Just Joined!
    Join Date
    Jan 2005
    Location
    Bulgaria
    Posts
    26
    hi again
    1) in fedora (i think) every user has a group named like the name of the user. so you can add apache user in the /etc/group in every user's group which should be read from the apache user.
    for example:
    blabla user has record in /etc/group
    Code:
    blabla:x:1001:blabla
    you should change it to:
    Code:
    blabla:x:1001:blabla,apache
    now apache has a group rigths for that user. simply chmod 750 /home/blabla and user blabla will read-write in his own home dir, apache will ONLY read in that dir, and everybody else will not be allowed to read the directory... this is some kind of security improvement

    2) this file has no extension, but it is simple text file. you can edit it with your favourite text editor. there is one record inside for the localhost.. so you can see the exact syntax.

    3) check
    Code:
    man ln
    links are made by this command:
    Code:
    ln -s /home/blabla /var/www/html/blabla
    now you can access the domain via http://YOUR_IP_ADDRESS/blabla,
    but you should add in your httpd.conf:
    Code:
    Options FollowSymLinks
    in the <Directory /> directive. this will make apache to follow the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •