#!/bin/bash # This file for openresty template # Give only one argument with new user name # This replace name of home directory and rename /var/www/yoursite to new username # Also it change root path in nginx config NEW_USER=$1 usermod --login ${NEW_USER} --move-home --home="/home/${NEW_USER}" yoursite mv /var/www/yoursite /var/www/${NEW_USER} groupmod -n ${NEW_USER} yoursite sed -i "s/yoursite/${NEW_USER}/" /opt/openresty/nginx/conf/conf.d/default.conf systemctl reload openresty