OMV with Nginx instead of Apache

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • OMV with Nginx instead of Apache

      I am interested to use OMV, but I prefer to use Nginx instead of Apache. So I plan to manually install OMV on my Debian server. Do you think this is feasible? If so, does any of you try that or know a blog about that? Or am I looking for troubles? Thanks in advance.
    • Re: OMV with Nginx instead of Apache

      "WastlJ" wrote:

      Have a look here:
      forums.openmediavault.org/viewtopic.php?f=3&t=4243

      And I would definitely wait for OMV 1.0...

      Thanks for your response J.

      I dug up this forum before I posted my question so I have read that discussion before. However, it does not provide explicit answer. If I understood that right, I have to install OMV with Apache first. Then install Nginx and try to have it working with the OMV plugins. And finally, uninstall Apache. What I am looking for is a clean install of OMV with Nginx, because it is quite a pain to uninstall Apache due to its dependencies.

      I will try to play around a bit while I am waiting for v1.0.
    • Re: OMV with Nginx instead of Apache

      Apache is a dependency of OMV. No way around it and I know from speaking with Volker that that will not change. It isn't a pain to install apache because OMV configures it.

      Source Code

      1. Install base wheezy system with no extra packages (no apache, no php, etc)
      2. echo "deb http://packages.openmediavault.org/public kralizec main" > /etc/apt/sources.list.d/openmediavault.list
      3. apt-get update
      4. apt-get install openmediavault-keyring postfix
      5. apt-get update
      6. apt-get install openmediavault
      7. omv-initsystem

      No configuring apache in that, is there :)

      It shouldn't matter what the omv web interface is hosted with. You don't have to use apache for sites. I don't. The nginx plugin works very well and is integrated with OMV web interface. The plugin works fine on 0.5 but it is a little more difficult to get nginx on squeeze. If you are comfortable enough with Linux, install Wheezy, omv 0.6 (using above instructions) and the nginx plugin. You will see what I mean. If you aren't accessing OMV's web interface, it won't matter that two web servers are running.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      Yes. Indeed there is no configuration of Apache and it is very easy to configure it. But my point is, I don't want to have Apache installed at all as I hate it to my bone, especially for the purpose to provide web based GUI.

      You gave me a bit more hint though, for achieving what I want to have. I just checked all repositories under packages.openmediavault.org/public/dists/. As you said, OMV depends on apache. So there is no way I will be able to avoid apache being installed unless I recompile it without dependency to Apache. I guess that is what I need to do if I still want to use OMV.
    • Re: OMV with Nginx instead of Apache

      Apache is more than just a dependency for the OMV .deb. Last time I tried, the web interface did work (limited testing) with nginx but there are apache files it will config and other files that will try to restart apache. I don't understand why you care what server is serving the web interface pages though. It will be a LOT of work for very little gain... OMV code is here.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      "ryecoaaron" wrote:

      I don't understand why you care what server is serving the web interface pages though. It will be a LOT of work for very little gain... OMV code is here.

      The answer is resource efficiency, especially on low resource system (RAM+CPU). So I don't think there will be very little gain in using Nginx as opposed to Apache. As an extreme example, just imagine how Wifi router would perform if the web interface is running on Apache.

      After digging up this forum more, I found that I am not the only one asking about this. Somebody even requested a new feature for this, bugtracker.openmediavault.org/view.php?id=729. But I am not trying to demand anything by pointing that out. I will try to do what I want to achieve myself. So don't worry about this.

      Thanks for the link to OMV's code. I actually already svn checked-out that into my Debian PC a few hours ago, and started exploring and understanding what I need to change to remove all dependencies to Apache. Let's see in 2 weeks either to drop OMV or not.
    • Re: OMV with Nginx instead of Apache

      I'd personally would like an abstraction layer for the web server in OMV. I don't think it should be that difficult since not many things touch the web server config. You'd need to tell OMV what server you'd like to use and then just abstract things like enabling and disabling of sites I guess.

      If you want OMV up and running with Nginx and php-fpm I use these configs to do the job:
      /etc/nginx/sites-available/openmediavault

      Source Code

      1. server {
      2. listen 80 default_server;
      3. root /var/www/openmediavault;
      4. index index.php;
      5. location ~ \.php$ {
      6. fastcgi_split_path_info ^(.+\.php)(/.+)$;
      7. fastcgi_pass unix:/var/run/openmediavault-fpm.sock;
      8. fastcgi_index index.php;
      9. include fastcgi_params;
      10. }
      11. location /extjs/ {
      12. alias /usr/share/javascript/extjs4/;
      13. }
      14. location /images/ {
      15. alias /var/www/openmediavault/images/;
      16. }
      17. large_client_header_buffers 4 32k;
      18. access_log /var/log/nginx/openmediavault-access.log;
      19. error_log /var/log/nginx/openmediavault-error.log;
      20. }
      Display All

      /etc/php5/fpm/pool.d/openmediavault.conf

      Source Code

      1. [openmediavault]
      2. listen = /var/run/openmediavault-fpm.sock
      3. listen.owner = www-data
      4. listen.mode = 0600
      5. user = openmediavault
      6. group = openmediavault
      7. pm = dynamic
      8. pm.max_children = 5
      9. pm.start_servers = 2
      10. pm.min_spare_servers = 1
      11. pm.max_spare_servers = 3
      12. ; OpenMediaVault php.ini settings
      13. ; Paths and Directories
      14. php_value[include_path] = ".:/usr/share/php:/var/www/openmediavault"
      15. ; Pam Authentication Support (see /etc/pam.d) ;
      16. php_value[pam.servicename] = "openmediavault";
      17. ; Maximum allowed size for uploaded files.
      18. ; http://php.net/upload-max-filesize
      19. php_value[upload_max_filesize] = 25M
      20. ; Maximum size of POST data that PHP will accept.
      21. ; http://php.net/post-max-size
      22. php_value[post_max_size] = 25M
      23. ; Do not expose to the world that PHP is installed on the server.
      24. ; http://php.net/expose-php
      25. php_flag[expose_php] = Off
      26. ; Name of the session (used as cookie name).
      27. ; http://php.net/session.name
      28. php_value[session.name] = OMVSESSID
      29. ; Default timeout for socket based streams (seconds)
      30. ; http://php.net/default-socket-timeout
      31. php_value[default_socket_timeout] = 90
      32. ; Maximum execution time of each script, in seconds
      33. ; http://php.net/max-execution-time
      34. ; Note: This directive is hardcoded to 0 for the CLI SAPI
      35. php_value[max_execution_time] = 90
      Display All

      This won't include certain services with their own sites like Owncloud, but I don't see how that should be hard to fix :) All you have to do then is to build the openmediavault package without apache as a dependency. It's however not fun doing that for each update.
    • Re: OMV with Nginx instead of Apache

      While agree with those points, the web interface in OMV 0.6 is fast even on RPi and cubieboard. If you are successful, submit the changes to Volker. I like nginx better myself but haven't a reason to make the changes.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      "subzeroin" wrote:

      I'd personally would like an abstraction layer for the web server in OMV.

      If you wrote the stuff, maybe Volker would include it :)
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      "subzeroin" wrote:

      It's however not fun doing that for each update.

      Yes. I can imagine the pain to re-apply all changes every time after the updates. But if I would have OMV running with Nginx, it will be based on trunk. So I will definitely not do the updates everyday. :D

      And thanks a lot for the configs and the hints. I really appreciate that.
    • Re: OMV with Nginx instead of Apache

      "ryecoaaron" wrote:

      While agree with those points, the web interface in OMV 0.6 is fast even on RPi and cubieboard. If you are successful, submit the changes to Volker. I like nginx better myself but haven't a reason to make the changes.

      I am actually still at a very early stage of having a NAS system, i.e. research stage. I just got Lian Li PC-Q08 Mini-ITX case last week, so I still need to buy a lot of parts. I am still searching for low power Mini-ITX board like ASUS C60M1-I but found nothing close to that yet. Does anybody has suggestion? :)

      However, I will try to set up my RPi as test system for OMV with Nginx in the next few days (when I have spare time). But I am not sure though if the result will be worth it to be submitted for changes. It would possibly be better after I have it running on a real NAS system.
    • Re: OMV with Nginx instead of Apache

      Interesting... Just a had a quick look. There seems to be only one file (one line at that) you would have to monitor for changes between versions - usr/share/openmediavault/engined/module/webadmin.inc. The other three files (apache module, apache mkconf, and apache monit) that need changes would be replaced by nginx versions completely. You would just have to make sure the replacements worked with newer versions. I may have missed something but it doesn't look bad at all.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      It works :)

      Changed five files and OMV 0.6.0.9 installs without apache and works fine so far. My quick hack (with subzero's config) ignores web admin settings but it works. Changed two files, deleted three, and created three. So patching the source each version would consist of editing the debian control and postinst files, removing three apache files, and adding three nginx files. Interesting... :)
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      "ryecoaaron" wrote:

      It works :)

      That is so not fair! :D
      You have it working already while I am still trying to understand how OMV core interacts with its plugins.
      Ok then. I will start with a "dirty path". I hope I will catch you before the weekend.
    • Re: OMV with Nginx instead of Apache

      Here are my changes :) I think I got them all. I was just doing it to see how easy it was. I don't plan on doing anymore.

      Change debian/control - line 11 to:

      Source Code

      1. Depends: libjs-extjs4 (>= 4.2.2), nginx, php5-fpm,


      Delete usr/share/openmediavault/mkconf/monit.d/apache:
      Create usr/share/openmediavault/mkconf/monit.d/nginx:

      Shell-Script

      1. #!/bin/sh
      2. set -e
      3. . /etc/default/openmediavault
      4. . /usr/share/openmediavault/scripts/helper-functions
      5. OMV_MONIT_SERVICE_NGINX_CONFIG="/etc/monit/conf.d/openmediavault-nginx.conf"
      6. OMV_MONIT_SERVICE_NGINX_MODE="active"
      7. cat <<EOF > ${OMV_MONIT_SERVICE_NGINX_CONFIG}
      8. check process nginx with pidfile /var/run/nginx.pid
      9. start program = "/etc/init.d/nginx start"
      10. stop program = "/etc/init.d/nginx stop"
      11. mode ${OMV_MONIT_SERVICE_NGINX_MODE}
      12. EOF
      13. # Disable event notifications.
      14. xmlstarlet sel -t -m "//system/email" \
      15. -i "enable = '1'" \
      16. -i "//system/notification/notifications/monitprocevents = '0'" \
      17. -v "concat(' noalert ',primaryemail)" \
      18. -b \
      19. -b \
      20. -n \
      21. ${OMV_CONFIG_FILE} | xmlstarlet unesc >> ${OMV_MONIT_SERVICE_NGINX_CONFIG}
      Display All


      Delete usr/share/openmediavault/mkconf/apache
      Create usr/share/openmediavault/mkconf/nginx

      Shell-Script

      1. #!/bin/sh
      2. set -e
      3. . /etc/default/openmediavault
      4. . /usr/share/openmediavault/scripts/helper-functions
      5. OMV_NGINX_SITE_OPENMEDIAVAULT_CONFIG="/etc/nginx/sites-available/openmediavault"
      6. OMV_NGINX_SITE_OPENMEDIAVAULT_ENABLED="/etc/nginx/sites-enabled/openmediavault"
      7. OMV_NGINX_PHP5_FPM_CONFIG="/etc/php5/fpm/pool.d/openmediavault.conf"
      8. cat <<EOF > ${OMV_NGINX_SITE_OPENMEDIAVAULT_CONFIG}
      9. server {
      10. listen 80 default_server;
      11. root /var/www/openmediavault;
      12. index index.php;
      13. location ~ \.php$ {
      14. fastcgi_split_path_info ^(.+\.php)(/.+)$;
      15. fastcgi_pass unix:/var/run/openmediavault-fpm.sock;
      16. fastcgi_index index.php;
      17. include fastcgi_params;
      18. }
      19. location /extjs/ {
      20. alias /usr/share/javascript/extjs4/;
      21. }
      22. location /images/ {
      23. alias /var/www/openmediavault/images/;
      24. }
      25. large_client_header_buffers 4 32k;
      26. access_log /var/log/nginx/openmediavault-access.log;
      27. error_log /var/log/nginx/openmediavault-error.log;
      28. }
      29. EOF
      30. cat <<EOF > ${OMV_NGINX_PHP5_FPM_CONFIG}
      31. [openmediavault]
      32. listen = /var/run/openmediavault-fpm.sock
      33. listen.owner = www-data
      34. listen.mode = 0600
      35. user = openmediavault
      36. group = openmediavault
      37. pm = dynamic
      38. pm.max_children = 5
      39. pm.start_servers = 2
      40. pm.min_spare_servers = 1
      41. pm.max_spare_servers = 3
      42. ; OpenMediaVault php.ini settings
      43. ; Paths and Directories
      44. php_value[include_path] = ".:/usr/share/php:/var/www/openmediavault"
      45. ; Pam Authentication Support (see /etc/pam.d) ;
      46. php_value[pam.servicename] = "openmediavault";
      47. ; Maximum allowed size for uploaded files.
      48. ; http://php.net/upload-max-filesize
      49. php_value[upload_max_filesize] = 25M
      50. ; Maximum size of POST data that PHP will accept.
      51. ; http://php.net/post-max-size
      52. php_value[post_max_size] = 25M
      53. ; Do not expose to the world that PHP is installed on the server.
      54. ; http://php.net/expose-php
      55. php_flag[expose_php] = Off
      56. ; Name of the session (used as cookie name).
      57. ; http://php.net/session.name
      58. php_value[session.name] = OMVSESSID
      59. ; Default timeout for socket based streams (seconds)
      60. ; http://php.net/default-socket-timeout
      61. php_value[default_socket_timeout] = 90
      62. ; Maximum execution time of each script, in seconds
      63. ; http://php.net/max-execution-time
      64. ; Note: This directive is hardcoded to 0 for the CLI SAPI
      65. php_value[max_execution_time] = 90
      66. EOF
      67. if [ ! -e "${OMV_NGINX_SITE_OPENMEDIAVAULT_ENABLED}" ]; then
      68. ln -s OMV_NGINX_SITE_OPENMEDIAVAULT_CONFIG OMV_NGINX_SITE_OPENMEDIAVAULT_ENABLED
      69. fi
      Display All


      Delete usr/share/openmediavault/engined/module/apache.inc
      Create usr/share/openmediavault/engined/module/nginx.inc

      PHP Source Code

      1. <?php
      2. /**
      3. * This file is part of OpenMediaVault.
      4. *
      5. * @license http://www.gnu.org/licenses/gpl.html GPL Version 3
      6. * @author Volker Theile <volker.theile@openmediavault.org>
      7. * @copyright Copyright (c) 2009-2014 Volker Theile
      8. *
      9. * OpenMediaVault is free software: you can redistribute it and/or modify
      10. * it under the terms of the GNU General Public License as published by
      11. * the Free Software Foundation, either version 3 of the License, or
      12. * any later version.
      13. *
      14. * OpenMediaVault is distributed in the hope that it will be useful,
      15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      17. * GNU General Public License for more details.
      18. *
      19. * You should have received a copy of the GNU General Public License
      20. * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
      21. */
      22. require_once("openmediavault/module.inc");
      23. require_once("openmediavault/error.inc");
      24. require_once("openmediavault/initscript.inc");
      25. class OMVModuleNginx extends OMVModuleServiceAbstract {
      26. /**
      27. * Get the module name.
      28. */
      29. public function getName() {
      30. return "nginx";
      31. }
      32. /**
      33. * Defines the modules that if present should build their configuration
      34. * before the service provided by this module.
      35. * @return An array of modules.
      36. */
      37. public function shouldApply() { return array("certificatemgmt"); }
      38. /**
      39. * Generate the configuration.
      40. * @throw E_EXEC_FAILED
      41. */
      42. public function applyConfig() {
      43. $cmd = "omv-mkconf ngninx 2>&1";
      44. if(0 !== $this->exec($cmd, $output)) {
      45. throw new OMVException(OMVErrorMsg::E_EXEC_FAILED,
      46. $cmd, implode("\n", $output));
      47. }
      48. }
      49. /**
      50. * Start the managed service.
      51. */
      52. public function startService() {
      53. $initd = new OMVSysVInitScript("nginx", TRUE);
      54. $initd->invoke("reload");
      55. }
      56. }
      57. // Register module.
      58. $moduleMgr = &OMVModuleMgr::getInstance();
      59. $moduleMgr->registerModule(new OMVModuleNginx());
      60. ?>
      Display All


      Change debian/openmediavault.postinst to:

      Source Code

      1. #!/bin/sh
      2. #
      3. # This file is part of OpenMediaVault.
      4. #
      5. # @license http://www.gnu.org/licenses/gpl.html GPL Version 3
      6. # @author Volker Theile <volker.theile@openmediavault.org>
      7. # @copyright Copyright (c) 2009-2014 Volker Theile
      8. #
      9. # OpenMediaVault is free software: you can redistribute it and/or modify
      10. # it under the terms of the GNU General Public License as published by
      11. # the Free Software Foundation, either version 3 of the License, or
      12. # any later version.
      13. #
      14. # OpenMediaVault is distributed in the hope that it will be useful,
      15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
      16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      17. # GNU General Public License for more details.
      18. #
      19. # You should have received a copy of the GNU General Public License
      20. # along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
      21. set -e
      22. . /etc/default/openmediavault
      23. . /usr/share/openmediavault/scripts/helper-functions
      24. case "$1" in
      25. configure)
      26. # Disable the default Nginx site
      27. NGINX_DEFAULT_ENABLED_CONF=/etc/nginx/sites-enabled/default
      28. if [ -e "${NGINX_DEFAULT_ENABLED_CONF}" ]; then
      29. /bin/rm "${NGINX_DEFAULT_ENABLED_CONF}"
      30. fi
      31. ########################################################################
      32. # Set the default settings to those expected by OpenMediaVault.
      33. ########################################################################
      34. if [ -z "$2" ]; then
      35. ####################################################################
      36. # Install configuration file
      37. ####################################################################
      38. if [ ! -e "${OMV_CONFIG_FILE}" ]; then
      39. echo "Installing default configuration"
      40. cp ${OMV_CONFIG_TEMPLATE_FILE} ${OMV_CONFIG_FILE}
      41. fi
      42. ####################################################################
      43. # Create user 'openmediavault' which is used to run the web
      44. # interface.
      45. ####################################################################
      46. if ! getent passwd openmediavault > /dev/null 2>&1; then
      47. useradd --system --user-group openmediavault || :
      48. fi
      49. ####################################################################
      50. # Create user 'admin' which is used as the web interface
      51. # administrator account. Default password is 'openmediavault'.
      52. ####################################################################
      53. if ! getent passwd admin > /dev/null 2>&1; then
      54. useradd --system --no-user-group --password '$1$PjiW4uIZ$agjyA0foLeAcHClwOuad1.' \
      55. --shell '/usr/sbin/nologin' --comment 'WebGUI administrator' admin || :
      56. fi
      57. ####################################################################
      58. # Update the local plugin packages archive. The 'packages' command
      59. # should be run in the root of the tree.
      60. ####################################################################
      61. echo "Updating local package archive ..."
      62. cd ${OMV_DPKGARCHIVE_DIR} && apt-ftparchive packages . > Packages
      63. ####################################################################
      64. # Setup services
      65. ####################################################################
      66. echo "Updating init scripts actions ..."
      67. invoke-rc.d --force ntp stop
      68. update-rc.d ntp disable &>/dev/null
      69. invoke-rc.d --force smartmontools stop
      70. update-rc.d smartmontools disable &>/dev/null
      71. invoke-rc.d --force tftpd-hpa stop
      72. update-rc.d tftpd-hpa disable &>/dev/null
      73. invoke-rc.d --force rsync stop
      74. update-rc.d rsync disable &>/dev/null
      75. invoke-rc.d --force ssh stop
      76. update-rc.d ssh disable &>/dev/null
      77. invoke-rc.d --force snmpd stop
      78. update-rc.d snmpd disable &>/dev/null
      79. invoke-rc.d --force proftpd stop
      80. update-rc.d proftpd disable &>/dev/null
      81. invoke-rc.d --force nfs-kernel-server stop
      82. update-rc.d nfs-kernel-server disable &>/dev/null
      83. invoke-rc.d --force samba stop
      84. update-rc.d samba disable &>/dev/null
      85. invoke-rc.d --force postfix stop
      86. update-rc.d postfix disable &>/dev/null
      87. update-rc.d openmediavault defaults &>/dev/null
      88. update-rc.d openmediavault-beep defaults &>/dev/null
      89. update-rc.d openmediavault-engined defaults &>/dev/null
      90. ####################################################################
      91. # Setup apache configuration
      92. ####################################################################
      93. # Documentation/Howto:
      94. # http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-debian-lenny
      95. # http://www.christophfischer.com/linux/12-apache/47-apache-server-mit-php-fastcgi-und-debian-50-lenny
      96. # http://wiki.hetzner.de/index.php/Apache_PHP5_fcgi_und_SuExec
      97. ####################################################################
      98. echo "Configuring web server"
      99. omv-mkconf nginx
      100. #a2enmod suexec
      101. #a2enmod fcgid
      102. #a2enmod ssl
      103. #a2enmod rewrite
      104. #a2dissite 000-default
      105. #a2ensite openmediavault-webgui
      106. fi
      107. # Create public/private SSH key pair for user root
      108. if [ ! -f "/root/.ssh/id_rsa.pub" ]; then
      109. ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa
      110. fi
      111. ########################################################################
      112. # Setup permissions
      113. ########################################################################
      114. # Documentation/Howto:
      115. # http://www.christophfischer.com/linux/12-apache/47-apache-server-mit-php-fastcgi-und-debian-50-lenny
      116. ########################################################################
      117. # These permissions are required by Apache
      118. chown -R openmediavault:openmediavault /etc/openmediavault \
      119. /var/cache/openmediavault ${OMV_DOCUMENTROOT_DIR}
      120. chmod 755 /var/www
      121. chmod 600 ${OMV_CONFIG_FILE}
      122. dpkg-trigger update-fixperms || omv_install_fixperms
      123. ########################################################################
      124. # Install locale files.
      125. ########################################################################
      126. dpkg-trigger update-locale || omv_install_locale
      127. ########################################################################
      128. # Generate configurations
      129. ########################################################################
      130. if [ -z "$2" ]; then
      131. omv-mkconf mdadm
      132. omv-mkconf cpufrequtils
      133. omv-mkconf cron-apt
      134. omv-mkconf watchdog
      135. omv-mkconf monit
      136. omv-mkconf rrdcached
      137. fi
      138. omv-mkconf collectd
      139. ########################################################################
      140. # Restart services
      141. ########################################################################
      142. if [ -z "$2" ]; then
      143. echo "Restarting services ..."
      144. invoke-rc.d cron restart
      145. invoke-rc.d watchdog restart
      146. invoke-rc.d rrdcached restart
      147. invoke-rc.d collectd restart
      148. invoke-rc.d nginx reload
      149. invoke-rc.d monit restart
      150. fi
      151. dpkg-trigger restart-engined || monit restart omv-engined
      152. ########################################################################
      153. # Action to be done depending on the previous version.
      154. ########################################################################
      155. echo "Updating configuration ..."
      156. if dpkg --compare-versions "$2" lt-nl "0.5"; then
      157. # Set default envionment variables.
      158. omv_set_default "OMV_CACHE_DIR" "/var/cache/openmediavault"
      159. omv_set_default "OMV_CERTIFICATE_PREFIX" "openmediavault-"
      160. omv_set_default "OMV_CONFIGIMPORT_SCRIPTS_DIR" "/usr/share/openmediavault/configimport"
      161. omv_set_default "OMV_MKCONF_SCRIPTS_DIR" "/usr/share/openmediavault/mkconf"
      162. omv_set_default "OMV_ENGINED_DIR" "/usr/share/openmediavault/engined"
      163. omv_set_default "OMV_ENGINED_SO_ADDRESS" "/var/lib/openmediavault/engined.sock"
      164. omv_set_default "OMV_ENGINED_SO_SNDTIMEO" "10"
      165. omv_set_default "OMV_ENGINED_SO_RCVTIMEO" "180"
      166. omv_set_default "OMV_ENGINED_DIRTY_MODULES_FILE" "/var/lib/openmediavault/dirtymodules.json"
      167. omv_set_default "OMV_INITSYSTEM_SCRIPTS_DIR" "/usr/share/openmediavault/initsystem"
      168. omv_set_default "OMV_APACHE2_SUEXECUSERGROUP" "openmediavault"
      169. # Add avahi configurations.
      170. omv_config_add_element "/config/services" "zeroconf" ""
      171. omv_config_add_element "/config/services/zeroconf" "services" ""
      172. omv_config_add_element "/config/services/zeroconf/services" "service" "<id>webadmin</id><enable>1</enable><name>%h - Web administration</name>" true
      173. omv_config_add_element "/config/services/zeroconf/services" "service" "<id>ssh</id><enable>1</enable><name>%h - SSH</name>" true
      174. omv_config_add_element "/config/services/zeroconf/services" "service" "<id>nfs</id><enable>1</enable><name>%h - NFS</name>" true
      175. omv_config_add_element "/config/services/zeroconf/services" "service" "<id>ftp</id><enable>1</enable><name>%h - FTP</name>" true
      176. omv_config_add_element "/config/services/zeroconf/services" "service" "<id>tftp</id><enable>1</enable><name>%h - TFTP</name>" true
      177. omv_config_add_element "/config/services/zeroconf/services" "service" "<id>smb</id><enable>1</enable><name>%h - SMB/CIFS</name>" true
      178. omv_config_add_element "/config/services/zeroconf/services" "service" "<id>rsync</id><enable>1</enable><name>%h - Rsync</name>" true
      179. omv_config_delete "//dnssd"
      180. # Add notification configurations.
      181. omv_config_add_element "/config/system" "notification" ""
      182. omv_config_add_element "/config/system/notification" "notifications" ""
      183. omv_config_add_element "/config/system/notification/notifications" "monitprocevents" "1"
      184. omv_config_add_element "/config/system/notification/notifications" "monitloadavg" "1"
      185. omv_config_add_element "/config/system/notification/notifications" "monitmemoryusage" "1"
      186. omv_config_add_element "/config/system/notification/notifications" "monitcpuusage" "1"
      187. omv_config_add_element "/config/system/notification/notifications" "monitfilesystems" "1"
      188. omv_config_add_element "/config/system/notification/notifications" "mdadm" "1"
      189. omv_config_add_element "/config/system/notification/notifications" "smartmontools" "1"
      190. # Add new Rsync module option.
      191. omv_config_add_element "/config/services/rsync/server/modules/module" "usechroot" "1"
      192. # Add comment to network interface configurations.
      193. omv_config_add_element "/config/system/network/interfaces/iface" "comment" ""
      194. omv_config_add_element "/config/system/network/interfaces/bondiface" "comment" ""
      195. # Add 'aio' option to SMB/CIFS server. Configuration will be
      196. # reloaded automatically.
      197. omv_config_add_element "/config/services/smb" "aio" "1"
      198. omv-mkconf samba
      199. # Add new S.M.A.R.T. scheduled test option.
      200. omv_config_add_element "/config/services/smart/scheduledtests/job" "enable" "1"
      201. # Remove user 'openmediavault' from sudoers list.
      202. sed -i -e '/^%openmediavault/d' /etc/sudoers
      203. # Recreate certificates.
      204. omv-mkconf certificates
      205. # Start engine.
      206. omv-mkconf monit
      207. invoke-rc.d monit restart
      208. update-rc.d openmediavault-engined defaults &>/dev/null
      209. dpkg-trigger restart-engined || monit restart omv-engined
      210. # Update apache2 configuration.
      211. omv-mkconf nginx
      212. invoke-rc.d nginx reload
      213. fi
      214. if dpkg --compare-versions "$2" lt-nl "0.5.0.21"; then
      215. # Set IPv6 interface configurations.
      216. omv_config_add_element "/config/system/network/interfaces/*[name()='iface' or name()='bondiface']" "method6" "manual"
      217. omv_config_add_element "/config/system/network/interfaces/*[name()='iface' or name()='bondiface']" "address6" ""
      218. omv_config_add_element "/config/system/network/interfaces/*[name()='iface' or name()='bondiface']" "netmask6" "64"
      219. omv_config_add_element "/config/system/network/interfaces/*[name()='iface' or name()='bondiface']" "gateway6" ""
      220. # Modify firewall rules.
      221. omv_config_add_element "/config/system/network/iptables/rule" "family" "inet"
      222. # Modify sysctl settings.
      223. echo 0 > /proc/sys/net/ipv6/conf/all/autoconf
      224. echo 0 > /proc/sys/net/ipv6/conf/default/autoconf
      225. echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra
      226. echo 0 > /proc/sys/net/ipv6/conf/default/accept_ra
      227. echo 0 > /proc/sys/net/ipv6/conf/lo/disable_ipv6
      228. fi
      229. if dpkg --compare-versions "$2" lt-nl "0.5.0.24"; then
      230. omv-mkconf collectd
      231. monit restart collectd
      232. fi
      233. if dpkg --compare-versions "$2" lt-nl "0.5.4"; then
      234. omv-mkconf ntp
      235. fi
      236. if dpkg --compare-versions "$2" lt-nl "0.5.8"; then
      237. omv_config_add_element "/config/system/notification/notifications" "cronapt" "1"
      238. fi
      239. if dpkg --compare-versions "$2" lt-nl "0.5.9"; then
      240. update-rc.d acpid enable
      241. invoke-rc.d acpid start
      242. omv-mkconf monit
      243. invoke-rc.d monit restart
      244. fi
      245. if dpkg --compare-versions "$2" lt-nl "0.5.11"; then
      246. omv-mkconf collectd
      247. fi
      248. if dpkg --compare-versions "$2" lt-nl "0.5.15"; then
      249. omv_config_add_element "/config/services/ftp" "transferlog" "0"
      250. omv-mkconf proftpd
      251. service proftpd reload
      252. fi
      253. if dpkg --compare-versions "$2" lt-nl "0.5.23"; then
      254. omv-mkconf nginx
      255. invoke-rc.d nginx reload
      256. fi
      257. if dpkg --compare-versions "$2" lt-nl "0.5.26"; then
      258. omv_config_add_element "/config/system" "apt" ""
      259. omv_config_add_element "/config/system/apt" "distribution" ""
      260. omv_config_add_element "/config/system/apt/distribution" "proposed" "0"
      261. omv_config_add_element "/config/system/apt/distribution" "partner" "0"
      262. fi
      263. if dpkg --compare-versions "$2" lt-nl "0.5.32"; then
      264. omv-mkconf collectd
      265. monit restart collectd
      266. udevadm control --reload-rules
      267. omv-mkconf sysctl
      268. sysctl -e -p
      269. fi
      270. if dpkg --compare-versions "$2" lt-nl "0.5.37"; then
      271. omv-mkconf nginx
      272. a2enmod rewrite || true
      273. invoke-rc.d nginx reload
      274. fi
      275. if dpkg --compare-versions "$2" lt-nl "0.5.39"; then
      276. omv_config_add_element "/config/services/smart" "monitor" ""
      277. xmlstarlet sel -t -m "/config/system/storage/hdparm" \
      278. -v "uuid" \
      279. -i "position() != last()" -n -b \
      280. ${OMV_CONFIG_FILE} | xmlstarlet unesc |
      281. while read uuid; do
      282. devicefile=$(omv_config_get "/config/system/storage/hdparm[uuid='${uuid}']/devicefile")
      283. enable=$(omv_config_get "/config/system/storage/hdparm[uuid='${uuid}']/smart/enable")
      284. object="<uuid>$(omv_uuid)</uuid>"
      285. object="${object}<devicefile>${devicefile}</devicefile>"
      286. object="${object}<enable>${enable}</enable>"
      287. object="${object}<type></type>"
      288. omv_config_add_element "/config/services/smart/monitor" "device" "${object}" true
      289. omv_config_delete "/config/system/storage/hdparm[uuid='${uuid}']/smart"
      290. done
      291. fi
      292. if dpkg --compare-versions "$2" lt-nl "0.5.41"; then
      293. omv-mkconf cron-apt
      294. fi
      295. if dpkg --compare-versions "$2" lt-nl "0.5.45"; then
      296. omv-mkconf rsyncd
      297. fi
      298. if dpkg --compare-versions "$2" lt-nl "0.6"; then
      299. # Relocate RRD database files.
      300. cp -r /var/lib/collectd/rrd/localhost /var/lib/rrdcached/db
      301. # Convert database.
      302. xmlstarlet sel -t -m "/config/system/fstab/mntent[contains(dir,'/home/ftp')]" \
      303. -v "uuid" \
      304. -i "position() != last()" -n -b \
      305. ${OMV_CONFIG_FILE} | xmlstarlet unesc |
      306. while read uuid; do
      307. dir=$(omv_config_get "/config/system/fstab/mntent[uuid='${uuid}']/dir" | sed -e 's#^/home/ftp#/srv/ftp#i')
      308. omv_config_update "/config/system/fstab/mntent[uuid='${uuid}']/dir" "${dir}"
      309. mkdir -p "${dir}"
      310. done
      311. # Add SMB/CIFS share option.
      312. omv_config_add_element "/config/services/smb/shares/share" "audit" "0"
      313. # Rebuild configuration files.
      314. omv-mkconf collectd
      315. omv-mkconf rrdcached
      316. omv-mkconf monit
      317. omv-mkconf proftpd
      318. omv-mkconf fstab
      319. omv-mkconf samba
      320. # Restart services.
      321. monit restart rrdcached
      322. monit restart collectd
      323. fi
      324. if dpkg --compare-versions "$2" lt-nl "0.6.0.3"; then
      325. # Disable proftpd memcache module, support is not enabled in
      326. # the Debian Wheezy package.
      327. sed -i -e "s/^\(LoadModule mod_tls_memcache.c\)/#\1/i" /etc/proftpd/modules.conf
      328. fi
      329. if dpkg --compare-versions "$2" lt-nl "0.6.0.4"; then
      330. # Rebuild monit service configuration files.
      331. omv-mkconf monit
      332. invoke-rc.d monit reload
      333. # Unlink configuration backup file.
      334. rm -f "${OMV_CONFIG_FILE}.bak"
      335. fi
      336. ;;
      337. triggered)
      338. ########################################################################
      339. # Execute triggers
      340. ########################################################################
      341. for trigger in $2; do
      342. case "${trigger}" in
      343. update-locale)
      344. echo "Updating locale files ..."
      345. omv_install_locale
      346. ;;
      347. update-fixperms)
      348. echo "Updating file permissions ..."
      349. omv_install_fixperms
      350. ;;
      351. restart-engined)
      352. echo "Restarting engine daemon ..."
      353. monit restart omv-engined || invoke-rc.d openmediavault-engined restart
      354. esac
      355. done
      356. ;;
      357. abort-upgrade|abort-remove|abort-deconfigure)
      358. ;;
      359. *)
      360. echo "postinst called with unknown argument '$1'" >&2
      361. exit 1
      362. ;;
      363. esac
      364. exit 0
      Display All
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      I will do some testswith Apache and Nginx on my old test system and a CuBox. After that i will decide which webserver OMV will use in the next version.
      I think i will start with nginx-light which should include all necessary modules like FastCGI, Rewrite or IPv6.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • Re: OMV with Nginx instead of Apache

      I can confirm that nginx is noticeably faster on a cubieboard using the regular nginx package. I will have to try nginx-light.
      omv 4.1.8.2 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.8
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please read this before posting a question.
      Please don't PM for support... Too many PMs!
    • Re: OMV with Nginx instead of Apache

      Sounds encouraging. The loading of some of the more intense interfaces could benefit from being less laggy on my system (HP54NL), i.e. OMV interface, rutorrent and owncloud (although Im aware owncloud may be other issues). Nginx seems to be flavour of the month at the moment, I assume due to its popularity on Raspberry Pi’s . . . It would seem that Nginx is more suited to the OMV application, if its faster as well Im interested in this.