Find the answer to your Linux question:
Page 3 of 3 FirstFirst 1 2 3
Results 21 to 27 of 27
Originally Posted by elija In Debian, the default config file is /etc/apache2/apache2.conf, another thing to try (assuming all else is set up correctly) is disable the default vhost by running ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #21
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11

    Quote Originally Posted by elija View Post
    In Debian, the default config file is /etc/apache2/apache2.conf, another thing to try (assuming all else is set up correctly) is disable the default vhost by running the command
    Code:
    a2dissite default
    as root and restarting the Apache service.
    My vhost file was already disabled.

  2. #22
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11
    up (bumping)

  3. #23
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Try something like this in your virtual hosts file (i guess /etc/apache2/sites-enabled/mysite):

    Code:
    <VirtualHost *:80>
       ServerName www.mysite.com
       DocumentRoot /var/www/mysite
    </VirtualHost>
    
    <VirtualHost *:80>
       ServerName panel.mysite.com
       DocumentRoot /var/www/mysite/panel
    </VirtualHost>
    obviously, replace www.mysite.com and panel.mysite.com with your two domain names.

    notice that the document root of the 2nd entry is a subdir (i.e., the "/panel" dir) of the 1st virtual host's document root. you don't have to do that - you can make it a totally separate dir (e.g. /var/www/panel).

    then make sure that you put both of those domain names in /etc/hosts on your server, something like this:

    Code:
    178.63.95.207 www.mysite.com panel.mysite.com
    then (after restarting apache), launch a browser locally (on the server) and see if you can browse to those two URLs and serve up the proper locations, e.g.:

    http://www.mysite.com
    http://panel.mysite.com

    See if you can get this far.

  4. #24
    Just Joined!
    Join Date
    Sep 2012
    Posts
    3
    Since you are using the Name-Based VirtualHosts, you need to add NameVirtualHost *:80 to the beginning of your mysite text file [assuming you are using default version of apache2 (2.0 or 2.2) in your Debian6 install] to make Apache2 actually use the domain names.

  5. #25
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    Location
    London, England
    Posts
    471
    I just set up virtualhosts on my server and it's working perfectly. Here's how I did it:

    In /etc/apache/httpd.conf I added:
    Code:
    Include /etc/apache/httpd-vhosts.conf
    And then I proceeded to create that file and put in the following information (emails removed so I don't get spammed):
    Code:
    <VirtualHost *:80>
        ServerAdmin name@address.com
        DocumentRoot "/home/guydalziel/public_html"
        ServerName guydalziel.com
        ServerAlias www.guydalziel.com
        ErrorLog "/var/log/apache/guydalziel/error_log"
        CustomLog "/var/log/apache/guydalziel/access_log" common
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin name@address.com
        DocumentRoot "/home/dyndns/public_html"
        ServerName krendoshazin.dyndns.org
        ServerAlias krendoshazin.dyndns.org
        ErrorLog "/var/log/apache/dyndns/error_log"
        CustomLog "/var/log/apache/dyndns/access_log" common
    </VirtualHost>
    Once this is done, check your configuration with 'httpd -S', and pay attention to any errors that it might throw at you:
    Code:
    root@webserver:/home/dyndns# httpd -S
    VirtualHost configuration:
    *:80                   is a NameVirtualHost
             default server guydalziel.com (/etc/apache/httpd-vhosts.conf:23)
             port 80 namevhost guydalziel.com (/etc/apache/httpd-vhosts.conf:23)
                     alias www.guydalziel.com
             port 80 namevhost guydalziel.com (/etc/apache/httpd-vhosts.conf:23)
                     alias www.guydalziel.com
             port 80 namevhost krendoshazin.dyndns.org (/etc/apache/httpd-vhosts.conf:32)
                     alias krendoshazin.dyndns.org
             port 80 namevhost krendoshazin.dyndns.org (/etc/apache/httpd-vhosts.conf:32)
                     alias krendoshazin.dyndns.org
    ServerRoot: "/usr"
    Main DocumentRoot: "/home/dyndns/public_html"
    Main ErrorLog: "/var/log/apache/error_log"
    Mutex default: dir="/var/run/" mechanism=default 
    PidFile: "/var/run/httpd.pid"
    Define: DUMP_VHOSTS
    Define: DUMP_RUN_CFG
    User: name="apache" id=80
    Group: name="apache" id=80
    If this all looks good (which this does), then proceed to add the directory permissions in /etc/apache/httpd.conf:
    Code:
    DocumentRoot "/home/dyndns/public_html"
    <Directory "/home/dyndns/public_html">
        Options FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
    And that's it. There will now be 2 seperate sites served on www.guydalziel.com and http://krendoshazin.dyndns.org.

  6. #26
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11
    Thanks for sharing your experience! Im going to try that

    By the way, do I need to do something specific with Hetzner hosting?

  7. #27
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    Location
    London, England
    Posts
    471
    Quote Originally Posted by black_penguin View Post
    By the way, do I need to do something specific with Hetzner hosting?
    I assume that your server -- virtual or otherwise -- has a unique IP address, and that you have root access to the server and the apache config? If so, then you shouldn't have any issues. I set up mine from my home webserver which I have complete access to through a single unique IP.

Page 3 of 3 FirstFirst 1 2 3

Posting Permissions

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