Changes

Jump to navigation Jump to search
Alternative redirection method
Line 22: Line 22:  
BTW it also effects server-manager at the console, with no way to access server-manager, the only way to regain server-manager at that point was to delete the template and restart.
 
BTW it also effects server-manager at the console, with no way to access server-manager, the only way to regain server-manager at that point was to delete the template and restart.
 
Although it's on the right track it needs a better method as was stated.
 
Although it's on the right track it needs a better method as was stated.
 +
 +
==Alternative Method==
 +
I have done the following and all appears to work OK.
 +
 +
Created a Virtual Domain ''vdomain.com'' in server-manager panel then
 +
db domains setprop vdomain.com Content joomla
 +
db domains setprop vdomain.com WebApp yes
 +
 +
Created a new template fragment
 +
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts
 +
cd /etc/e-smith/templates-custom/etc/httdp/conf/httpd.conf/VirtualHosts
 +
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/20IbayContent 20IbayContent
 +
 +
Now edit and change the file 20IbayContent. Lines marked + have been added
 +
  {
 +
      use esmith::AccountsDB;
 +
      my $accounts = esmith::AccountsDB->open_ro;
 +
 
 +
      use esmith::DomainsDB;
 +
      my $domains = esmith::DomainsDB->open_ro;
 +
 +
      $OUT = "";
 +
 +
      my $ibay = $virtualHostContent;
 +
 +
+    if (( $domains->get_prop($virtualHost, 'WebApp') || 'no') eq 'yes') {
 +
+        my $basedir = "/opt/$ibay";
 +
+        $OUT .= "    DocumentRoot        $basedir\n";
 +
+    }
 +
+    else {
 +
          my $basedir = "/home/e-smith/files/ibays/$ibay";
 +
          my $cgiBin = $accounts->get_prop($ibay, "CgiBin") || "";
 +
 
 +
          $OUT .= "    DocumentRoot        $basedir/html\n";
 +
 
 +
          if ($cgiBin)
 +
          {
 +
              $OUT .= "    ScriptAlias /cgi-bin $basedir/cgi-bin\n";
 +
          }
 +
          else
 +
          {
 +
              $OUT .=
 +
                      "    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
 +
                    . "    #  /sbin/e-smith/db accounts setprop $ibay CgiBin "
 +
                              . "enabled\n"
 +
                    . "    #  /sbin/e-smith/signal-event console-save\n";
 +
          } 
 +
          $OUT .= "    Alias      /files  $basedir/files\n";
 +
+    }
 +
 +
      if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
 +
          eq 'yes')
 +
      {
 +
          my @ibays = $accounts->ibays;
 +
          foreach my $ibay (@ibays)
 +
          {
 +
              my $key = $ibay->key;
 +
              next if $key eq $virtualHostContent;
 +
              my $basedir = "/home/e-smith/files/ibays/$key";
 +
              my $cgiBin = $ibay->prop("CgiBin") || "";
 +
              my $name = $ibay->prop("Name") || "";
 +
 +
              $OUT .= "\n";
 +
              $OUT .= "    # $key ibay ($name)\n";
 +
              $OUT .= "\n";
 +
 +
              if ($cgiBin)
 +
              {
 +
                  $OUT .= "    ScriptAlias /$key/cgi-bin $basedir/cgi-bin\n";
 +
              }
 +
              else
 +
              {
 +
                  $OUT .=
 +
                      "    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
 +
                      . "    #  /sbin/e-smith/db accounts setprop $key CgiBin "
 +
                                  . "enabled\n"
 +
                      . "    #  /sbin/e-smith/signal-event console-save\n";
 +
              }
 +
 
 +
              $OUT .= "    Alias      /$key/files  $basedir/files\n";
 +
 +
              # Make sure this one is last since it's a prefix of the above
 +
              # aliases. If we put it first, it would get expanded before the
 +
              # other aliases, creating problems.
 +
 +
              $OUT .= "    Alias      /$key        $basedir/html\n";
 +
          }
 +
          $OUT .= "    # No ibays in system\n" unless @ibays;
 +
      }
 +
  }
 +
 +
Expand the template and restart httpd
 +
expand-template /etc/httpd/conf/httpd.conf
 +
sv t httpd-e-smith
 +
 +
Works OK for me. Only tested with a Virtual Domain and joomla as the webapp. Generates a standard VirtualHost entry in httpd.conf, but with just the DocumentRoot changed. The Content db setting of joomla shows up in server-manager, but a modify then ignores it and reverts to setting options for available ibays. Obviously the Content property needs to be set to the directory name under /opt where the web application resides.
 +
 +
I haven't tested it, but I assume if you had no VirtualDomains defined and set the Primary Domain to be redirected you would still get the standard VirtualHost entry created and therefore still have access to server-manager etc.

Navigation menu