Last active
June 26, 2017 10:53
-
-
Save dragoljub-bogicevic-devtech/0245b57e2611d2595ddd2da4d779bc1c to your computer and use it in GitHub Desktop.
Set up nginx as web server with php-fpm enabled
This file contains 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 | |
echo "Starting Provision: web server $1" | |
sudo apt-get update | |
sudo apt-get install -y nginx | |
sudo service nginx stop | |
sudo apt-get install -y php5-fpm | |
sudo rm -rf /etc/php5/fpm/php.ini | |
phpini=$(wget https://gist.githubusercontent.com/dragoljub-bogicevic-devtech/1736bcae08038a6333d2bcd51b73517e/raw/e0cd0448f31d39db333c72183896466fc6493e66/php.ini -q -O -) | |
sudo touch /etc/php5/fpm/php.ini | |
echo "$phpini" >> /etc/php5/fpm/php.ini | |
sudo service php5-fpm restart | |
sudo mkdir -p /var/www/html | |
sudo touch /var/www/html/index.php | |
echo "<?php echo 'poy'; ?>" >> /var/www/html/index.php | |
sudo rm -rf /etc/nginx/sites-available/default | |
sudo rm -rf /etc/nginx/sites-enabled/default | |
sudo touch /etc/nginx/sites-enabled/default | |
echo "server { | |
listen 80 default_server; | |
root /var/www/html; | |
index index.php; | |
server_name $2 www. $2; | |
location / { | |
#try_files $uri $uri/ =404; | |
} | |
location ~ \.php$ { | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; | |
} | |
}" >> /etc/nginx/sites-enabled/default | |
sudo service nginx start | |
echo "Machine: web server $1" >> /var/www/html/index.html | |
echo "*************** Provision web $1 complete ***************" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment