Last active
September 1, 2026 22:48
-
-
Save AnythingLinux/8ae75f155b70638da0ba5b23b1c62424 to your computer and use it in GitHub Desktop.
Install Apache web server on an Ubuntu 24.04 LTS Server
This file contains hidden or 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
| apt update | |
| apt upgrade | |
| apt install git | |
| git config --global user.name "masum" | |
| git config --global user.email "linuxguns@gmail.com" | |
| ssh-keygen -t rsa -b 4096 -C "linuxguns@gmail.com" | |
| eval "$(ssh-agent -s)" | |
| ssh-add ~/.ssh/id_rsa | |
| cat /root/.ssh/id_rsa.pub | |
| apt install apache2 | |
| ufw allow in "Apache Full" | |
| apache2 -v | |
| nano /etc/apache2/apache2.conf | |
| # Add ServerName 127.0.1.1 into the middle of this file | |
| ServerName 127.0.1.1 | |
| # Find this line by ctrl+w /var/www/ and update AllowOverride All | |
| <Directory /var/www/> | |
| Options Indexes FollowSymLinks | |
| AllowOverride All | |
| Require all granted | |
| </Directory> | |
| # Save and exit ctrl+s and ctrl+x | |
| service apache2 start | |
| systemctl enable apache2 | |
| service apache2 restart | |
| service apache2 reload | |
| service apache2 status | |
| apachectl configtest | |
| nano /etc/apache2/sites-available/000-default.conf | |
| <VirtualHost *:80> | |
| ServerName sof.secure-transaction.co | |
| ServerAdmin webmaster@localhost | |
| DocumentRoot /var/www/html | |
| ErrorLog ${APACHE_LOG_DIR}/new-schooloffreelancing-error.log | |
| CustomLog ${APACHE_LOG_DIR}/new-schooloffreelancing-access.log combined | |
| </VirtualHost> | |
| snap install --classic certbot | |
| ln -s /snap/bin/certbot /usr/local/bin/certbot | |
| certbot --apache | |
| certbot renew --dry-run | |
| service apache2 restart | |
| service apache2 reload | |
| # Troubleshoot | |
| Fix Internal Server Error The server encountered an internal error: | |
| a2enmod rewrite | |
| systemctl restart apache2 | |
| chown -R www-data:www-data /var/www/html | |
| # Error Log | |
| tail -f /var/log/apache2/error.log |
AnythingLinux
commented
Aug 20, 2026
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment