0

I want to do local Drupal development on my Ubuntu machine. So I installed LAMP and that all went fine. I can access apache through localhost in my browser. I setup my drupal database in mysql using phpmyadmin. Since this is a site I already created (on Windows) I just moved the whole drupal folder (with content) into the var/www folder (which I THINK is the root for apache on linux)...I made sure the settings were correct for the user in settings.php (drupal) and in the mysql database.

I then went to localhost/sitename I also tried localhost/sitename/install.php

And on both I get 403 Forbidden error. I think there's some sort of Ubuntu permission I need to change or something but I have no idea what that would be.

Anyone know what I might try?

Thanks!

  • Make sure .htaccess is not blocking you, delete that file and try. Not sure how you have configured apache, but you say you can access the default server through a web browser, when you copied the folder did you make sure the permission to that folder was set correctly? can you browse to localhost/test.php? if so move the test.php to subfolder sitename and see if you can browse localhost/sitename/test.php – Ads Sep 14 '15 at 5:57
  • @Ads hi, thank you. I really am new to this. So I don't have htaccess file in my drupal site. I didn't configure any permissions (that I know!) that might be the problem. I can access the default apache page and localhost/phpmyadmin but if I do localhost/test.php (which I created and added there) it says 404 not found...I tried it in www/ and www/html/ so i really don't know what's happening. – Sage Sep 14 '15 at 6:16
1

The earlier error 403 is permission related, the 404 error is file not found, Depending on the version of Ubuntu you are running you will find different files, type the following commands to find the document root, ls /etc/apache2/sites-available this should list either 000-default or 000-default.conf file, if there are other entries make a note as it may be configured with virtual hosts, now open this file with nano text editor by typing nano /etc/apache2/sites-available/000-default.conf use the filename you find instead of "000-default.conf" and scroll through this to find DocumentRoot, ideally this should be /var/www/html, if it is different please note it. Type ls -l /var/www/html or the path you get and check the listing there, use sudo touch /var/www/html/try.html to create a blank file in this default document root. Browse this file through your browser on the computer with http://localhost/try.html if it still gives 404 that means your config files need to be checked. Please report back the sites-available, the errors and path info you get. For permission set youself as the owner of files by sudo chown -R yourusername:www-data /var/www/html/ and sudo chmod -R g+w /var/www/html/ make appropriate changes to user and directory name to match your own system.

  • thanks for your help. I'm using 000-default.conf and I also have a file in sites-available called 'default-ssl.conf'. Anyway, my doc root is /var/www/html. I did the ls -l command and got -rwxrw-r -x 1 root root 11510 the date and time index.html (I also go try.html which I added with your suggestion). If I go to the file localhost/try.html I get a 403 forbidden error. – Sage Sep 16 '15 at 23:53
  • Set the following permissions and see if there is any change, sudo chown -R yourname:www-data /var/www/html/ and sudo chmod -R g+w /var/www/html/ then restart apache with sudo service ssh restart since apache serves the default page properly and not another file in that directory, it may have something to do with the conf file, can you post the content of the 000-default.conf and default-ssl.conf from /etc/apache2/sites-enabled directory. – Ads Sep 17 '15 at 5:46
  • Ok, that finally worked. However my site is not displaying. I think I need to add it as a virtual host to apache so it can serve the file in browser for local dev. I tried using 'vi' and didn't do too good. tough program! I managed to type it all out correctly after 30 minutes (like 10 lines) but couldn't save it with zz or :wq so not sure what's going on there. it said again i didn't have permission to save it in sites-available. retiring for night. will try again tomorrow. – Sage Sep 17 '15 at 7:15
  • As per what you wrote earlier your issue may be that it is loaded in "/var/www/" not "/var/www/html/", you can use mv /var/www/drupaldirectoryname/* /var/www/html/drupaldirectoryname/ you need to set permissions if you already have not reset the permission on the drupaldirectoryname, I am not sure how you want it configured, but if you need help with virtual host let me know. You can always use nano text editor its easier. – Ads Sep 17 '15 at 8:50
  • Use Sudo to get permission to that folder, For Saving in vi it's ZZ and not zz you can try :wq! next time, this saves and quits. You can try sudo nano /etc/apache2/sites-available/mysite.local.conf and this should help you configure the mysite.local website as virtual host. – Ads Sep 17 '15 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.