Last active
April 27, 2023 16:23
-
-
Save vaibhavpandeyvpz/2418b9456df64724ede3510faa82ba7e to your computer and use it in GitHub Desktop.
Install and setup LAMP stack + Composer on a clean Ubuntu 16.04 VPS
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 | |
APACHE_USER=wwwhost | |
VHOSTS_DOMAINS=(example.com second.example.com) | |
sudo ufw allow in "OpenSSH" | |
# Install Apache | |
sudo apt-get update | |
sudo apt-get install apache2 | |
sudo nano /etc/apache2/apache2.conf # Add ServerName ... directive at bottom | |
sudo apache2ctl configtest | |
sudo systemctl restart apache2 | |
sudo ufw allow in "Apache Full" | |
# Install MySQL | |
sudo apt-get install mysql-server | |
sudo mysql_secure_installation | |
# Install PHP | |
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql | |
sudo nano /etc/apache2/mods-enabled/dir.conf # Move index.php to start | |
sudo systemctl restart apache2 | |
# Install Composer | |
sudo apt-get install curl php-cli git | |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer | |
# Secure Apache | |
sudo adduser $APACHE_USER | |
sudo nano /etc/apache2/envvars # Update APACHE_RUN_USER & APACHE_RUN_GROUP to '$APACHE_USER' | |
# Create VirtualHosts | |
for $DOMAIN in "${VHOSTS_DOMAINS[@]}" | |
do | |
sudo mkdir -p /var/www/$DOMAIN/public_html | |
sudo chown -R $APACHE_USER:$APACHE_USER /var/www/$DOMAIN | |
then | |
sudo chmod -R 755 /var/www | |
for $DOMAIN in "${VHOSTS_DOMAINS[@]}" | |
do | |
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/$DOMAIN.conf | |
# Edit & enable vhost after copying | |
# sudo nano /etc/apache2/sites-available/$DOMAIN.conf | |
# sudo a2ensite $DOMAIN.conf | |
then | |
sudo a2enmod rewrite | |
sudo systemctl restart apache2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello
i tried this on my armbian.
The problem:
how can i load the vendor/autoload file for the composer??
require_once(DIR . '/vendor/autoload.php');
not work
file not found...