diff --git a/config.apache b/config.apache index e69de29..3f457f9 100644 --- a/config.apache +++ b/config.apache @@ -0,0 +1,7 @@ + + ServerName $DOMAIN + DocumentRoot $INSTALL_DIR + + CustomLog \${APACHE_LOG_DIR}/jilo-web_access.log combined + ErrorLog \${APACHE_LOG_DIR}/jilo-web_error.log + diff --git a/config.nginx b/config.nginx index e69de29..f1f8002 100644 --- a/config.nginx +++ b/config.nginx @@ -0,0 +1,15 @@ +server { + listen 80; + server_name $DOMAIN; + + root $INSTALL_DIR; + index index.php; + + location / { + try_files \$uri \$uri/ /index.php?\$args; + } + + location ~ /\.ht { + deny all; + } +} diff --git a/packaging/build-deb b/packaging/build-deb index e5739e9..f7ef3e6 100755 --- a/packaging/build-deb +++ b/packaging/build-deb @@ -22,6 +22,8 @@ cp ../../CHANGELOG.md "jilo-web-$VERSION/usr/share/doc/jilo-web/" cp ../../LICENSE "jilo-web-$VERSION/usr/share/doc/jilo-web/" cp ../../README.md "jilo-web-$VERSION/usr/share/doc/jilo-web/" cp ../../TODO.md "jilo-web-$VERSION/usr/share/doc/jilo-web/" +cp ../../config.apache "jilo-web-$VERSION/usr/share/doc/jilo-web/" +cp ../../config.nginx "jilo-web-$VERSION/usr/share/doc/jilo-web/" mkdir -p "jilo-web-$VERSION/usr/share/man/man8" cp ../man-jilo-web.8 "jilo-web-$VERSION/usr/share/man/man8/jilo-web.8" diff --git a/packaging/deb-postinst b/packaging/deb-postinst old mode 100644 new mode 100755 index 56058bb..d81d0d8 --- a/packaging/deb-postinst +++ b/packaging/deb-postinst @@ -33,60 +33,23 @@ case "$1" in # we need a webserver, check for Apache and Nginx WEB_SERVER="" + + # install and enable apache vhost if dpkg-query -W -f='${status}' apache2 2>/dev/null | grep -q "ok installed"; then WEB_SERVER="apache2" - elif - WEB_SERVER="nginx" - else - echo "Nginx or Apache is needed, please install one of them first." - exit 1 - fi - - # finish configuration depending on web server - if [ "$WEB_SERVER" = "apache2" ]; then - - # vhost file - VHOST_APACHE="/etc/apache2/sites-available/jilo-web.conf" - cat < "$VHOST_APACHE" - - ServerName $DOMAIN - DocumentRoot $INSTALL_DIR - - CustomLog \${APACHE_LOG_DIR}/jilo-web_access.log combined - ErrorLog \${APACHE_LOG_DIR}/jilo-web_error.log - -EOF - - # enable vhost and reload + cp "${INSTALL_DIR}/config.apache" /etc/apache2/sites-available/jilo-web.conf a2ensite jilo-web.conf /etc/init.d/apache2 reload - elif [ "$WEB_SERVER" = "nginx" ]; then - - # vhost file - VHOST_NGINX="/etc/nginx/sites-available/jilo-web" - cat < "$VHOST_NGINX" -server { - listen 80; - server_name $DOMAIN; - - root $INSTALL_DIR; - index index.php; - - location / { - try_files \$uri \$uri/ /index.php?\$args; - } - - location ~ /\.ht { - deny all; - } -} -EOF - - # enable vhost and reload + # install and enable nginx vhost + elif dpkg-query -W -f='${status}' nginx 2>/dev/null | grep -q "ok installed"; then + WEB_SERVER="nginx" + cp "${INSTALL_DIR}/config.nginx" /etc/nginx/sites-available/jilo-web ln -s /etc/nginx/sites-available/jilo-web /etc/nginx/sites-enabled/ /etc/init.d/nginx reload - + else + echo "Nginx or Apache is needed, please install one of them first." + exit 1 fi # permissions for web folder