User Tools

Site Tools


create_site

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
create_site [2014/04/17 18:27]
kyxap
create_site [2015/09/24 18:46]
kyxap
Line 1: Line 1:
-{{tag>​debian squeeze ubuntu bash vhost user logrotate}}====== Добавление вхоста в apache+nginx ======+{{tag>​debian squeeze ubuntu bash vhost user logrotate ​apache nginx}}====== Добавление вхоста в apache+nginx ======
  
 FIXME FIXME
Line 52: Line 52:
     TMPCONFDIR="/​opt/​scripts/​www_configs"​     TMPCONFDIR="/​opt/​scripts/​www_configs"​
  
- # can be set manual ​IP='​111.111.111.111'​ +    ​# can be set as IP='​111.111.111.111'​ 
- IP=`ip route get 8.8.8.8 | head -1 | awk '​{print $NF}'`+    IP=`ip route get 8.8.8.8 | head -1 | awk '​{print $NF}'`
  
     if [[ ! -d $TMPCONFDIR ]]; then     if [[ ! -d $TMPCONFDIR ]]; then
Line 66: Line 66:
     if [[ ! -d $DOCROOT ]]; then     if [[ ! -d $DOCROOT ]]; then
         mkdir -p $DOCROOT         mkdir -p $DOCROOT
 +        chown -R $user:$user $DOCROOT
     fi     fi
  
Line 191: Line 192:
 function enable_apache_vhost function enable_apache_vhost
 { {
-    if [[ -f "/​etc/​apache2/​sites-available/​$domain"​ ]]; then +    if [[ -f "/​etc/​apache2/​sites-available/​${domain}.conf" ]]; then 
-        echo "​Domain $domain already exists in /​etc/​apache2/​sites-available/​$domain"​+        echo "​Domain $domain already exists in /​etc/​apache2/​sites-available/​${domain}.conf"
         exit 1         exit 1
     else     else
-        cp $TMPCONFDIR/​apache.$domain /​etc/​apache2/​sites-available/​$domain+        cp $TMPCONFDIR/​apache.$domain /​etc/​apache2/​sites-available/​${domain}.conf
         a2ensite $domain         a2ensite $domain
         if [[ -z `apache2ctl configtest` ]]; then         if [[ -z `apache2ctl configtest` ]]; then
create_site.txt · Last modified: 2015/09/24 18:46 by kyxap