summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-12-06 21:16:19 +0100
committerYorhel <git@yorhel.nl>2017-12-06 21:16:19 +0100
commitfe407fe3ec01deba81a6eee896699c65a0566426 (patch)
treef7ceae1646f7dae02525c7f6b462896a2625cef5
parent489603502533761684d3f098f4efc8fa3a92b3ff (diff)
Add instructions for running VNDB as standalone web server
-rw-r--r--README30
-rw-r--r--data/config_example.pl6
-rwxr-xr-xutil/vndb.pl8
3 files changed, 17 insertions, 27 deletions
diff --git a/README b/README
index 28bf16bc..fd3d3e08 100644
--- a/README
+++ b/README
@@ -23,6 +23,7 @@ Requirements
util/vndb.pl:
Algorithm::Diff::XS
TUWF
+ HTTP::Server::Simple (optional, but greatly simplifies development setup)
FCGI (optional, for running as a FastCGI script)
PerlIO::gzip (optional, for output compression)
@@ -75,32 +76,13 @@ Setup
- Update the vndb_site password in data/config.pl to whatever you set it in
the previous step.
- - Configure a web server. To use a single subdomain for both static files
- and the dynamic Perl code, here's a simple trick:
+ - Now simply run:
- mv www/* static/
- rmdir www
- ln -s static www
- ln -s ../util/vndb.pl www/cgi.pl
+ util/vndb.pl
- Then use the following Apache 2.4 config:
-
- <Directory /path/to/vndb>
- Options +ExecCGI +FollowSymLinks
- AllowOverride None
- Require all granted
- </Directory>
-
- <VirtualHost *:*>
- ServerName your-test-vndb
- DocumentRoot "/path/to/vndb/www"
-
- RewriteEngine On
- RewriteCond "%{DOCUMENT_ROOT}/%{REQUEST_URI}" !-s
- RewriteRule ^/ /cgi.pl
-
- AddHandler cgi-script .pl
- </VirtualHost>
+ (Note: At the time of writing, the above command will require the git
+ version of TUWF installed, but I intent to upload a new version to CPAN
+ after a bit more testing).
Contact
diff --git a/data/config_example.pl b/data/config_example.pl
index 980d997a..dd714c9c 100644
--- a/data/config_example.pl
+++ b/data/config_example.pl
@@ -10,13 +10,13 @@ package VNDB;
xml_pretty => 0,
log_queries => 0,
debug => 1,
- cookie_defaults => { path => '/' },
+ cookie_defaults => { domain => 'localhost', path => '/' },
);
%S = (
%S,
- url => 'http://your.site.root/',
- url_static => 'http://your.static.site.root/', # Can be the same as the main url
+ url => 'http://localhost:3000',
+ url_static => 'http://localhost:3000',
form_salt => '<some unique string>',
scrypt_salt => '<another unique string>',
);
diff --git a/util/vndb.pl b/util/vndb.pl
index b91aac56..46ff9e0d 100755
--- a/util/vndb.pl
+++ b/util/vndb.pl
@@ -50,6 +50,14 @@ TUWF::run();
sub reqinit {
my $self = shift;
+ # If we're running standalone, serve www/ and static/ too.
+ if($TUWF::OBJ->{_TUWF}{http}) {
+ if($self->resFile("$ROOT/www", $self->reqPath) || $self->resFile("$ROOT/static", $self->reqPath)) {
+ $self->resHeader('Cache-Control' => 'max-age=31536000');
+ return 0;
+ }
+ }
+
# check authentication cookies
$self->authInit;