Last active
January 1, 2016 21:49
-
-
Save kappuccino/8206271 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| cd /tmp | |
| host=$(hostname) | |
| echo "Kappuccino web server install: $host"; | |
| # REPO ######################################################################### | |
| echo "deb http://packages.dotdeb.org wheezy all" > /etc/apt/sources.list.d/dotdeb.list | |
| echo "deb-src http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list.d/dotdeb.list | |
| wget http://www.dotdeb.org/dotdeb.gpg; apt-key add dotdeb.gpg; rm -rf dotdeb.gpg | |
| apt-get update | |
| # SYSTEM ####################################################################### | |
| apt-get -y install git locales | |
| sed -i.sos 's/# export LS_OPTIONS/export LS_OPTIONS/g' /root/.bashrc | |
| sed -i.sos 's/# eval "`dircolors`/eval "`dircolors`/g' /root/.bashrc | |
| sed -i.sos 's/# alias/alias/g' /root/.bashrc | |
| source /root/.bashrc | |
| echo "Europe/Paris" > /etc/timezone | |
| dpkg-reconfigure -f noninteractive tzdata | |
| # NGINX ######################################################################## | |
| apt-get -y install nginx-full | |
| echo "fastcgi_param REDIRECT_URL \$request_uri;" >> /etc/nginx/fastcgi_params | |
| cat > /etc/nginx/sites-available/default <<CMD | |
| server { | |
| listen 80 default_server; | |
| root /home/web/www; | |
| index index.php index.html index.htm; | |
| server_name localhost; | |
| access_log /var/log/nginx/default.acc.log; | |
| error_log /var/log/nginx/default.err.err; | |
| location / { | |
| try_files \$uri \$uri/ =404; | |
| } | |
| location ~ \.php\$ { | |
| try_files \$uri =404; | |
| fastcgi_split_path_info ^(.+\.php)(/.+)\$; | |
| include /etc/nginx/fastcgi_params; | |
| fastcgi_pass unix:/var/run/php5-fpm.sock; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; | |
| } | |
| location ~ /\.ht { | |
| deny all; | |
| } | |
| } | |
| CMD | |
| cat > /etc/nginx/conf.d/fastcgi.conf <<CMD | |
| fastcgi_buffers 8 16k; | |
| fastcgi_buffer_size 32k; | |
| CMD | |
| cat > /etc/nginx/conf.d/server.conf <<CMD | |
| client_max_body_size 110m; | |
| CMD | |
| sed -i.sos 's/keepalive_timeout 65/keepalive_timeout 60 15/g' /etc/nginx/nginx.conf | |
| sed -i.sos 's/worker_processes 4/worker_processes 2/g' /etc/nginx/nginx.conf | |
| sed -i.sos 's/# gzip_proxied/gzip_proxied/g' /etc/nginx/nginx.conf | |
| sed -i.sos 's/# gzip_buffers/gzip_buffers/g' /etc/nginx/nginx.conf | |
| sed -i.sos 's/# gzip_comp_level/gzip_comp_level/g' /etc/nginx/nginx.conf | |
| sed -i.sos 's/# gzip_types/gzip_types/g' /etc/nginx/nginx.conf | |
| mkdir -p /home/web/www | |
| echo "<?php phpinfo() ?>" >> /home/web/www/index.php | |
| # MYSQL ######################################################################## | |
| apt-get -y install mysql-server | |
| # PHP ########################################################################## | |
| apt-get -y install php5-fpm php5-cli php5-gd php5-mcrypt php5-apc php5-curl php5-imagick php5-memcache php5-mysql | |
| # PHP | |
| echo '' >>/etc/php5/fpm/php.ini | |
| echo 'cgi.fix_pathinfo = 0' >> /etc/php5/fpm/php.ini | |
| echo 'output_buffering = off' >> /etc/php5/fpm/php.ini | |
| echo 'display_errors = On' >> /etc/php5/fpm/php.ini | |
| echo 'post_max_size = 100M' >> /etc/php5/fpm/php.ini | |
| echo 'upload_max_filesize = 100M' >> /etc/php5/fpm/php.ini | |
| echo 'date.timezone = "Europe/Paris"' >> /etc/php5/fpm/php.ini | |
| echo 'display_errors = On' >> /etc/php5/fpm/php.ini | |
| # CLI | |
| echo 'date.timezone = "Europe/Paris"' >> /etc/php5/cli/php.ini | |
| # APC | |
| echo "apc.shm_size=128M" >> /etc/php5/fpm/conf.d/20-apc.ini | |
| echo "apc.stat=1" >> /etc/php5/fpm/conf.d/20-apc.ini | |
| echo "apc.enabled=1" >> /etc/php5/fpm/conf.d/20-apc.ini | |
| ################################################################################ | |
| # START | |
| /etc/init.d/nginx start | |
| /etc/init.d/mysql restart | |
| /etc/init.d/php5-fpm restart | |
| echo ""; | |
| echo ""; | |
| echo ""; | |
| echo ""; | |
| echo "Vous pouvez voir que tout est OK ici: http://$host/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment