Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mod_xsendfile.conf] Synology package upgrade reset the XSendFilePath directive (download not working) #12

Closed
yanncam opened this issue Nov 12, 2017 · 1 comment

Comments

@yanncam
Copy link
Owner

yanncam commented Nov 12, 2017

Hello all,

I created this issue myself because I have encountered the following problem and I think the solution can be usefull for all:

On my Synology NAS, auto-upgrade of packages is enable. So my Apache2.2 or Apache2.4 packages are automatically upgraded (and their configuration file reseted).

It's the case for the mod_xsendfile.conf, which is automatically reseted for each package upgrade.
This reset set the XSendFilePath to it's default value rather than my custom needed for KodiWebPortal:

Value needed for KodiWebPortal when download is enable (as example):

XSendFilePath /volume1/MEDIATHEQUE

So, to prevent the reset of this value in the mod_xsendfile.conf, I have created a little shell-script on the Synology and put this script as an automated task executed each night (crontab).

I have created these file:

  • /volume1/web/scripts/.htaccess:
deny from all
  • /volume1/web/scripts/.conf-backup/

Directory for backup (timestamped) previous mod_xsendfile.conf file.

  • /volume1/web/scripts/enableDownload.sh:
#!/bin/sh
BACKUPDIR=/volume1/web/scripts/.conf-backup
NOW="$(date +"%Y%m%d")"
/bin/cp /volume1/@appstore/Apache2.2/usr/local/etc/apache22/conf/extra/mod_xsendfile.conf $BACKUPDIR/$NOW-mod_xsendfile.conf
/bin/sed -i 's/^XSendFilePath .*/XSendFilePath \/volume1/' /volume1/@appstore/Apache2.2/usr/local/etc/apache22/conf/extra/mod_xsendfile.conf

(it's my own script for my own Apache2.2 package ; if you use Apache2.4, change filepath).

Then, I configured in Synologi's DSM a new cron:

xsendfile

This script can be optimized with (some ideas):

  • Auto-restart the Apache 2.X daemon at the end
  • Generic script to be compliant with Apache2.2, Apache2.4 or old Synology's webstation
  • Check the previous mod_xsendfile.conf content before updating it
  • Delete old mod_xsendfile.conf backup after X days
  • Etc.

Do not hesitate to improve it and submit your script :) !

Sincerely,

@yanncam yanncam closed this as completed Nov 12, 2017
@boing86
Copy link
Contributor

boing86 commented Jan 30, 2018

Hello
For the reboot of apache have two options.

https://forum.synology.com/enu/viewtopic.php?t=107575
image

or
Apache webserver:
stop pkg-apache22
start pkg-apache22
reload pkg-apache22
https://diktiosolutions.eu/en/synology/synology-dsm-6-terminal-service-control-en/

I will try it this week.

greeting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants