Skip to content

Instantly share code, notes, and snippets.

@Grafikart Grafikart/startup.sh
Last active Apr 3, 2017

Embed
What would you like to do?
Basic Server
#!/bin/bash
###
# Ce fichier sert à construire un serveur de test (pour les tutoriels) rapidement
# NE PAS UTILISER EN PROD !
###
# Variables
export DEBIAN_FRONTEND=noninteractive
# Installation des outils
packages=(
nginx
php
php-fpm
php-mysql
mysql-server
mysql-client
php7.0-mcrypt
php7.0-curl
python
vim
zsh
)
apt-get update
apt-get install -y -q ${packages[@]}
# Mysql password
mysqladmin -u root root
# Configuration de vim / ZSH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/liuchengxu/space-vim/master/install.sh)"
# Configuration nginx php
cat > /etc/nginx/sites-available/default <<"EOF"
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
EOF
# Configuration nginx php
sed -i 's/display_errors = Off/display_errors = On/' /etc/php/7.0/fpm/php.ini
cat > /var/www/html/index.php <<"EOF"
<?php
usleep(100000);
echo 'Hello';
EOF
# On recharge les service
service nginx reload
service php7.0-fpm restart
# Zsh par défaut
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
chsh -s /bin/zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.