Lonely Dreamer (sanmai) wrote,
Lonely Dreamer
sanmai

addwwwuser, fixpriv, ngensite

# cat /usr/local/bin/addwwwuser
#!/bin/sh
: ${1?"Usage: $0 example.com"}

host=$1;

useradd -G crontab -m $host
mkdir -p /home/$host/www/htdocs /home/$host/www/logs
chown -R $host:$host /home/$host/ 
setfacl -m user:www-data:--x /home/$host /home/$host/www
setfacl -R -m d:u:www-data:rX /home/$host/www/htdocs
# cat /usr/local/bin/fixpriv
#!/bin/sh
: ${1?"Usage: $0 example.com"}

host=$1;

mkdir -p /home/$host/www/htdocs /home/$host/www/logs
chown -R $host:$host /home/$host/ 
chmod 700 /home/$host/
setfacl -m user:www-data:--x /home/$host /home/$host/www
setfacl -R -m d:u:www-data:rX /home/$host/www/htdocs
# cat /usr/local/bin/ngensite
#!/bin/sh
: ${1?"Usage: $0 sites-available/example.com"}

cd /etc/nginx/sites-enabled
site="../$1";

if [ ! -f "$site" ]; 
then echo File "$site" does not exists; exit 1; fi

ln -vs "$site"

Рекомендую к ознакомлению:

Tags: apache2, linux, nginx, useful
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments