Reputation: 841
I have installed apache2, php, mariadb, phpmyadmin to Ubuntu 22.04.
All was working fine than I changed default www path to new folder path "/home/user/www".
For this I did following steps
< Directory /> Options Indexes FollowSymLinks AllowOverride All Require all denied < /Directory>
to
Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted
And added
<Directory /home/user/www>Options Indexes FollowSymLinks
AllowOverride All Require all denied < /Directory>
sudo adduser user www-data
sudo chown -R www-data:www-data /home/user/www/
sudo chmod -R g+rw /home/user/www/
sudo systemctl reload apache2
And I am getting error when I go to 'localhost'
"Forbidden You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe
Apache/2.4.52 (Ubuntu) Server at localhost Port 80"
Upvotes: 0
Views: 2361
Reputation: 51
Yes it's due to new directive
of apache2
with ubuntu 22.04.3-LTS
/etc/apache2/apache2.conf
ServerName 127.0.1.1
/etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html
to-> /home/user/www/
sudo apachectl configtest
Syntax OK
systemctl restart apache2
I made my symbolic link to /home/user/www
ln -s /home/YourName/www
( Important !) Without sudo!
Ubuntu 22.04
But it's different on ubuntu 22.04
:
/etc/apache2/apache2.conf
ServerName localhost
/etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html
to -> /var/www
sudo apachectl configtest
Syntax OK
systemctl restart apache2
I made my symbolic link to /home/user/www
ln -s /home/YourName/www
( Important !) Without sudo
That's done, good Programming days!
Upvotes: 1