Results 1 to 10 of 10

Thread: Changing documentroot in Apache on Linux (Ubuntu)

  1. #1

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    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) ?
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  2. #2

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    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)
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  3. #3

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    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)
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  4. #4
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425

    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

  5. #5
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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).
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  6. #6

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    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:
    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
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  7. #7

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Changing documentroot in Apache on Linux (Ubuntu)

    Dont know if it mean anything, but when I restart Apache, it sez:
    * 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
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  8. #8
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  9. #9
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  10. #10
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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>
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width