mirror of https://github.com/flarum/flarum
Reconfigure nginx during provisioning to do rewrites
parent
f07fc1d838
commit
e75f8f2ba2
|
@ -13,7 +13,7 @@ $app->register('Flarum\Admin\AdminServiceProvider');
|
||||||
|
|
||||||
$admin = new MiddlewarePipe();
|
$admin = new MiddlewarePipe();
|
||||||
$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin'));
|
$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin'));
|
||||||
$admin->pipe('/admin.php', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')]));
|
$admin->pipe('/admin', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')]));
|
||||||
$admin->pipe(new \Franzl\Middleware\Whoops\Middleware());
|
$admin->pipe(new \Franzl\Middleware\Whoops\Middleware());
|
||||||
|
|
||||||
$server = Server::createServer(
|
$server = Server::createServer(
|
||||||
|
|
2
api.php
2
api.php
|
@ -16,7 +16,7 @@ $api = new MiddlewarePipe();
|
||||||
$api->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
|
$api->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
|
||||||
$api->pipe($app->make('Flarum\Api\Middleware\LoginWithHeader'));
|
$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('/api', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.api.routes')]));
|
||||||
$api->pipe(new \Franzl\Middleware\Whoops\Middleware());
|
$api->pipe(new \Franzl\Middleware\Whoops\Middleware());
|
||||||
|
|
||||||
$server = Server::createServer(
|
$server = Server::createServer(
|
||||||
|
|
|
@ -15,7 +15,7 @@ $app->register('Flarum\Forum\ForumServiceProvider');
|
||||||
$flarum = new MiddlewarePipe();
|
$flarum = new MiddlewarePipe();
|
||||||
$flarum->pipe($app->make('Flarum\Forum\Middleware\LoginWithCookie'));
|
$flarum->pipe($app->make('Flarum\Forum\Middleware\LoginWithCookie'));
|
||||||
$flarum->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
|
$flarum->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
|
||||||
$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());
|
$flarum->pipe(new \Franzl\Middleware\Whoops\Middleware());
|
||||||
|
|
||||||
$server = Server::createServer(
|
$server = Server::createServer(
|
||||||
|
|
|
@ -1,6 +1,61 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
su - vagrant
|
su - vagrant
|
||||||
|
|
||||||
|
block="
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
root /vagrant;
|
||||||
|
index index.html index.htm index.php app.php app_dev.php;
|
||||||
|
|
||||||
|
# Make site accessible from ...
|
||||||
|
server_name 192.168.29.29.xip.io flarum.dev;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/vagrant.com-access.log;
|
||||||
|
error_log /var/log/nginx/vagrant.com-error.log error;
|
||||||
|
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files \$uri \$uri/ /app.php?\$query_string /index.php?\$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api {
|
||||||
|
try_files \$uri \$uri/ /api.php?\$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /admin {
|
||||||
|
try_files \$uri \$uri/ /admin.php?\$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /favicon.ico { log_not_found off; access_log off; }
|
||||||
|
location = /robots.txt { access_log off; log_not_found off; }
|
||||||
|
|
||||||
|
# pass the PHP scripts to php5-fpm
|
||||||
|
# Note: .php$ is susceptible to file upload attacks
|
||||||
|
# Consider using: \"location ~ ^/(index|app|app_dev|config).php(/|$) {\"
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files \$uri =404;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
# With php5-fpm:
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||||
|
fastcgi_param LARA_ENV local; # Environment variable for Laravel
|
||||||
|
fastcgi_param HTTPS off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Deny .htaccess file access
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
|
||||||
|
echo "$block" > "/etc/nginx/sites-available/vagrant"
|
||||||
|
service nginx restart
|
||||||
|
|
||||||
### Setup NPM globals and create necessary directories ###
|
### Setup NPM globals and create necessary directories ###
|
||||||
sudo apt-get install -y phantomjs zsh exuberant-ctags
|
sudo apt-get install -y phantomjs zsh exuberant-ctags
|
||||||
mkdir /home/vagrant/npm
|
mkdir /home/vagrant/npm
|
||||||
|
|
Loading…
Reference in New Issue