1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Merge pull request #813 from RaspAP/bugfix/routing

Routing custom install dir bugfix
This commit is contained in:
Bill Zimmerman 2021-03-03 20:19:12 +01:00 committed by GitHub
commit 11d867eccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 8 deletions

View File

@ -2,8 +2,8 @@ server.modules += (
"mod_rewrite", "mod_rewrite",
) )
$HTTP["url"] =~ "^/(?!(dist|app|ajax|config)).*" { $HTTP["url"] =~ "^/REPLACE_ME/(?!(dist|app|ajax|config)).*" {
url.rewrite-once = ( url.rewrite-once = ( "^/REPLACE_ME/(.*?)(\?.+)?$"=>"/REPLACE_ME/index.php/$1?$2" )
"^/[^\?]*(\?.*)?" => "/index.php$1" server.error-handler-404 = "/REPLACE_ME/index.php"
)
} }

View File

@ -49,7 +49,7 @@ require_once 'includes/torproxy.php';
$config = getConfig(); $config = getConfig();
$output = $return = 0; $output = $return = 0;
$page = $_SERVER['REQUEST_URI']; $page = $_SERVER['PATH_INFO'];
$theme_url = getThemeOpt(); $theme_url = getThemeOpt();
$toggleState = getSidebarState(); $toggleState = getSidebarState();

View File

@ -208,14 +208,30 @@ function _install_lighttpd_configs() {
# Copy config files # Copy config files
echo "Copying 50-raspap-router.conf to /etc/lighttpd/conf-available" echo "Copying 50-raspap-router.conf to /etc/lighttpd/conf-available"
sudo cp "$webroot_dir/config/50-raspap-router.conf" "/etc/lighttpd/conf-available" || _install_status 1 "Unable to copy lighttpd config file."
CONFSRC="$webroot_dir/config/50-raspap-router.conf"
LTROOT=$(grep "server.document-root" /etc/lighttpd/lighttpd.conf | awk -F '=' '{print $2}' | tr -d " \"")
# compare values and get difference
HTROOT=${webroot_dir/$LTROOT}
# remove trailing slash if present
HTROOT=$(echo "$HTROOT" | sed -e 's/\/$//')
# substitute values
awk "{gsub(\"/REPLACE_ME\",\"$HTROOT\")}1" $CONFSRC > /tmp/50-raspap-router.conf
# copy into place
sudo cp /tmp/50-raspap-router.conf /etc/lighttpd/conf-available/ || _install_status 1 "Unable to copy lighttpd config file into place."
# link into conf-enabled # link into conf-enabled
echo "Creating link to /etc/lighttpd/conf-enabled"|| _install_status 1 "Unable to copy lighttpd config file." echo "Creating link to /etc/lighttpd/conf-enabled"
sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file." sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file (this is normal if the link already exists)."
sudo systemctl restart lighttpd.service || _install_status 1 "Unable to restart lighttpd" sudo systemctl restart lighttpd.service || _install_status 1 "Unable to restart lighttpd"
_install_status 0 _install_status 0
} }
# Prompt to install ad blocking # Prompt to install ad blocking
function _prompt_install_adblock() { function _prompt_install_adblock() {
_install_log "Configure ad blocking (Beta)" _install_log "Configure ad blocking (Beta)"