Merge branch 'vagrant' of Disroot/Website into master

This commit is contained in:
antilopa 2019-12-29 10:42:41 +00:00 committed by Gitea
commit b458d63a93
3 changed files with 18 additions and 10 deletions

View File

@ -1,4 +1,4 @@
## This Vagrant setup is still Work in Progress and not ready to use as is.
## This Vagrant setup is still Work in Progress, though it can be used as is.
# Disroot Website Development Environment using Vagrant

View File

@ -7,21 +7,26 @@ WWW_USER="www-data"
# Provisioning actions
# Add sury repository to sources.list for PHP7.1
# Add sury repository to sources.list for PHP7.4
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install ca-certificates apt-transport-https
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee -a /etc/apt/sources.list.d/php.list
# Sury Key for PHP7.1
# Sury Key for PHP7.4
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo apt-get -y update
echo "Installing nginx.."
sudo apt-get install -y nginx-full composer
echo "Installing php7.."
sudo apt-get install -y php7.3-zip php7.3-cli php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml php7.3-fpm
echo "Installing nginx..."
sudo apt-get install -y nginx-full
# Create the Apache config files and restart webserver
echo "Installing composer..."
sudo apt-get install -y composer
echo "Installing php7..."
sudo apt-get install -y php7.4-zip php7.4-cli php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-fpm
# Create the Nginx config files and restart webserver
sudo rsync -cr /vagrant/provision/etc/nginx/sites-available /etc/nginx/
sudo ln -s /etc/nginx/sites-available/"${WEB_NAME}".conf /etc/nginx/sites-enabled/"${WEB_NAME}".conf
sudo rm /etc/nginx/sites-enabled/default
@ -29,7 +34,7 @@ sudo service nginx restart
# Install GRAV in webroot
sudo chown -R ${WWW_USER}:${WWW_USER} /var/www
sudo wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer
sudo wget https://getcomposer.org/download/1.9.1/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer
echo "Git"
git clone -b master https://github.com/getgrav/grav.git "${WEB_ROOT}""${WEB_NAME}"
sudo chown -R ${WWW_USER}:${WWW_USER} "${WEB_ROOT}"
@ -59,6 +64,9 @@ sudo -u "${WWW_USER}" sed -i '4d' "${WEB_ROOT}""${WEB_NAME}"/user/config/system.
sudo -u "${WWW_USER}" ex -s -c "4i| alias: '/home'" -c x "${WEB_ROOT}""${WEB_NAME}"/user/config/system.yaml
sudo -u "${WWW_USER}" -i 's/false/true/g' "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector/language-selector.yaml
# Add Grav config (the second extra false should be set to true, but it creates an error in Grav ("Trying to access array offset on value of type null")
sed -i "s/extra:\ false/\extra:\ false\n\ auto_line_breaks:\ true\n\ auto_url_links:\ true\n\ escape_markup:\ false\n\ special_chars:\n\ \'\>\':\ \'gt\'\n\ \'\<\':\ \'lt\'/" "${WEB_ROOT}""${WEB_NAME}"/user/config/system.yaml
# Add website domain to local /etc/hosts file
sudo sed -i "s/127.0.0.1\tlocalhost/127.0.0.1\tlocalhost $WEB_NAME/" /etc/hosts

View File

@ -29,7 +29,7 @@ server {
location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;