Results 1 to 10 of 10

Thread: DNS or Web Server Setting?

  1. #1
    Join Date
    Aug 2006
    Beans
    93
    Distro
    Ubuntu

    Question DNS or Web Server Setting?

    I'm running Ubuntu server on a network and I'm setting that up to handle the incoming web request on port 80 from our DSL Line. So the router sends all port 80 request to our Ubuntu server.

    This part is working so far, so good.

    Now the problem.
    We also have a Windows Home Server (Backup storage & system backups), this works internally.
    So if I try to go to mywindowsserver.homeserver.com the Ubuntu DNS Server points me to my homeserver (192.168.1.78) without issue.

    But, if I try to access it from outside our network, I get my Ubuntu Default page, and it's not directed to 192.168.1.78

    So is this a DNS Issue or do I also have to change / add a setting in Apache?

  2. #2
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: DNS or Web Server Setting?

    Set up a virtual host in Apache that passes requests to the other server using mod_proxy.

  3. #3
    Join Date
    Aug 2006
    Beans
    93
    Distro
    Ubuntu

    Re: DNS or Web Server Setting?

    So Something like this ? on my Ubunu Apache Server should work ?

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName mywindowsserver.homeserver.com

    ProxyRequests Off
    <Proxy *>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
    </Proxy>

    ProxyPass / http://192.168.1.79
    ProxyPassReverse / http://192.168.1.79
    LogLevel debug

    CustomLog ${APACHE_LOG_DIR}/api_access.log combined
    ErrorLog ${APACHE_LOG_DIR}/api_error.log
    </VirtualHost>

  4. #4
    Join Date
    Jun 2012
    Beans
    19

    Re: DNS or Web Server Setting?

    Dont know if this will help in your situation, but this is what I use;

    PHP Code:
    <VirtualHost *:80>
    DocumentRoot root/mysite
    ServerName mysite
    ServerAlias www
    .mysite
    <Directory "root/mysite">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow
    ,deny
    allow from all
    DirectoryIndex Home
    .php
    </Directory>
    </
    VirtualHost>

    <
    VirtualHost *:80>
    DocumentRoot root/mysite2
    ServerName mysite2
    ServerAlias www
    .mysite2
    <Directory "root/mysite2">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow
    ,deny
    allow from all
    DirectoryIndex Login
    .php
    </Directory>
    </
    VirtualHost

  5. #5
    Join Date
    Aug 2006
    Beans
    93
    Distro
    Ubuntu

    Re: DNS or Web Server Setting?

    Ok if I'm using the Mod_Proxy, do I use / keep any settings in the DNS Zones for the site ?

  6. #6
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: DNS or Web Server Setting?

    As long as there is a unique public DNS entry for the virtual server that you're routing to Windows, no. You need a separate entry for each virtual server name even though they both point to the same address. With "name-based" virtual hosts, Apache determines which <VirtualHost> definition to use based on the server name given in the URL. See http://httpd.apache.org/docs/2.2/vhosts/name-based.html for details.

    So in the DNS you might have records in the zone file for example.com like:

    Code:
    www               IN  A     10.10.10.10
    anotherserver     IN  CNAME www
    The CNAME is an alias definition. You could alternatively have an A record for "anotherserver" with the identical IP address. CNAME aliases make it easier to handle changes in IP addresses since you only need to change one record.

  7. #7
    Join Date
    Aug 2006
    Beans
    93
    Distro
    Ubuntu

    Re: DNS or Web Server Setting?

    almost had it
    Code:
    <VirtualHost *:80>
    ProxyPreserveHost on
    ProxyRemote / http://192.168.1.78
    ProxyPassReverse / http://192.168.1.78
    ServerName windowsserver.homeserver.com
    </VirtualHost>
    From my reading should of worked, but I'm getting a 403 error when I try to get their now (Both on site & off site)

    And log is showing this error ?
    [Tue Jun 19 2012] [error] [client xxx.xxx.xxx.xxx] client denied by server configuration: /etc/apache2/htdocs

  8. #8
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: DNS or Web Server Setting?

    Check your virtual hosts. Something must be referencing /etc/apache2/htdocs, a folder that doesn't exist in a stock Ubuntu build.

    One quick test is to grep for htdocs like this:

    Code:
    cd /etc/apache2
    sudo grep 'htdocs' *
    sudo grep 'htdocs' */*
    You should see any files and matching lines where it is referenced.

    Is this a vanilla installation of Ubuntu or Ubuntu Server and a vanilla apache2? Did you try following some online tutorial that might have had you configure something to use /etc/apache2/htdocs? As I say, it's not a directory that's part of a standard Ubuntu installation of apache2.

  9. #9
    Join Date
    Aug 2006
    Beans
    93
    Distro
    Ubuntu

    Re: DNS or Web Server Setting?

    Quote Originally Posted by SeijiSensei View Post
    Check your virtual hosts. Something must be referencing /etc/apache2/htdocs, a folder that doesn't exist in a stock Ubuntu build.

    One quick test is to grep for htdocs like this:

    Code:
    cd /etc/apache2
    sudo grep 'htdocs' *
    sudo grep 'htdocs' */*
    You should see any files and matching lines where it is referenced.

    Is this a vanilla installation of Ubuntu or Ubuntu Server and a vanilla apache2? Did you try following some online tutorial that might have had you configure something to use /etc/apache2/htdocs? As I say, it's not a directory that's part of a standard Ubuntu installation of apache2.
    Both commands come up blank.

    I had followed the tutorial -> http://www.howtoforge.com/perfect-se...ispconfig-3-p2
    but for the version 11 of ubuntu (What was available when I build the server)

  10. #10
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: DNS or Web Server Setting?

    Quote Originally Posted by pgp_protector View Post
    I don't see anything there about configuring apache, just how to install Ubuntu. Is there another page that you followed for apache?

    The directory /etc/httpd/htdocs appears in other distributions like RedHat and its clones (CentOS, etc.). If you build Apache from source it will be installed in /usr/local/etc/httpd with corresponding directory /usr/local/etc/httpd/htdocs. As I said, none of this applies to Ubuntu, where configurations are stored in /etc/apache2 and the default DocumentRoot is /var/www.
    Last edited by SeijiSensei; June 23rd, 2012 at 02:15 PM.

Bookmarks

Posting Permissions

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