Results 1 to 8 of 8

Thread: HTTP Server and VirtualHosts issues

  1. #1

    Default HTTP Server and VirtualHosts issues

    Ok,I have been working on this for days and looking in forums, haven't found an answer yet.. SO, I need lots of help... Yes, I'm a newb but sort of know my way around PC's.. here is what I have.

    Current setup = 11.2 OpenSuse on desktop hardware, I have 2 websites I want to host and do so now on a windows xp with apache2. I have one IP and hosting multiple sites some same machine / IP.

    1. I installed Apache2
    2. I installed HTTP Server
    3. By default the location for hosting is svr/www/htdocs (this is not changeable via the HTTP Server application or i don't know how, but i have tried)
    4. I add website 1 files here
    5. I restart the http server
    6. test by viewing website1 from another machine via url
    result > works

    7. I try to add website2 in the Virtual host tab of HTTP Server by adding the document root = /srv/www/htdocs/website2
    8. Server Name = website2
    9. Admin Email required
    10. Change VirtualHost ID = *
    11. Enable the 'Determine Request Server by HTTP Headers'
    12. Select OK
    13, Most of the time this is saves as is but sometimes the option defaults to 'Determine Request Server by Address IP' config file in the vhosts.d folder.
    14. Select OK, when I test this... I always get the website2 even when i put in website1 url..

    I have read the Apache HTTP VitrualHosts section, this has nothing to do with that. please don't refer me to read that.. I can't figure out to setup suse 11.2 HTT Server Main Host tab and/or Hosts tab to host both of the my sites. I have been trying to this for days now and at my wits end... Can some please give me detailed steps on how to correct this.. if you want more information to help, please be specific on how to get the information you need to expedite the resolution.. I know it is a configuration issue but I'm not a wizard web admin to know this... I will try to check replies daily if not more. Thanks in advance for any help and or suggestions.

  2. #2
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,648

    Default Re: HTTP Server and VirtualHosts issues

    How did you install Apache? There is a pattern In Yast that should be used. If you installed by hand you may have missed something.

  3. #3

    Default Re: HTTP Server and VirtualHosts issues

    Apache2 was installed by yast, LAMP was also installed by Yast, please note, i can get one website to show if I put the files in the default location /svr/www/htdocs location per what shows in the Main Host tab of the HTTP Server config gui... but i'm not 100% sure i'm doing the configuration correctly when it comes to hosting 2 websites from suse linux 11.2. I have tried adding the virtualhost directly to the Apache2 httpd.conf file at the bottom as per the Apache2 <VirtualHost> documentation shows but no luck as of yet, if you know of a suse help page that shows how to install and setup Apache2/LAMP for 11.2 step by step, please link it, i can't find it. Thanks again for the reply... keep sending the suggestions.

  4. #4

    Default Re: HTTP Server and VirtualHosts issues

    I'm trying to find a way to let you guys see the screens shot of the Main Host tab and maybe you guys can direct me on what to correct or do.. I can get the Main Host working, but the 'virtual host' fails miserably and I have tons of combinations of values and option in the Host tab. I can't add pictures to help out so I'll need a better way to show the information...

    If someone will work directly with, i'll send screen shots over email as I have run completely out of options for testing different configuration and i'm about ready to give up trying on Linux all together as the online documentation lacks the explanation of a 'working' virtual host setup. if anyone is interested please post way of contact and I'll gladly to do all I can to get this resolved... thanks in advance...

  5. #5

    Default Re: HTTP Server and VirtualHosts issues

    first is important to know that any location you use for DocumentRoot must be accessible permissions for entire hierarchy of the directory.

    istr apache complains very cryptically when it is a parent directory permissions issue.

    i've had best luck with using yast to write an initial configuration - then editing it by hand. actually have had yast modify a working configuration in ways unintended.

    select ip-based virtual hosts - because you don't want the dns server involved in every request.

    then yast will write out this file:

    vhosts.d/ip-based_vhosts.conf

    am presuming you have multiple ways a request might arrive at your server, e.g. if fred.example.com and barney.example.com both point to your ip... also note if you're using a nat address it will be the ip address of your router that apache sees (in most cases).

    here are some example virtual host entries for ip-based_vhosts.conf - obviously the NamedVirtualHost entries could (and do in many examples, dunno why) appear in earlier conf files.

    HostnameLookups Off
    UseCanonicalName On


    NameVirtualHost a.b.c.d:80

    <VirtualHost _default_>
    # identity
    DocumentRoot /srv/www/htdocs
    # redirection
    # RedirectMatch permanent /(.*) http://www.elsewhere.com/$1
    CustomLog /var/log/apache2/default.log combined
    </VirtualHost>

    <VirtualHost a.b.c.d:80>
    # identity
    DocumentRoot /srv/www/fred
    ServerName fred.example.com
    CustomLog /var/log/apache2/fred.log combined
    </VirtualHost>

    <VirtualHost a.b.c.d:80>
    # identity
    DocumentRoot /srv/www/barney
    ServerName barney.example.com
    CustomLog /var/log/apache2/barney.log combined
    </VirtualHost>


    hope that helps you get going.
    Last edited by chaosless; 09-Jun-2010 at 18:23. Reason: munged the http://

  6. #6

    Default Re: HTTP Server and VirtualHosts issues

    Thanks chaosless,

    But unfortunately i have been trying to figure out how to implement your suggested changes in the defined vhosts.d/ip-based_vhosts.conf file. I did add what you suggested and it still doesn't work.. if you need me to specific things please step them out. I'm not real fluent on how all this configuration works, so if you need me to do something please step is out. To give you a good idea of what my setup is and how i'm doing this i'll give lots of details..

    Network configuration:
    Home based desktops behind a Linksys 320N router: port 80 is forwarded to this machine.

    All I want it so host 2 websites from this one machine: one folder for consulting (for instances consulting is the folder name) and one folder for family. Both of these folders, i'm guess, need to be in /srv/www/htdocs location like this...
    /srv/www/htdocs/website1 and /srv/www/htdocs/consulting
    /srv/www/htdocs/website1 and /srv/www/htdocs/family

    1. Install Suse 11.2
    2. Install Apache2 via Yast
    3. Go to Yast / HTTP Server and Open
    4. upon opening i see in the Main Host tab the following
    - Document Root "/srv/www/htdocs"
    - Directory "/srv/www/htdocs"...
    - Alias /icons/"/usr/share/apache2/icons/"
    - Directory "/usr/share/apache2/icons"...
    - ScriptAlias /cgi-bin/"/srv/ww/cgi-bin/"
    - Directory "/srv/www/cgi-gin"
    - mod_userdir.c
    - include /etc/apache2/conf.d./*.conf
    - include /etc/apache2/conf.d/apache2-manual?conf
    - Server Name mooneyham.homedns.org
    - Server Admin E-Mail my@email.com

    and right now, there is nothing else in the 'Hosts'

    Now, when I add all my web files from the consulting folder to the location /srv/www/htdocs, this works just fine for this one website... but now I want to add another website 'Family' to this same box... my isp uses dynamic ip's. I'm using DynDNS to setup 2 different urls.... one is http://www.mooneyham.homedns.org and the other is http://mooneyhamfamily.selfip.com.
    ...

    What are the steps that I need to do in order to host this second website? Please be very specific and step out what I need to do and look for.. I have been trying MANY different types of configurations but with no luck at all.
    If you are talking permissions, please describe how to check... Do I check that in YAST users? Do I check the folder properties/permissions/advanced..? please be specific. I have gotten to points where the family website would show, but that is all. I couldn't get to the consulting website... I really appreciate your help in this situation and please remember, I don't know how the the configurations work together very well for apache2.. I'm not very fluent with website administration and the workings...

    Thanks in advance again..

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: HTTP Server and VirtualHosts issues

    Your 2 sites seem to be working for me. You have to test it from the outside.

  8. #8

    Default Re: HTTP Server and VirtualHosts issues

    Quote Originally Posted by ken_yap View Post
    Your 2 sites seem to be working for me. You have to test it from the outside.
    ken_yap , yes, probably at about the time you checked this, I figured it out, sorry for the delay in response but I went outside to dance a jig for joy that I figured it out... The HOSTS tab in the HTTP Server of Yast doesn't need to be touched at all.. I added the following to the bottom of the httpd.conf file and that seemed to do the trick...
    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName Home
    DocumentRoot /srv/www/htdocs/consulting
    </VirtualHost>

    <VirtualHost *:80>
    ServerName mooneyhamfamily.selfip.com
    DocumentRoot /srv/www/htdocs/family
    </VirtualHost>

    That is all that was needed. I was trying to make the HOSTS tab do that configuration for me, but for the life of me, haven't figured out why or what that HOSTS tab is used for.. I'm very sorry for the inconvenience but this is all that is needed from the configuration side of the file to host multiple sites from same machine with 1 ip. Thanks ken_yap for replying back...

Posting Permissions

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