Last active
August 8, 2020 02:01
-
-
Save hussnainsheikh/6e7d678a1367e7614bdd1d43dc94a666 to your computer and use it in GitHub Desktop.
Install lamp-stack on Ubuntu with virtual host and SSL with certbot on apache. If you are facing any issue while installing ask me. Thank you!
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
#install lamp-stack by tasksel | |
sudo apt update && sudo apt upgrade | |
sudo apt install tasksel | |
sudo tasksel install lamp-server | |
#install phpmyadmin | |
sudo apt-get install -y phpmyadmin | |
#create db_user and grant access | |
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' IDENTIFIED BY 'password'; | |
#install composer | |
sudo apt install curl php-cli php-mbstring git unzip | |
cd ~ | |
curl -sS https://getcomposer.org/installer -o composer-setup.php | |
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer | |
#setup virtual host for the domain | |
sudo nano /etc/apache2/sites-available/yourdomain.com.conf | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName yourdomain.com | |
ServerAlias yourdomain.com | |
DocumentRoot /var/www/html | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> | |
<Directory /var/www/html> | |
AllowOverride All | |
Require all granted | |
</Directory> | |
sudo a2ensite yourdomain.com.conf | |
#enable .htaccess on apache | |
<Directory /var/www/html> | |
AllowOverride All | |
Require all granted | |
</Directory> | |
sudo a2enmod rewrite | |
#setup ssl for the domain | |
#install certbot | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt install python-certbot-apache | |
#generate ssl | |
sudo certbot --apache -d yourdomain.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment