Running sites from localhost/~user/sitename

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Running sites from localhost/~user/sitename

Postby wahhabb » 04. April 2016 07:06

Hi! I have been running an older version of XAMPP for Mac OS X and just upgraded to 7.0.4. In the old version, I would get a message that web pages could either be stored under htdocs in the XAMPP folder or in my ~user/Sites/ folder. I have many websites set up in ~user/Sites/. If for example I have a website at ~user/Sites/mysite I could run it by entering http://localhost/~user/mysite/ in the browser.

This no longer works. Instead I get a 404 error, Object not found! How can I get this approach working again? Since I have many websites with local servers defined in Dreamweaver, I would prefer not to just move them all to htdocs (although files stored there do work).

Thanks so much for your help.

Wahhab
wahhabb
 
Posts: 3
Joined: 04. April 2016 06:50
Operating System: OS/X 10.11.3


Re: Running sites from localhost/~user/sitename

Postby wahhabb » 05. April 2016 00:32

Thanks for the suggestion! In the XAMPP Control Panel, I chose Configure for the Apache Web Server. Under the commented-out line # User home directories, I added the following:

UserDir Sites
UserDir disabled root

I then restarted Apache. This had the result of changing my error from a 404 to a 403, Access forbidden! The message says, "You don't have permission to access the requested directory. There is either no index document or the directory is read-protected." I gave read/write permissions to Everyone in the site I was attempting to load, but no joy. Based on a posts I found, I did a chmod o+x on my home directory and the Sites directory, and also chmod 711 to both, but no help.

I got the following error message:
AH01630: client denied by server configuration: /Users/wahhab/Sites/angular1/index.html

So I tried adding the following:

<Directory Sites>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Require method GET POST OPTIONS
Require all granted
</Directory>

This took me back to getting a 404 error.

I also tried changing the directory line to <Directory /home/*/Sites>, but as I suspected, that had no effect.

Can you offer any further insight?

Thanks so much,

Wahhab
wahhabb
 
Posts: 3
Joined: 04. April 2016 06:50
Operating System: OS/X 10.11.3

Re: Running sites from localhost/~user/sitename

Postby Nobbie » 05. April 2016 10:45

Error 404 means "File not found". I dont know your PC neither your files, either there is no such file or Apache does not have sufficient rights to read it (Apache runs as a User from your OSX and this User may not have sufficient rights, or the file simply does not exist).

wahhabb wrote:I gave read/write permissions to Everyone in the site I was attempting to load, but no joy. Based on a posts I found, I did a chmod o+x on my home directory and the Sites directory, and also chmod 711 to both, but no help.


Because this is not sufficient, you have to grant sufficient rights to ALL(!) folders above, especially also for the /home folder itself. That is basic OSX knowledge (not Apache or Xampp knowledge).
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: Running sites from localhost/~user/sitename

Postby wahhabb » 05. April 2016 16:33

RESOLVED!

I tried renaming my Sites file to public_html, deleting my changes to the configuration file and uncommenting the line,
# User home directories
Include etc/extra/httpd-userdir.conf

This worked!

I then renamed public_html back to Sites, and edited the etc/extra/httpd-userdir.conf file to change the line
UserDir public_html
to
UserDir Sites

At this point, everything works as I wanted.

So what did I do wrong? It was my Directory line. I had
<Directory /home/*/Sites>

and should have had
<Directory "/Users/*/Sites">
wahhabb
 
Posts: 3
Joined: 04. April 2016 06:50
Operating System: OS/X 10.11.3


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 2 guests