installer/unix-like/create_texts.rb in rhoconnect-3.4.3 vs installer/unix-like/create_texts.rb in rhoconnect-3.4.4
- old
+ new
@@ -237,10 +237,19 @@
#
# Nginx stuff ...
def create_nginx_init
nginx_init_script = <<'_NGINX_INIT_SCRIPT_'
#!/bin/sh
+### BEGIN INIT INFO
+# Provides: nginx
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: S 0 1 6
+# Short-Description: nginx initscript
+# Description: nginx
+### END INIT INFO
# Author: Ryan Norbauer http://norbauerinc.com
# Modified: Geoffrey Grosenbach http://topfunky.com
# Modified: Clement NEDELCU
# Modified: Alexander Babichev
# Reproduced with express authorization from its contributors
@@ -361,19 +370,29 @@
include /opt/nginx/conf/conf.d/*.conf;
}
_NGINX_CONF_
- # create 'nginx' user if it does not exist
- user_nginx = `cat /etc/passwd | cut -d: -f1 | grep nginx`
- if user_nginx.empty?
+ # Creating 'nginx' group if it isn't already there
+ `getent group nginx > /dev/null`
+ if $? != 0
+ puts "Creating 'nginx' group ..."
+ if @dist == 'debian'
+ `addgroup --system nginx > /dev/null`
+ else
+ `/usr/sbin/groupadd -r nginx > /dev/null`
+ end
+ end
+ # Creating 'nginx' user if it isn't already there
+ `getent passwd nginx >/dev/null`
+ if $? != 0
puts "Creating 'nginx' user ..."
if @dist == 'debian'
`adduser --system --home /opt/nginx/html --no-create-home --disabled-login --disabled-password --group nginx`
else
- `/usr/sbin/useradd -M -r -s /sbin/nologin -d /opt/nginx/html nginx`
- end
+ `/usr/sbin/useradd -M -r -s /sbin/nologin -d /opt/nginx/html -g nginx nginx`
+ end
end
FileUtils.mv("/opt/nginx/conf/nginx.conf", "/opt/nginx/conf/nginx.conf.bak") unless File.exist? "/opt/nginx/conf/nginx.conf.bak"
File.open('/opt/nginx/conf/nginx.conf', 'w' ) { |f| f << nginx_server_conf }
@@ -537,19 +556,19 @@
root /opt/nginx/html/your_rhoconnect_app/public; # Be sure your app have 'public' folder and root directive
# point to it!
# ...
}
- e) Edit Thin `/etc/thin/rhoapp.yml` configuration file directly
+ e) Edit thin `/etc/thin/rhoapp.yml` configuration file directly
---
chdir: /opt/nginx/html/your_rhoconnect_app
# ...
or as root user generate a new one
- $ env PATH=/opt/rhoconnect/bin:$PATH thin config -C /etc/thin/your_rhoconnect_app.yml \
- -c /opt/nginx/html/your_rhoconnect_app/ \
- --socket /tmp/thin.sock --servers 2 \
- --user nginx --group nginx \
+ $ env PATH=/opt/rhoconnect/bin:$PATH thin config -C /etc/thin/your_rhoconnect_app.yml
+ -c /opt/nginx/html/your_rhoconnect_app/
+ --socket /tmp/thin.sock --servers 2
+ --user nginx --group nginx
--log /var/log/thin/thin.log --pid /var/run/thin/thin.pid -e production`
f) As root user restart Nginx, and Thin servers
/etc/init.d/nginx restart
/etc/init.d/thin restart