Changing documentroot in Apache on Linux (Ubuntu)
*pls bear in mind i'm a noob to linux*
I installed Ubuntu (8.10) and then got apache and everything working just fine.
Then used gparted to unmount, rename to "data" (but show up in places as "DATA" for what it matters), format to fat32 and created a www folder in there with a php file (index.php) just doing a phpinfo();
Then in etc/apache2/sites-available/default, I changed "DocumentRoot" and "<Directory xx" from /var/www to various values (cause I still dont get this directory nameing) such as /data/www", /media/data/www" and so on.
But each time I restart apache with "sudo /etc/init.d/apache2 restart" it tells me that the directory I change to above does not exits.
How should I specify the path to that www folder on the new partition (data/www) ?
Re: Changing documentroot in Apache on Linux (Ubuntu)
ok ok..I get it...Case Sensitivity! data !=Data!=Data
However now I get a permission denied error when i go to localhost....let me try figure that out (linux noob..it sucks)
Re: Changing documentroot in Apache on Linux (Ubuntu)
Heck, I give up. Someone help me out here please.
Apparently I have to run some chmod command in the terminal
How to do? cd to the directory (/media/DATA/www) ... and then?
Really, I got no idea .... will be learning all the important things over time but for now just want to get productive. (BTW..this is just a development machine, so security not that important)
Re: Changing documentroot in Apache on Linux (Ubuntu)
try running the following (from any directory)
Code:
chown -R www-data:www-data /data/www
which basicalls recursively changes the owner of all the files to the user apache runs under. If you just want to change the file permissions instead, use the following:
Code:
chmod -R 755 /data/www
Re: Changing documentroot in Apache on Linux (Ubuntu)
Quote:
Originally Posted by CyberSurfer
If you just want to change the file permissions instead, use the following:
Code:
chmod -R 755 /data/www
If you run that, you will end up with all folders and files set as read/write/execute. You only want the folders to have execute permissions normally.
Code:
chmod -R u=rwX, g=rX, o=rX
u = user, g = group, o = other. The capital 'X' only puts on the execute ('x') permissions if the file is a directory (everything is a file in unix). This will end up with folders given permission 755 (r/w/x) and normal files given permission 644 (r/w).
Re: Changing documentroot in Apache on Linux (Ubuntu)
Naah, maybe it's sth else...
I tried all the above, only "chmod -R u=rwX, g=rX, o=rX" I did not try as I dont know what user or group should be used.
Eventually got all them excecute without errors, but no effect when I go to localhost.
Still get the dreaded:
Quote:
Forbidden
You don't have permission to access / on this server.
Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4 with Suhosin-Patch Server at localhost Port 80
Re: Changing documentroot in Apache on Linux (Ubuntu)
Dont know if it mean anything, but when I restart Apache, it sez:
Quote:
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerNam
e
Re: Changing documentroot in Apache on Linux (Ubuntu)
Quote:
Originally Posted by StrangerInBeijing
Dont know if it mean anything, but when I restart Apache, it sez:
e
You have to set the ServerName value in /etc/apache2/httpd.conf.
http://httpd.apache.org/docs/2.2/mod...tml#servername
/etc/apache2/httpd.conf is where you should be putting all your user-specific options. It is included from apache2.conf so you don't have to touch apache2.conf.
Re: Changing documentroot in Apache on Linux (Ubuntu)
Quote:
Originally Posted by StrangerInBeijing
Naah, maybe it's sth else...
I tried all the above, only "chmod -R u=rwX, g=rX, o=rX" I did not try as I dont know what user or group should be used.
Eventually got all them excecute without errors, but no effect when I go to localhost.
Still get the dreaded:
Try looking in the apache error log at /var/log/apache2/error.log. This might provide some details on what is going wrong.
Re: Changing documentroot in Apache on Linux (Ubuntu)
Quote:
Originally Posted by StrangerInBeijing
Naah, maybe it's sth else...
I tried all the above, only "chmod -R u=rwX, g=rX, o=rX" I did not try as I dont know what user or group should be used.
Eventually got all them excecute without errors, but no effect when I go to localhost.
Still get the dreaded:
Have you got an index page in there? I.e. index.html? If not and, if you have not enabled directory listings you will get a forbidden error.
To enable directory listings:
Code:
<Directory /path/to/document/root>
Options +Indexes
</Directory>