Back to nginx for now, split up index/admin entries

pull/9/head
Toby Zerner 2015-06-17 17:52:53 +09:30
parent 15ff6e7049
commit cc8a864f5a
4 changed files with 32 additions and 11 deletions

4
Vagrantfile vendored
View File

@ -193,10 +193,10 @@ Vagrant.configure("2") do |config|
##########
# Provision Apache Base
config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url]
# config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url]
# Provision Nginx Base
# config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url]
config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url]
####

28
admin.php Normal file
View File

@ -0,0 +1,28 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Server;
use Zend\Stratigility\MiddlewarePipe;
// Instantiate the application, register providers etc.
$app = require __DIR__.'/system/bootstrap.php';
// Set up everything we need for the frontend
$app->register('Flarum\Admin\AdminServiceProvider');
$admin = new MiddlewarePipe();
$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin'));
$admin->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')]));
$admin->pipe(new \Franzl\Middleware\Whoops\Middleware());
$server = Server::createServer(
$admin,
$_SERVER,
$_GET,
$_POST,
$_COOKIE,
$_FILES
);
$server->listen();

View File

@ -16,7 +16,7 @@ $api = new MiddlewarePipe();
$api->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
$api->pipe($app->make('Flarum\Api\Middleware\LoginWithHeader'));
$api->pipe('api.php', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.api.routes')]));
$api->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.api.routes')]));
$api->pipe(new \Franzl\Middleware\Whoops\Middleware());
$server = Server::createServer(

View File

@ -10,19 +10,12 @@ $app = require __DIR__.'/system/bootstrap.php';
// Set up everything we need for the frontend
$app->register('Flarum\Forum\ForumServiceProvider');
$app->register('Flarum\Admin\AdminServiceProvider');
// Build a middleware pipeline for Flarum
$flarum = new MiddlewarePipe();
$flarum->pipe($app->make('Flarum\Forum\Middleware\LoginWithCookie'));
$flarum->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
$admin = new MiddlewarePipe();
$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin'));
$admin->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')]));
$flarum->pipe('/admin.php', $admin);
$flarum->pipe('/index.php', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.forum.routes')]));
$flarum->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.forum.routes')]));
$flarum->pipe(new \Franzl\Middleware\Whoops\Middleware());
$server = Server::createServer(