Last active
July 9, 2023 17:00
-
-
Save zoliky/2ec4d9401ebede67c6159f5b2ae5cb00 to your computer and use it in GitHub Desktop.
Installing Apache and PHP on Debian 12
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
Installation | |
------------ | |
$ sudo apt install apache2 php php-mysql php-pgsql php-gd | |
Configure the firewall: | |
$ sudo ufw app list | |
$ sudo ufw allow 'WWW Full' | |
$ sudo ufw enable | |
Enable Apache Userdir: | |
$ cd | |
$ mkdir public_html | |
$ chmod 711 /home/zoliky | |
$ chmod 755 /home/zoliky/public_html | |
$ sudo a2enmod userdir | |
Edit the /etc/apache2/mods-available/php8.2.conf file with root privileges | |
and comment out the entire code section at the bottom of the file: | |
Before: | |
# Running PHP scripts in user directories is disabled by default | |
# | |
# To re-enable PHP in user directories comment the following lines | |
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it | |
# prevents .htaccess files from disabling it. | |
<IfModule mod_userdir.c> | |
<Directory /home/*/public_html> | |
php_admin_flag engine Off | |
</Directory> | |
</IfModule> | |
After: | |
# Running PHP scripts in user directories is disabled by default | |
# | |
# To re-enable PHP in user directories comment the following lines | |
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it | |
# prevents .htaccess files from disabling it. | |
#<IfModule mod_userdir.c> | |
# <Directory /home/*/public_html> | |
# php_admin_flag engine Off | |
# </Directory> | |
#</IfModule> | |
Restart Apache: | |
$ sudo systemctl restart apache2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment