# HG changeset patch # User wenzelm # Date 1572459781 -3600 # Node ID 46847076477caf296bd66a6b626b0e5b70ca3f60 # Parent 79736ffe77c38ccdbb40b47a17fdfbbd2c12054e Apache setup; proper "-" for URL: avoid problems with "_"; diff -r 79736ffe77c3 -r 46847076477c etc/options --- a/etc/options Wed Oct 30 15:50:57 2019 +0100 +++ b/etc/options Wed Oct 30 19:23:01 2019 +0100 @@ -350,6 +350,8 @@ option phabricator_www_user : string = "www-data" option phabricator_www_root : string = "/var/www" +option phabricator_apache_root : string = "/etc/apache2" + option phabricator_smtp_host : string = "" option phabricator_smtp_port : int = 465 option phabricator_smtp_user : string = "" diff -r 79736ffe77c3 -r 46847076477c src/Pure/Tools/phabricator.scala --- a/src/Pure/Tools/phabricator.scala Wed Oct 30 15:50:57 2019 +0100 +++ b/src/Pure/Tools/phabricator.scala Wed Oct 30 19:23:01 2019 +0100 @@ -15,7 +15,7 @@ val default_name = "vcs" - def default_prefix(name: String): String = "phabricator_" + name + def default_prefix(name: String): String = "phabricator-" + name def default_root(options: Options, name: String): Path = Path.explode(options.string("phabricator_www_root")) + Path.basic(default_prefix(name)) @@ -36,6 +36,9 @@ val global_config = Path.explode("/etc/isabelle-phabricator.conf") sealed case class Config(name: String, root: Path) + { + def www_root: Path = root + Path.explode("phabricator/webroot") + } def read_config(): List[Config] = { @@ -113,6 +116,40 @@ val config = Config(name, root_path) write_config(configs ::: List(config)) + + + /* Apache setup */ + + progress.echo("Apache setup...") + + val apache_root = Path.explode(options.string("phabricator_apache_root")) + val apache_sites = apache_root + Path.explode("sites-available") + + if (!apache_sites.is_dir) error("Bad Apache sites directory " + apache_sites) + + File.write(apache_sites + Path.basic(prefix_name + ".conf"), +""" + #ServerName: "lvh.me" is an alias for "localhost" for testing + ServerName """ + prefix_name + """.lvh.me + ServerAdmin webmaster@localhost + DocumentRoot """ + config.www_root.implode + """ + + ErrorLog ${APACHE_LOG_DIR}/error.log + RewriteEngine on + RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet +""") + + Isabelle_System.bash(""" + set -e + a2enmod rewrite + a2ensite """ + Bash.string(prefix_name) + """ + systemctl restart apache2 +""").check + + progress.echo("\nDONE\nWeb configuration via http://" + prefix_name + ".lvh.me") }