|
|
|
 |
 |
 |
 |
APACHE CHANGES |
 |
|
|
With htaccess.sh you can enable the use of .htaccess files in your Qweb directories. With apachelogs.sh the apache logfiles are preserved when Apache or the system are restarted.
|
htaccess.sh
|
With this script you can enable the use of .htaccess and set the ServerName in Apache.
The changes are done in the /share/MD0_DATA/custom/customized/apache/apache.conf: Change the ServerName to the hostname of your Qnap system.
Before: #ServerName www.example.com DocumentRoot "/share/Qweb" <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "/share/Qweb"> Options FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory>
After: #ServerName www.example.com # CUSTOMIZED ServerName qnap DocumentRoot "/share/Qweb" <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "/share/Qweb"> # CUSTOMIZED Options FollowSymLinks MultiViews -Indexes # CUSTOMIZED AllowOverride All Order allow,deny Allow from all </Directory>
Instructions: 1) download htaccess.tar [20 KB]
2) move htaccess.tar to /share/MD0_DATA/custom 3) tar xf htaccess.tar 4) add the line /share/MD0_DATA/custom/scripts/htaccess.sh to /share/MD0_DATA/custom/autorunmaster.sh 5) custom changes made by yourself have to be done to /share/MD0_DATA/custom/customized/apache/apache.conf 6) execute /share/MD0_DATA/custom/autorunmaster.sh
Original configfiles can be found in: /share/MD0_DATA/custom/config-backup
|
apachelogs.sh
|
With this script the Apache logfiles are preserved when Apache or the system are restarted.
Before: The logfiles are kept in: /usr/local/apache/logs/apache_error_log /usr/local/apache/logs/apache_access_log
Every night they are "cleaned" when apache is restarted by a cronjob: 30 4 * * * /etc/init.d/Qthttpd.sh restart
In /etc/init.d/Qthttpd.sh: Top of the file: #!/bin/sh # For Qweb and Qphoto # default port: 80
Below line 34: clean_apache_log() { /bin/rm -f /usr/local/apache/logs/apache_error_log /bin/rm -f /usr/local/apache/logs/apache_access_log [ $? = 0 ] && echo "Apache logs have been cleaned." if [ x"`/bin/cat /etc/config/crontab | /bin/grep "Qthttpd"`" = x ]; then echo "30 4 * * * /etc/init.d/Qthttpd.sh restart" >> /etc/config/crontab fi /bin/sync return 0 }
After: Changes are made to preserve the logfiles and give them a timestamp. The logfiles are placed in the directory $LOGDIR (see below), you can change this to suit your needs or setup. Make sure that the path $LOGDIR exists. The customized Qthttpd.sh file is located in /share/MD0_DATA/custom/customized/apache
Top of the file: #!/bin/sh # For Qweb and Qphoto # default port: 80 # CUSTOMIZED # time stamp for backup config # CUSTOMIZED datim=$(date +%F-%H%M) # CUSTOMIZED LOGDIR="/share/MD0_DATA/custom/log/apache"
Below line 40: clean_apache_log() { # CUSTOMIZED (on one line) cp /usr/local/apache/logs/apache_error_log $LOGDIR/apache_error_log.$datim /bin/rm -f /usr/local/apache/logs/apache_error_log # CUSTOMIZED (on one line) cp /usr/local/apache/logs/apache_access_log $LOGDIR/apache_access_log.$datim /bin/rm -f /usr/local/apache/logs/apache_access_log [ $? = 0 ] && echo "Apache logs have been cleaned." if [ x"`/bin/cat /etc/config/crontab | /bin/grep "Qthttpd"`" = x ]; then echo "30 4 * * * /etc/init.d/Qthttpd.sh restart" >> /etc/config/crontab fi /bin/sync return 0 }
Instructions: 1) download apachelogs.tar [20 KB]
2) move apachelogs.tar to /share/MD0_DATA/custom 3) tar xf apachelogs.tar 4) add the line /share/MD0_DATA/custom/scripts/apachelogs.sh to /share/MD0_DATA/custom/autorunmaster.sh 5) custom changes made by yourself have to be done to /share/MD0_DATA/custom/customized/apache/Qthttpd.sh 6) execute /share/MD0_DATA/custom/autorunmaster.sh
Original configfiles can be found in: /share/MD0_DATA/custom/config-backup
|
|