Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Webmin Apache Default server problems

  1. #1
    Join Date
    Oct 2006
    Beans
    42

    Question Webmin Apache Default server problems

    Hello,

    I recently got a2billing (a VoIP billing software) installed by a consultant on my server. He installed it so a2billing runs as the "Default Server" of apache.

    I don't want it to be like that because not only does it feel naked, but also anyone from anywhere can access the server via http and boom, there's the login screen.

    Long story short, I want to move it to it's own virtual host on apache (billing.domain.com). That way I can point all new domains I purchase and have them go to /var/www/index.html as a placeholder without needing to create a new virtual host each time I buy a domain. I'd rather have THAT as my default server and not a2billing.

    I know how virtual hosts work but this "Default Server" is a little too complicated once you click on it.

    This is the first screen on Apache server on Webmin. When you click through into "Default Server", you see all of these new things whereas I was hoping to see something like this which you see when you click into the "Virtual Server".

    Either way, you get the drift. I want this to be a virtual host. I can't simply create a new virtual host with Server Name = billing.domain.com and Document Root = /usr/share/a2billing/1-current/stable/admin/ which seems to be very easy and should get the job done.

    Basically, I want that ^^ to be the virtual host and I want default server to be "Any" server name and "/var/www" as Document Root.

    Any help would be great. Thanks!!
    Last edited by Yourname; February 7th, 2012 at 03:03 AM.

  2. #2
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,683
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Webmin Apache Default server problems

    I have not used webmin in years. From my limited experience, I recall the process of creating vhost not overly intuitive. I also remember having unexpected results at times, especially if I created vhosts by hand vs. via webmin.

    I recommend following the steps in the Sticky at the top of this forum.

    The key to making a "default" vhost is not calling it default. The way Apache2 works, is by reading the vhost files in alpha/numeric order. The first file that has a match to the request is served. If there are not matches to the request, the first vhost file is served.

    Therefore to have a default site just make sure it comes first alpha/numerically. This is why a clean install has the default named 000-default. The leading zero's get in in the top of the list.
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  3. #3
    Join Date
    Oct 2006
    Beans
    42

    Re: Webmin Apache Default server problems

    My apologies. I forgot to attach the screenshots along with the post and that's why it was hard for you to understand where I'm coming from. Please take a look at it and you'll see why I find it difficult.

  4. #4
    Join Date
    Oct 2006
    Beans
    42

    Re: Webmin Apache Default server problems

    lol
    Now that the screenshots are in, everybody's stumped?

  5. #5
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,683
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Webmin Apache Default server problems

    You may get some insight by examining the actual vhost files.

    Code:
    ls /etc/apache2/sites-available
    Code:
    cat /etc/apache2/sites-available/default
    Code:
    cat /etc/apache2/sites-available/site2
    Obviously you will need to change the file names. I think webmin also has a file viewer built in if you don't want to use the command line.

    Again, I highly recommend staying away from Webmin for Apache2 administration. I really don't like the way it handles some of the config options.

    I have very limited experience with Webmin. If you don't get more solid advice you can try copying the default config file to a diff file name, change the directive for both vhost files, and make sure your viopsite file name comes alpha numerically after the site you want to make default.

    Make backups of everything so you can revert if it goes sour.

    Would go something like this.

    Code:
    cd /etc/apache2/sites-available
    Code:
    sudo cp default default.bak
    Code:
    sudo cp site2 site2.bak
    Code:
    sudo cp default viopSite
    Code:
    sudo nano viopSite
    Change the virtual host directive so it is like:
    Code:
    <VirtualHost *>
    Code:
    sudo nano site2
    Change the virtual host directive so it is like:
    Code:
    <VirtualHost *>
    disable the default site and enable it's replacement

    Code:
    sudo a2dissite default
    Code:
    sudo a2ensite voipSite
    Cross your fingers and reload apache2

    Code:
    sudo service apache2 reload
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  6. #6
    Join Date
    Oct 2006
    Beans
    42

    Re: Webmin Apache Default server problems

    Quote Originally Posted by volkswagner View Post
    You may get some insight by examining the actual vhost files.

    Code:
    ls /etc/apache2/sites-available
    Code:
    cat /etc/apache2/sites-available/default
    Code:
    cat /etc/apache2/sites-available/site2
    Obviously you will need to change the file names. I think webmin also has a file viewer built in if you don't want to use the command line.

    Again, I highly recommend staying away from Webmin for Apache2 administration. I really don't like the way it handles some of the config options.

    I have very limited experience with Webmin. If you don't get more solid advice you can try copying the default config file to a diff file name, change the directive for both vhost files, and make sure your viopsite file name comes alpha numerically after the site you want to make default.

    Make backups of everything so you can revert if it goes sour.

    Would go something like this.

    Code:
    cd /etc/apache2/sites-available
    Code:
    sudo cp default default.bak
    Code:
    sudo cp site2 site2.bak
    Code:
    sudo cp default viopSite
    Code:
    sudo nano viopSite
    Change the virtual host directive so it is like:
    Code:
    <VirtualHost *>
    Code:
    sudo nano site2
    Change the virtual host directive so it is like:
    Code:
    <VirtualHost *>
    disable the default site and enable it's replacement

    Code:
    sudo a2dissite default
    Code:
    sudo a2ensite voipSite
    Cross your fingers and reload apache2

    Code:
    sudo service apache2 reload
    Hey,

    Thanks. Going to try this now.

  7. #7
    Join Date
    Oct 2006
    Beans
    42

    Re: Webmin Apache Default server problems

    Webmin said "File or directory to add virtual servers to" -> /etc/apache2/sites-available

    So, obviously, /etc/apache2/httpd.conf is unavailable for comment.

    Code:
    root@phantom:~# cd /etc/apache2/sites-
    sites-available/ sites-enabled/
    root@phantom:~# cd /etc/apache2/sites-available/
    root@phantom:/etc/apache2/sites-available# ls
    a2billing_admin.conf  a2billing_customer.conf  default      freepbx.conf              a2billing_agent.conf  a2billing_index.conf     default-ssl  
    root@phantom:/etc/apache2/sites-available# less default
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    Then there's...

    Code:
    root@phantom:/etc/apache2# cd sites-enabled/
    root@phantom:/etc/apache2/sites-enabled# ls
    000-default  a2billing_admin.conf  a2billing_agent.conf  a2billing_customer.conf  a2billing_index.conf  freepbx.conf  kasbahmanila.com.ph.conf  kasbahmanila.ph.conf  utang.ph.conf
    root@phantom:/etc/apache2/sites-enabled# less 000-default
    root@phantom:/etc/apache2/sites-enabled#
    So, naturally, I went into 000-default...

    Code:
    root@phantom:/etc/apache2/sites-enabled# cat 000-default
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    root@phantom:/etc/apache2/sites-enabled#
    So, now I don't understand how Webmin shows SO MANY symlinks :S

  8. #8
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,683
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Webmin Apache Default server problems

    Too many symbolic links....
    The way Virtual hosts works is when you enable it, a link gets created in sites-enabled from sites-available. You can enable it using 'a2ensite' or create the link by hand. This makes it easy to enable/disable sites without actually touching config files.

    The reason default has a link like 000-default is to make sure requests for domains not listed in other vhost files will be served by 000-default because the file comes early alphanumerically. I believe this is the way apache is installed in Ubuntu/debian.

    I did not realize you had so many vhost files. Are all this vhosts working as expected?

    Please locate the vhost file that has /usr/share/a2billing/1-current/stable/admin as the document root. Please post the config of this vhost.

    Your goal is to have all new sites inside /var/www. Are you going to have an index page in /var/www with links to all new sites? This will work well if you new sites all have the same domain name and you use a folder structure like... mydomain.com, mydomain.com/site2, mydomain.com/site2.

    If you want to use subdomains, you will still want to create vhost files so the subdomain is found by apache2. One way around this is if your default vhost file lists all your new subdomains as aliases. Then you can use the sub folder structure within /var/www. So you would still need to edit a vhost file each time you add a subdomain. Otherwise you will be relying on the fact that apache2 will serve the subdomain based on not being found and expecting the vhost file with the highest priority (earliest alphaNumerically). This will work, but may not be a good practice.
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  9. #9
    Join Date
    Oct 2006
    Beans
    42

    Re: Webmin Apache Default server problems

    Quote Originally Posted by volkswagner View Post
    Too many symbolic links....
    The way Virtual hosts works is when you enable it, a link gets created in sites-enabled from sites-available. You can enable it using 'a2ensite' or create the link by hand. This makes it easy to enable/disable sites without actually touching config files.

    The reason default has a link like 000-default is to make sure requests for domains not listed in other vhost files will be served by 000-default because the file comes early alphanumerically. I believe this is the way apache is installed in Ubuntu/debian.

    I did not realize you had so many vhost files. Are all this vhosts working as expected?

    Please locate the vhost file that has /usr/share/a2billing/1-current/stable/admin as the document root. Please post the config of this vhost.

    Your goal is to have all new sites inside /var/www. Are you going to have an index page in /var/www with links to all new sites? This will work well if you new sites all have the same domain name and you use a folder structure like... mydomain.com, mydomain.com/site2, mydomain.com/site2.

    If you want to use subdomains, you will still want to create vhost files so the subdomain is found by apache2. One way around this is if your default vhost file lists all your new subdomains as aliases. Then you can use the sub folder structure within /var/www. So you would still need to edit a vhost file each time you add a subdomain. Otherwise you will be relying on the fact that apache2 will serve the subdomain based on not being found and expecting the vhost file with the highest priority (earliest alphaNumerically). This will work, but may not be a good practice.
    For clarity:
    Thing is I buy lots of domains every now and then. But host only a handful with more than one page.
    So, my mindset was when I buy a domain I don't want to have to always set up a virtual host for them as most of them will go to /var/www/index.html which is the placeholder.

    Every now and then I'd get a domain that I want to have a couple more pages, and for that a virtual host is fine. This whole dynamic got messed up when a2billing came into /var/www/.

    And yes, those symlinks are what I'm afraid of. Don't wanna screw something up.

  10. #10
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,683
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Webmin Apache Default server problems

    I understand.

    If you want to get to the bottom of the issue, it would be very helpful if you could post the config file of the site webmin is calling default.

    Please locate the vhost file that has /usr/share/a2billing/1-current/stable/admin as the document root. Please post the config of this vhost.
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

Page 1 of 2 12 LastLast

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
  •