Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to change the XAMPP's web root default directory /opt/lampp/htocs to another one like /home/me/Dropbox/public_html without success.

I've edited the file /opt/lampp/etc/httpd.conf

# old line: DocumentRoot "/opt/lampp/htdocs"
DocumentRoot "/home/me/Dropbox/public_html"

#...etc...

# old line: <Directory "/opt/lampp/htdocs">
<Directory "/home/me/Dropbox/Work/public_html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# etc...

I've did this as said in this article: Using Ubuntu One to synchronise htdocs?

Then I've restarted Apache and I've got a permission error 403 on every page I've called with the web browser.

So I've changed folder and files permission to 755.

I've did this as said in this article:
What file permissions should I set on web root?

The problem still remains the same, I have the 403 error on every page I try to reach with the web browser.

I have the same problem on a Mac using XAMPP.

So everythig works fine if the folder remains the original /opt/lampp/htocs.

How can I change it correctly?

share|improve this question
    
I can't find the opt folder, is it inside of another folder or something? I've already searched almost the whole xampp installation folder and can't find it, please help :( –  user156529 May 7 '13 at 17:51
    
I've did it on a Ubuntu distribution, maybe are you using another distro? Starting from the root folder / I'll find the opt folder. –  Vittorio Vittori May 8 '13 at 6:59

6 Answers 6

up vote 6 down vote accepted

Open /opt/lampp/etc/httpd.conf change nobody and nogroup

<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nogroup
</IfModule>

to your username and your group

share|improve this answer

The problem was on user group type in httpd.conf file which must be set to staff and then I don't need to change the folder permissions on the folder i'd like to use as web root.

share|improve this answer

Just make an index file on your new htdocs folder.

share|improve this answer
    
Can you edit this to provide some details explaining how to do that? –  Eliah Kagan Sep 1 '12 at 16:55

You can create a symbolic link

ln -s /home/username/public_html/ /opt/lampp/yoursymlink 

with your username "~username" as symbolic link so you can keep the same URL location

localhost/~username for files like if your were using default Apache server and not XAMPP.

share|improve this answer

Just solved it following the steps bellow:

  1. First install xampp by following steps

    $ sudo cd Downloads && sudo chmod a+x ./your-downloaded-xampp-file.run && sudo ./your-downloaded-xampp-file.run
    
  2. Change file owner of /opt/lampp directory. username should be the username of your new documentroot folder ownername

    sudo chown -hR  username:root /opt/lampp
    
  3. edit /opt/lampp/etc/httpd.conf

    sudo gedit /opt/lampp/etc/httpd.conf
    
  4. edit your document root path to mounted windows documentroot and the following lines

    <IfModule unixd_module>
       User nobody
       Group nogroup
    </IfModule>
    
  5. restart xampp. And you will find forbidden error has gone

share|improve this answer

In NTFS format you can't set folder permissions. Open /opt/lampp/etc/httpd.conf.

Edit
User computerName
Group computerName

And after that you can access the symbolic links in htdocs.

share|improve this answer
1  
Where is NTFS format told in the question? Also the rest of the answer does not seem to answer the OP's question. –  saji89 Oct 22 '12 at 9:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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