Changeset 10045 for trunk/src/tools/plesk
- Timestamp:
- 09/06/06 11:07:39 (2 years ago)
- Files:
-
- trunk/src/tools/plesk/README.txt (modified) (1 diff)
- trunk/src/tools/plesk/midgardize-vhost.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/tools/plesk/README.txt
r10044 r10045 28 28 29 29 Next you need to add Midgard configuration details to Apache configuration. For this, run the supplied `midgardize-vhost.php` script. 30 31 For example, if you have just added a website "www.example.net" into your Plesk server, you need to run the following to Midgardize it: 32 33 # php /usr/share/midgard/plesk/midgardize-vhost.php -n www.example.net 34 35 Run `php /usr/share/midgard/plesk/midgardize-vhost.php -h` for more options. 36 37 The `midgardize-vhost.php` script will do the following: 38 39 * Generate Midgard-specific `vhost.conf` file for the website 40 * Symlink MidCOM static files (images and CSS) under the host document root 41 * Register the Midgard settings into Plesk using the `websrvmng --reconfigure-vhost` command 42 43 Next you can restart Apache and create the site using the Midgard Site Wizard. trunk/src/tools/plesk/midgardize-vhost.php
r10044 r10045 27 27 'default' => '/usr/local/psa', 28 28 ), 29 'midgard_rootfile' => array 30 ( 31 'desc' => 'Path to Midgard root file', 32 'max' => 1, 33 'min' => 0, 34 'default' => '/usr/lib/apache2/modules/midgard-root.php', 35 ), 29 36 'hostname' => array 30 37 ( … … 40 47 'desc' => 'Midgard configuration file', 41 48 'max' => 1, 42 'min' => 1,49 'min' => 0, 43 50 'default' => 'midgard', 44 51 ), … … 46 53 47 54 // Load the console library 48 ini_set('include_path', '..:/opt/local/lib/php4');55 ini_set('include_path', ini_get('include_path') . ':/opt/local/lib/php4'); 49 56 require_once 'Console/Getargs.php'; 50 57 … … 82 89 // Check that we can write to the Virtual Host configuration directory 83 90 $vhost_confdir = get_merged_value('vhost_directory', $args, $config) . '/' . get_merged_value('hostname', $args, $config) . '/conf/'; 91 $vhost_docdir = get_merged_value('vhost_directory', $args, $config) . '/' . get_merged_value('hostname', $args, $config) . '/httpdocs/'; 84 92 if (!file_exists($vhost_confdir)) 85 93 { 86 94 die("Plesk virtual host configuration directory '{$vhost_confdir}' was not found. Have you created the host in Plesk yet?\n"); 87 95 } 88 89 96 if (!is_writable($vhost_confdir)) 90 97 { 91 98 die("Cannot write to Plesk virtual host configuration directory '{$vhost_confdir}'. Please check your settings or run as root.\n"); 99 } 100 101 // Check that the midgard-root.php file is available 102 $midgard_rootfile = get_merged_value('midgard_rootfile', $args, $config); 103 if (!file_exists($midgard_rootfile)) 104 { 105 die("Midgard root file '{$midgard_rootfile}' was not found. Have you installed Midgard properly?\n"); 92 106 } 93 107 … … 150 164 } 151 165 166 // Generate the vhost settings 152 167 $vhost_settings = "MidgardEngine on\n"; 168 $vhost_settings .= "MidgardRootFile {$midgard_rootfile}\n"; 153 169 $vhost_settings .= "MidgardDatabase {$midgard_configuration['Name']} {$midgard_configuration['Username']} {$midgard_configuration['Password']}\n"; 154 170 $vhost_settings .= "MidgardBlobDir {$midgard_configuration['Blobdir']}\n"; … … 165 181 // TODO: MidgardRootFile, MidgardDefaultRealm 166 182 167 echo "Save the following setup to file {$vhost_confdir}vhost.conf:\n\n{$vhost_settings}\n"; 168 echo "And then run:\n" . get_merged_value('psa_directory', $args, $config) . "/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=" . get_merged_value('hostname', $args, $config) . "\n"; 183 // Save them to a vhost.conf file 184 $conf = fopen("{$vhost_confdir}vhost.conf", 'w'); 185 fwrite($conf, $vhost_settings); 186 fclose($conf); 169 187 170 // TODO: Save file and run /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain_name> 188 // Symlink midcom-static under the docroot 189 $php_web_dir = str_replace("\n", '', @shell_exec('pear config-get web_dir')); 190 exec("ln -s {$php_web_dir} {$vhost_docdir}midcom-static"); 191 192 // Register the vhost.conf file with Plesk 193 exec(get_merged_value('psa_directory', $args, $config) . "/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=" . get_merged_value('hostname', $args, $config)); 194 195 echo "Configuration has been saved to {$vhost_confdir}vhost.conf and registered for Plesk.\n"; 171 196 ?>
