Finalize docker image for SelfOSS 2.15
This commit is contained in:
35
run.php
Normal file
35
run.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
// Only run this if running from php 5.4 embedded server
|
||||
if (php_sapi_name() == 'cli-server') {
|
||||
|
||||
if ( preg_match( '/\.(?:js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|ttf|svg)$/', $_SERVER["REQUEST_URI"] ) ) {
|
||||
|
||||
// serves fronted
|
||||
if ( preg_match( '/^\/public/', $_SERVER["REQUEST_URI"] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// serves favicons
|
||||
if ( preg_match( '/^\/data/', $_SERVER["REQUEST_URI"] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//redirects to proper location for favicons
|
||||
if ( preg_match( '/(favicons|thumbnails)/', $_SERVER["REQUEST_URI"] ) ) {
|
||||
header( "Location: /data".$_SERVER["REQUEST_URI"] );
|
||||
exit;
|
||||
}
|
||||
|
||||
//redirects to proper location for frontend
|
||||
header( "Location: /public".$_SERVER["REQUEST_URI"] );
|
||||
exit;
|
||||
|
||||
} else {
|
||||
// taken from cli arg, hack for updater
|
||||
$_SERVER["SERVER_ADDR"] = '127.0.0.1';
|
||||
$_SERVER["SERVER_NAME"] = '127.0.0.1';
|
||||
require("index.php");
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user