Reputation: 401
I need to change the document root in LAMP, I use Ubuntu 15.
Since I want to have the same www folder for Linux as I have in Windows, I'll be using a mounted location.
To achieve that I ran the following command in Terminal (ALT+SHIFT+T -> to open Terminal):
sudo nano /etc/apache2/apache2.conf
Inside the editor I added the following code to the file:
<Directory /media/my_user_name/WORK/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Then I ran sudo nano /etc/apache2/sites-available/000-default.conf
and edited the line containing DocumentRoot to:
DocumentRoot /media/my_user_name/WORK/www
In the end I run sudo service apache2 restart
Now everytime I access localhost I get the following error:
Forbidden You don't have permission to access / on this server. Apache/2.4.12 (Ubuntu) Server at localhost Port 80
Upvotes: 1
Views: 4332
Reputation: 401
Looks like I was missing 3 more steps:
1. As suggested by @Ferendevelop I should set permission to 755 running:
sudo chmod 755 /media/my_user_name/WORK/www/
2 Do a chmod +x on the user dir by running:
cd /media/ sudo chmod +x my_user_name
3 Restart Apache2 service by running:
sudo service apache2 restart
Now it works!
PS: Thanks!
Upvotes: 1
Reputation:
Run the following command.
chmod 755 /media/my_user_name/WORK/www/
Upvotes: 0