PDA

View Full Version : [ubuntu] apache web server/ localhost



raunhar
November 13th, 2008, 06:50 AM
I installed MySQL and checked http://localhost . It showed sucess.
But I cannot figure out, where the folder www is.

I also want to copy some sites from windows www folder (through easy php).

Rhubarb
November 13th, 2008, 06:59 AM
I installed MySQL and checked http://localhost . It showed sucess.
But I cannot figure out, where the folder www is.

I also want to copy some sites from windows www folder (through easy php).

The www folder is located at: /var/www/
You may need to change ownership of the files in the /var/www/ directory, so it's owned by www-data

raunhar
November 14th, 2008, 06:17 AM
Currently the owner is showing as root. How do i change the ownership

R.Bucky
November 14th, 2008, 06:19 AM
sudo chmod 777 /var/www/ -R should allow read/write to all folders and files within the www directory

y@w
November 14th, 2008, 06:21 AM
You don't want to chmod 777 that directory.. It'll allow read-write-execute to everyone. Just chown it so the web server owns it:


chown -R www-data:www-data /var/www

R.Bucky
November 14th, 2008, 06:25 AM
Doh! thanks for catching that one!

raunhar
November 14th, 2008, 06:29 AM
Thanks.
Did that and I was able to access the folder. BUt when I try to open a web site by giving the command localhost/xyz, it says 403 Forbidden. I edited the folder permissions alos but still the same error

raunhar
November 14th, 2008, 06:34 AM
did chown as directed in the terminal. Error: Permission not granted.

R.Bucky
November 14th, 2008, 06:44 AM
you need to give the command "sudo" powers. e.g. sudo chown -R www-data:www-data /var/www

raunhar
November 14th, 2008, 07:16 AM
Thanks for the reply.

Now when I try to open the site uisng http://localhost/xyz , it says :
Opening
You have chosen to open which is a :PHTML file from http://localhost

What should Firefox do with this file?
Open
Save

The file is index.php

Please suggest

R.Bucky
November 14th, 2008, 07:23 AM
Yup, this problem often pops up with a phpmyadmin install as well. I have had success with adding the below code to my httpd.conf file.
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

raunhar
November 14th, 2008, 08:48 AM
Thanks for the reply.
I added those lines, but still it asks for the options to save or open

I added those two lines s it is. Before that the httpd.conf was empty

ShizzlePDX503
October 17th, 2009, 12:45 PM
not sure if this was resolved or not but after you add those two lines then you have to restart the webserver

for example

sudo /etc/init.d/apache2 restart