Cześć.
Krótka piłka: jak utworzyć subdomenę z poziomu PHP?
Na góglach szukałem, ale zbyt wiele nie znalazłem. Najlepiej bym prosił o jakiś konkretny przykład bądź funkcję.
#!/bin/sh if [ `whoami` = "root" ] then echo "127.0.0.1 $2" >> /etc/hosts; echo "server { listen 80; root /home/mat-bi/public_html/$1; index index.html index.htm index.php; server_name $2; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; }}" >> /etc/nginx/sites-available/default; /home/mat-bi/up.sh restart; else echo "Nie masz uprawnień!" fi
#!/bin/sh if [ "$(whoami)" = "root" ] then if [ -n "$1" ] then akcja="$1" else echo "Wybierz akcję:" read akcja fi if [ "$akcja" = "start" ] then /etc/init.d/nginx start /etc/init.d/postgresql start elif [ "$akcja" = "install" ] then apt-get install nginx php5 postgresql elif [ "$akcja" = "stop" ] then /etc/init.d/nginx stop /etc/init.d/postgresql stop elif [ "$akcja" = "restart" ] then /etc/init.d/nginx restart /etc/init.d/postgresql restart else echo "Złe polecenie. Możliwe polecenia: start - włącza usługi stop - wyłącza usługi restart - restartuje usługi install - instaluje usługi " fi else echo "Nie masz uprawnień. Uruchom skrypt z prawami roota" fi
sudo ./skrypt.sh nazwavhosta foldervhosta