CreatoX
09/06/12, 07:10
Hallo allemaal,
Al een aantal dagen zit ik te klungelen met rechten om één en ander goed aan de praat te krijgen. Ik hoop dat jullie mij kunnen helpen tot een oplossing.
Probleem:
Website geeft 403 forbidden melding wanneer rechten in de www root niet goed staan.
Probleemomschrijving:
Middels het volgende stappenplannen een nieuwe Ubuntu serverinstallatie gedaan: link (http://www.hetcomputermannetje.nl/index.php?option=com_content&view=article&id=106:linux-lamp-server-installeren&catid=35:cursussen-voor-linux-ubuntu&Itemid=56) en link (https://help.ubuntu.com/community/ApacheMySQLPHP)
Hierbij de www-root verplaats van:
/var/www --> /home/bert/public_html
Virtual Hosts
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called default this is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.
As an example, we want the default site to be /home/user/public_html/. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example: gksudo gedit /etc/apache2/sites-available/mysite
Change the DocumentRoot to point to the new location. For example, /home/user/public_html/
Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).
sudo a2dissite default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/, you will receive an warning message
To test the new site, create a file in /home/user/public_html/:
echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html
Dit werkt! Geen problemen tot dusver.
Om via FTP bestanden te kunnen plaatsen vanuit Dreamweaver moest er een FTP server geïnstalleerd worden. Dit middels de volgende handleiding gedaan: link (http://wiki.ubuntu-nl.org/FtpServer)
Ook dit gaf geen problemen en middels FTP kon er worden ingelogd met mijn useraccount en bestanden geplaatst worden in /home/bert/public_html
Echter doordat de bestanden via FTP geplaatst worden, krijgen ze andere rechten. Rechten waarbij www-data niets mag lezen.
10295
In de hierboven staande afbeelding zijn de meeste bestanden en mappen via FTP (windows) geplaatst. Behalve index2.html, deze is in Linux aangemaakt. Wanneer index2.html vanuit de webbrowser word opgeroepen, wordt deze getoond. Bij het oproepen van index.html word een Forbidden melding gegeven.
Na iedere nieuwe FTP upload dien ik de rechten aan te passen (chmod) zodat de bestanden gelezen mogen worden door apache.
Wat kan ik doen om er voor te zorgen dat FTP-uploads:
1. de correcte rechten krijgen?
of
2. www-data altijd mag lezen (en account bert mag blijven schrijven)?
Hoop dat jullie een beginner uit de brand kunnen helpen.
Al een aantal dagen zit ik te klungelen met rechten om één en ander goed aan de praat te krijgen. Ik hoop dat jullie mij kunnen helpen tot een oplossing.
Probleem:
Website geeft 403 forbidden melding wanneer rechten in de www root niet goed staan.
Probleemomschrijving:
Middels het volgende stappenplannen een nieuwe Ubuntu serverinstallatie gedaan: link (http://www.hetcomputermannetje.nl/index.php?option=com_content&view=article&id=106:linux-lamp-server-installeren&catid=35:cursussen-voor-linux-ubuntu&Itemid=56) en link (https://help.ubuntu.com/community/ApacheMySQLPHP)
Hierbij de www-root verplaats van:
/var/www --> /home/bert/public_html
Virtual Hosts
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called default this is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.
As an example, we want the default site to be /home/user/public_html/. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example: gksudo gedit /etc/apache2/sites-available/mysite
Change the DocumentRoot to point to the new location. For example, /home/user/public_html/
Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).
sudo a2dissite default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/, you will receive an warning message
To test the new site, create a file in /home/user/public_html/:
echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html
Dit werkt! Geen problemen tot dusver.
Om via FTP bestanden te kunnen plaatsen vanuit Dreamweaver moest er een FTP server geïnstalleerd worden. Dit middels de volgende handleiding gedaan: link (http://wiki.ubuntu-nl.org/FtpServer)
Ook dit gaf geen problemen en middels FTP kon er worden ingelogd met mijn useraccount en bestanden geplaatst worden in /home/bert/public_html
Echter doordat de bestanden via FTP geplaatst worden, krijgen ze andere rechten. Rechten waarbij www-data niets mag lezen.
10295
In de hierboven staande afbeelding zijn de meeste bestanden en mappen via FTP (windows) geplaatst. Behalve index2.html, deze is in Linux aangemaakt. Wanneer index2.html vanuit de webbrowser word opgeroepen, wordt deze getoond. Bij het oproepen van index.html word een Forbidden melding gegeven.
Na iedere nieuwe FTP upload dien ik de rechten aan te passen (chmod) zodat de bestanden gelezen mogen worden door apache.
Wat kan ik doen om er voor te zorgen dat FTP-uploads:
1. de correcte rechten krijgen?
of
2. www-data altijd mag lezen (en account bert mag blijven schrijven)?
Hoop dat jullie een beginner uit de brand kunnen helpen.