Witajcie,
Zmagam się od wczoraj z następującym problemem. Korzystam z DirectAdmin'a na jednym z VPS, na innych jest czysty Debian, zdecydowanie bardziej preferuję nginx'a.
Certyfikaty wildcard SSL zakupione, DA prawidłowo je rozpoznał i pokazał datę ważności. Po włączeniu obsługi SSL dla jednej z domen, na którym stoi sklep internetowy mam błąd ERR_TOO_MANY_REDIRECTS.
Umieściłem w pliku .htaccess zalecane przez help DA przekierowania:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#AddHandler x-httpd-php53 .php RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # use if needed: #RewriteBase / RewriteRule ^$ / [QSA] RewriteCond %{REQUEST_FILENAME} ([a-z_]+?)_picture/(.*?)\.(?:jpg|png)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ([a-z_]+?)_picture/(.*?)/(.*?)\.(jpg|png)$ thumbnailer/create/$1/$2/$3/$4 [QSA,L] # some hosts need redirect: # RewriteRule ([a-z_]+?)_picture/(.*?)/(.*?)\.(jpg|png)$ thumbnailer/create/$1/$2/$3/$4 [QSA,R,L] # redirects request to nonexisting CSS and JS to empty CSS/JS files [so you dont need to define module CSS/JS if you dont need it] RewriteCond %{REQUEST_FILENAME} ^(.*?)\.css$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ stylesheets/core/no_css.css [QSA,L] RewriteCond %{REQUEST_FILENAME} ^(.*?)\.js$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ javascript/core/no_js.js [QSA,L] # displays 404.html if IMAGE is not found RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} images/.*?(png|jpg|gif) # ^^ may catch valid requests that contain "images/" and have image extension!!!! RewriteRule ^(.*)$ 404.html [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,L] # also OK RewriteRule ^(.*)$ index.php/%{REQUEST_FILENAME} [QSA,L] # define error pages ErrorDocument 404 error_page.php ErrorDocument 406 error_page.php ErrorDocument 500 error_page.php
|*if !SUB| |?DOCROOT=/home/admin/domains/my-shop.net/public_html/application/public| |*endif|
|*if !SUB| |?DOCROOT=/home/admin/domains/my-shop.net/private_html/application/public| |*endif|
Warning: require_once(/home/admin/domains/my-shop.net/public_html/application/public/../../framework/gp/event_dispatcher/EventDispatcherGP.php): failed to open stream: No such http://www.php.net/file or directory in /home/admin/domains/my-shop.net/private_html/framework/autoloader/Autoloader.php on line 66 Fatal error: require_once(): Failed opening required '/home/admin/domains/my-shop.net/public_html/application/public/../../framework/gp/event_dispatcher/EventDispatcherGP.php' (include_path='.:/usr/local/lib/php:/home/admin/domains/my-shop.net/private_html/application:/home/admin/domains/my-shop.net/private_html/framework:/home/admin/domains/my-shop.net/private_html/framework/libs/:/home/admin/domains/my-shop.net/private_html/application/libs/ThirdParty') in /home/admin/domains/my-shop.net/private_html/framework/autoloader/Autoloader.php on line 66
<?php /** * 1. Enable SSL in 'enabled' * 2. Define which domains (not aliases) should use SSL in 'ssl_domains' * 3. Configure 'admin_sections_prefixes' if needed (this is to support '/admin/*' urls) * 4. Configure controllers to return public function getActionsForSSL() * 5. Refresh controller configuration cache in /admin/technical_panel * 5.1 Refresh this cache config after each change in controllers */ return http://www.php.net/array( 'enabled' => true, // 'enabled' => false, 'ssl_domains' => http://www.php.net/array( 'secure.site.pl' ), // check plugins.php // and copy all prefixes configured in: $pluginManager->registerPlugin( Framework_Plugins_PluginManager::AFTER_ROUTING, new Application_AdminSectionPlugin(array('admin'))); 'admin_sections_prefixes' => http://www.php.net/array( 'admin', ) );
Pokaż Autoloader.php, nie ma tam gdzieś żadnego pliku config albo coś?
W katalogu application/public jest plik autoload.php:
<?php include (__DIR__.'/../../framework/core/Client.php'); include (__DIR__.'/../../application/modules/shop_core/Resources/TrustedHostsInterface.php'); include (__DIR__.'/../../application/modules/shop_core/Resources/iSystemsTrustedHost.php'); $trustedHosts = new iSystemsTrustedHost('http://panel.i-sklep.pl/secure_host'); $clientHost = Framework_Core_Client::getHost($overProxy = true); if(!$trustedHosts->isHostTrusted($clientHost)) { http://www.php.net/header('HTTP/1.0 403 Forbidden'); http://www.php.net/exit(); } http://www.php.net/echo '<pre>'; http://www.php.net/error_reporting(E_ALL); http://www.php.net/ini_set( 'memory_limit', '128M' ); require_once('app_config.php'); require_once( $appDir . '/config/framework_env.php' ); // DONT INCLUDE require_once( $appDir . '/config/environment.php' ); require_once( http://www.php.net/dirname(http://www.php.net/dirname( __FILE__ )) . '/config/theme.php' ); $application_base_dir = http://www.php.net/join( DIRECTORY_SEPARATOR, http://www.php.net/array( http://www.php.net/dirname(http://www.php.net/dirname( __FILE__ ))) ); $framework_classes_base_dir = http://www.php.net/join( DIRECTORY_SEPARATOR, http://www.php.net/array( http://www.php.net/dirname( __FILE__ ),'..', '..', 'framework' ) ); //--- doAutoload($framework_classes_base_dir, $application_base_dir); clearCompiledTemplates($application_base_dir); /* to jest chyba jednak zbedne... clearMinifiedJS($application_base_dir); clearMinifiedCSS($application_base_dir); */ createSymlinksTo($application_base_dir, '*.css', 'stylesheets'); createSymlinksTo($application_base_dir, '*.js', 'javascript'); createCustomizedSymlinksTo($application_base_dir, '*.css', 'stylesheets'); createCustomizedSymlinksTo($application_base_dir, '*.js', 'javascript'); http://www.php.net/echo '</pre>'; function doAutoload($framework_classes_base_dir, $application_base_dir) { $autoloaderBaseDir = $framework_classes_base_dir . '/autoloader/'; require_once( $autoloaderBaseDir . 'ClassMap.php' ); require_once( $autoloaderBaseDir . 'ClassMapGenerator.php' ); require_once( $autoloaderBaseDir . 'PREGClassMapGenerator.php'); require_once( $autoloaderBaseDir . 'ClassSpider.php' ); http://www.php.net/set_include_path( http://www.php.net/get_include_path() . PATH_SEPARATOR . $application_base_dir . PATH_SEPARATOR . $framework_classes_base_dir ); $classMap = new Framework_Autoloader_ClassMap(); $classMapGenerator = new Framework_Autoloader_PREGClassMapGenerator($classMap); $appSpider = new Framework_Autoloader_ClassSpider( $application_base_dir, false ); $appSpider->skipPath('.bzr'); $appSpider->skipPath('.git'); $appSpider->skipPath('application/tmp'); $appSpider->skipPath('application/logs'); $appSpider->skipPath('application/public'); $appSpider->skipPath('application/config'); $appSpider->skipPath('application/modules/[a-zA-Z0-9_]+/(?:tpl|tpl_admin|lang|install[^install_handlers])'); $classMapGenerator->addClassesFrom( $appSpider ); $fwSpider = new Framework_Autoloader_ClassSpider( $framework_classes_base_dir, false ); $fwSpider->skipPath('.bzr'); $fwSpider->skipPath('.git'); $classMapGenerator->addClassesFrom( $fwSpider ); $classMap->saveTo( $application_base_dir . '/tmp/var/class_map.php' ); http://www.php.net/print( "Classes found: " . $classMap->countClasses() . "\n"); http://www.php.net/printf( "Memory usage: %.2f MiB\n", memory_get_peak_usage() / 1024 / 1024 ); } function clearCompiledTemplates($application_base_dir) { // clear templates foreach ( http://www.php.net/glob($application_base_dir . "/tmp/compiled_templates/*.php") as $file ) { http://www.php.net/unlink($file); } foreach ( http://www.php.net/glob($application_base_dir . "/tmp/dynamic_templates/*.php") as $file ) { http://www.php.net/unlink($file); } } function clearMinifiedJS($application_base_dir) { foreach ( http://www.php.net/glob($application_base_dir . "/public/javascript/min/*.js") as $file ) { http://www.php.net/unlink($file); } } function clearMinifiedCSS($application_base_dir) { foreach ( http://www.php.net/glob($application_base_dir . "/public/stylesheets/min/*.css") as $file ) { http://www.php.net/unlink($file); } } function createSymlinksTo($application_base_dir, $extension, $dir) { foreach ( http://www.php.net/glob( $application_base_dir . '/modules/**/' . $extension) as $filepath ) { $pathElements = http://www.php.net/explode('/', $filepath); $filename = http://www.php.net/array_pop($pathElements); $moduleName = http://www.php.net/array_pop($pathElements); if ( ($moduleName == "_template") || ($moduleName == "_base") ) { continue; } $symlink = $application_base_dir . '/public/' . $dir . '/modules/' . $filename; $target = $application_base_dir . "/modules/" . $moduleName . '/' . $filename; $realFilepath = $filepath; doCreateSymlink($symlink, $target, $filename, $realFilepath); } // /some/dir/application/ -> /some/dir/customized/THEME/ // this replaces files found in regular modules with these customized ones $customizedBaseDir = http://www.php.net/preg_replace( '#application$#', 'customized/' . APPLICATION_THEME_DIR, $application_base_dir); foreach ( http://www.php.net/glob( $customizedBaseDir . '/modules/**/' . $extension ) as $filepath ) { $pathElements = http://www.php.net/explode('/', $filepath); $filename = http://www.php.net/array_pop($pathElements); $moduleName = http://www.php.net/array_pop($pathElements); if ( ($moduleName == "_template") || ($moduleName == "_base") ) { continue; } $symlink = $application_base_dir . '/public/' . $dir . '/modules/' . $filename; $target = $application_base_dir . "/../customized/" . APPLICATION_THEME_DIR . "/modules/" . $moduleName . '/' . $filename; $realFilepath = $filepath; doCreateSymlink($symlink, $target, $filename, $realFilepath); } } /** * Only for /customized/DOMAIN_NAME * Where DOMAIN_NAME must have a dot, so 'default' will be excluded * * @param unknown_type $application_base_dir * @param unknown_type $extension * @param unknown_type $dir */ function createCustomizedSymlinksTo( $application_base_dir, $extension, $dir) { // /some/dir/application/ -> /some/dir/customized/THEME/ $customizedBaseDir = http://www.php.net/preg_replace( '#application$#', 'customized', $application_base_dir); $patt = $customizedBaseDir . '/*/'; foreach ( http://www.php.net/glob( $patt) as $themeDirPath ) { $themeName = http://www.php.net/basename($themeDirPath); if ( http://www.php.net/is_dir($themeDirPath) ) // check for dot in name (domain name!!) { http://www.php.net/print( "Processing customized theme: " . $themeName . "<br />"); // files from modules (modules/MODULE/FILE.css|js) foreach ( http://www.php.net/glob( $themeDirPath . 'modules/**/' . $extension) as $filepath ) { $pathElements = http://www.php.net/explode('/', $filepath); $filename = http://www.php.net/array_pop($pathElements); $moduleName = http://www.php.net/array_pop($pathElements); if ( ($moduleName == "_template") || ($moduleName == "_base") ) { continue; } http://www.php.net/print( "Customized: " . $filepath ."\n"); // application/public/[stylesheets/javascript]/templateName/MODULE.css etc. $symlink = $application_base_dir . '/public/' . $dir . '/' . $themeName . '/modules/' . $filename; $target = $customizedBaseDir . "/" . $themeName . "/modules/" . $moduleName . '/' . $filename; $realFilepath = $filepath; doCreateSymlink($symlink, $target, $filename, $realFilepath); } // global files (not within modules) foreach ( http://www.php.net/glob( $themeDirPath . '*' . $extension) as $filepath ) { $pathElements = http://www.php.net/explode('/', $filepath); $filename = http://www.php.net/array_pop($pathElements); $moduleName = http://www.php.net/array_pop($pathElements); if ( ($moduleName == "_template") || ($moduleName == "_base") ) { continue; } http://www.php.net/print( "Customized not module: " . $filepath ."\n"); // application/public/DOMAIN.NAME/stylesheets/modules/MODULE.css etc. $symlink = $application_base_dir . '/public/' . $dir . '/' . $themeName . '/' . $filename; $target = $customizedBaseDir . "/" . $themeName . "/" . $filename; $realFilepath = $filepath; doCreateSymlink($symlink, $target, $filename, $realFilepath); } } } } function doCreateSymlink( $symlink, $target, $filename, $realFilepath) { // fix for symlinks to non-existing files `rm -f $symlink`; // strip absolute path for security reasons $relativelFilePath = http://www.php.net/substr($realFilepath, http://www.php.net/strpos($realFilepath, 'application/')); http://www.php.net/print( "Creating... " . $filename . " from " . $relativelFilePath . " <br/>"); crossOsSymlink( $target, $symlink ); } function crossOsSymlink($target, $symlink) { $symlinkDir = http://www.php.net/dirname($symlink); if ( ! http://www.php.net/file_exists($symlinkDir)) { http://www.php.net/mkdir( $symlinkDir, 0755, true); } if(http://www.php.net/strtoupper(http://www.php.net/substr(PHP_OS, 0, 3))==='WIN') { return http://www.php.net/copy( $target, $symlink ); } return symlink( $target, $symlink ); }
<?php // PATH to applicaiton base dir! $appDir = http://www.php.net/dirname( __FILE__ ) . '/../'; ?>
odśwież autoloader
composer dump-autoload
Wreszcie działa, brakowało pliku ssl.php z nazwami dozwolonych domen oraz ssl_actions_cache.php z nazwami klas, gdzie ma być włączony SSL.
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)