Fork Copy printf "Domain name: " read DOMAIN ROOT="$HOME/www/$DOMAIN" printf "root ($ROOT):" read NEWROOT if [ "$NEWROOT" != "" ]; then ROOT="$NEWROOT" fi mkdir -p "$ROOT" cd "/etc/nginx/sites-enabled/" && CONTENT="server { listen 80; root $ROOT; # Add index.php to the list if you are using PHP index index.html index.htm index.php index.nginx-debian.html; server_name $DOMAIN; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files \$uri \$uri/ /index.php?\$args; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php\$ { include snippets/fastcgi-php.conf; # # # With php7.0-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # With php7.0-fpm: fastcgi_pass unix:/run/php/php7.1-fpm.sock; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } " && printf "$CONTENT" >> "$DOMAIN" echo "127.0.0.1 $DOMAIN" >> /etc/hosts nginx -t service nginx restart echo "$DOMAIN created successfully" >> "$ROOT/index.html" chown -R www-data:www-data "$ROOT" chmod 775 -R "$ROOT"