diff --git a/README.md b/README.md index 2738d002..01d92b0b 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,17 @@ All other settings are set using the web interface (user management, scan settin If a setting is not present in the configuration file, a hardcoded default value is used (the same as in the [default.conf](https://github.com/epoupon/lms/blob/master/conf/lms.conf) file) +### Deploy on non root path +If you want to deploy on non root path (e.g. https://mydomain.com/newroot/), you have to do the following steps: +* Create a new intermediary `newroot` directory in `/usr/share/lms/docroot` +* Symlink `/usr/share/lms/docroot/newroot/resources` to `/usr/share/Wt/resources` +* Edit `lms.conf` and set: +``` +wt-resources = "" +docroot = "/usr/share/lms/docroot/;/newroot/resources,/newroot/css,/newroot/images,/newroot/js,/newroot/favicon.ico";` +deploy-path = "/newroot/"; +``` + ### Reverse proxy settings _LMS_ is shipped with an embedded web server, but it is recommended to deploy behind a reverse proxy. You have to set the _behind-reverse-proxy_ option to _true_ in the `lms.conf` configuration file. diff --git a/conf/lms.conf b/conf/lms.conf index 04d48d54..e1666f60 100644 --- a/conf/lms.conf +++ b/conf/lms.conf @@ -18,19 +18,18 @@ listen-port = 5082; listen-addr = "0.0.0.0"; behind-reverse-proxy = false; -# Location for deployment -deploy-path = "/"; - # If enabled, these files have to exist and have correct permissions tls-enable = false; tls-cert = "/var/lms/cert.pem"; tls-key = "/var/lms/privkey.pem"; tls-dh = "/var/lms/dh2048.pem"; -# Path to the resources used by the web interface +# Path to the resources used by the web interface. wt-resources = "/usr/share/Wt/resources"; docroot = "/usr/share/lms/docroot/;/resources,/css,/images,/js,/favicon.ico"; approot = "/usr/share/lms/approot"; +# Location for deployment (See README if you want to deploy on a non root path) +deploy-path = "/"; # Acoustic brainz's root API acousticbrainz-api-url = "https://acousticbrainz.org/api/v1/"; diff --git a/src/lms/main.cpp b/src/lms/main.cpp index 39d7eb15..bbaa1985 100644 --- a/src/lms/main.cpp +++ b/src/lms/main.cpp @@ -43,13 +43,15 @@ std::vector generateWtConfig(std::string execPath) const std::filesystem::path wtConfigPath {ServiceProvider::get()->getPath("working-dir") / "wt_config.xml"}; const std::filesystem::path wtLogFilePath {ServiceProvider::get()->getPath("log-file", "/var/log/lms.log")}; const std::filesystem::path wtAccessLogFilePath {ServiceProvider::get()->getPath("access-log-file", "/var/log/lms.access.log")}; + const std::filesystem::path wtResourcesPath {ServiceProvider::get()->getPath("wt-resources", "/usr/share/Wt/resources")}; args.push_back(execPath); args.push_back("--config=" + wtConfigPath.string()); args.push_back("--docroot=" + ServiceProvider::get()->getString("docroot")); args.push_back("--approot=" + ServiceProvider::get()->getString("approot")); args.push_back("--deploy-path=" + ServiceProvider::get()->getString("deploy-path", "/")); - args.push_back("--resources-dir=" + ServiceProvider::get()->getString("wt-resources")); + if (!wtResourcesPath.empty()) + args.push_back("--resources-dir=" + wtResourcesPath.string()); if (ServiceProvider::get()->getBool("tls-enable", false)) { diff --git a/src/lms/ui/LmsApplication.cpp b/src/lms/ui/LmsApplication.cpp index 1dfb5b30..a0cbf299 100644 --- a/src/lms/ui/LmsApplication.cpp +++ b/src/lms/ui/LmsApplication.cpp @@ -153,9 +153,9 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env, messageResourceBundle().use(appRoot() + "tracksinfo"); // Require js here to avoid async problems - requireJQuery("/js/jquery-1.10.2.min.js"); - require("/js/mediaplayer.js"); - require("/js/bootstrap-notify.js"); + requireJQuery("js/jquery-1.10.2.min.js"); + require("js/mediaplayer.js"); + require("js/bootstrap-notify.js"); setTitle("LMS");