linux: fix nginx installation on debian

On Debian jessie, nginx actually can be installed from the default
repository, the version is older though. We just need to make sure that
apache service is not running before the installation. Once the port
nginx tries to use occupied, it causes installation failure.

Change-Id: Ic21d033d1f951836950d9d27312a77c4f355afef
Signed-off-by: Chase Qi <chase.qi@linaro.org>
diff --git a/automated/linux/nginx-apache-bench/apache-bench.sh b/automated/linux/nginx-apache-bench/apache-bench.sh
index 3bdccfc..2300a01 100755
--- a/automated/linux/nginx-apache-bench/apache-bench.sh
+++ b/automated/linux/nginx-apache-bench/apache-bench.sh
@@ -32,12 +32,12 @@
 # shellcheck disable=SC2154
 case "${dist}" in
     debian)
-        pkgs="nginx apache2-utils"
-        install_deps "${pkgs}" "${SKIP_INSTALL}"
-
         # Stop apache server in case it is installed and running.
         systemctl stop apache2 > /dev/null 2>&1 || true
 
+        pkgs="nginx apache2-utils"
+        install_deps "${pkgs}" "${SKIP_INSTALL}"
+
         systemctl restart nginx
         ;;
     centos)