-
-
Save MarkVilludo/aabafb41f589d17ca568c95bc4b2960e to your computer and use it in GitHub Desktop.
php72
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
#!/usr/bin/env bash | |
# curl -LO https://gist.githubusercontent.com/mannysoft/e4b54662b3aec5c0b1b88be52177ab68/raw/04dba433394c7a03d891f94c75b52975d2e7a621/install.sh | |
# chmod +x install.sh | |
# ./install.sh | |
# ppk to pem: | |
# puttygen key.ppk -O private-openssh -o key.pem | |
echo "--- Welcome User. This is very exciting. ---" | |
echo "--- Updating packages list ---" | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
echo "--- Installing text editor NANO ---" | |
sudo apt-get install -y nano | |
echo "--- Installing git ---" | |
sudo apt-get install -y git-core | |
echo "--- Installing MySQL ---" | |
sudo apt-get update | |
sudo apt-get install -y mysql-server | |
echo "--- Installing PHP-specific packages and Curl ---" | |
sudo apt-get -y install nginx php7.2 php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-mysql php7.2-fpm php7.2-ldap php7.2-tidy php7.2-mbstring php7.2-xml php7.2-curl php7.2-zip php7.2-gd | |
echo "--- Applying modifications to php7.2-fpm ---" | |
sudo sed -i '/cgi.fix_pathinfo=1/c cgi.fix_pathinfo=0' /etc/php/7.2/cli/php.ini | |
sudo sed -i '/max_execution_time = 30/c max_execution_time = 300' /etc/php/7.2/cli/php.ini | |
sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/7.2/cli/php.ini | |
echo "--- Check if no error in nginx ----" | |
sudo nginx -t | |
echo "--- Restart PHP-FPM if everything is ok ---" | |
sudo systemctl restart php7.2-fpm.service | |
echo "--- Enable Nginx and PHP-FPM on system boot ---" | |
sudo systemctl enable nginx.service | |
sudo systemctl enable php7.2-fpm.service | |
# Create folder | |
sudo mkdir -p /var/www/app | |
sudo mkdir -p /var/www/app/public | |
echo "--- Configuring default Nginx site to support Laravel ---" | |
cat << 'EOF' | sudo tee /etc/nginx/sites-available/default | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /var/www/app/public; | |
index index.php index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name localhost; | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
try_files $uri $uri/ /index.php?$query_string; | |
# Uncomment to enable naxsi on this location | |
# include /etc/nginx/naxsi.rules | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
EOF | |
echo "--- Restarting php7.2-fpm and Nginx ---" | |
sudo /etc/init.d/nginx restart | |
sudo /etc/init.d/php7.2-fpm restart | |
# Create Swap File (Optional) | |
# sudo fallocate -l 1G /swapfile | |
# sudo mkswap /swapfile | |
# sudo swapon /swapfile | |
echo "--- Fetching and installing Composer ---" | |
sudo curl -sS https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/bin/composer | |
# echo "--- Installing node.js ---" | |
sudo apt-get install -y nodejs | |
sudo apt-get install -y npm | |
#laravel-echo-server start | |
#nodejs-legacy | |
sudo chown -R :www-data /var/www/app | |
# sudo chmod -R 775 /var/www/app/storage | |
echo "--- Restarting php7.1-fpm and Nginx ---" | |
sudo /etc/init.d/nginx restart | |
sudo /etc/init.d/php7.2-fpm restart | |
#phpmyadmin | |
#sudo apt-get install phpmyadmin | |
# sudo ln -s /usr/share/phpmyadmin /var/www/app/public | |
echo "Rebooting server..." | |
sudo reboot | |
# Install SSL Certificate | |
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment