PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 9, 2022

[FIXED] How to regain access to home directories through browser after MAMP-wordpress installation

 March 09, 2022     apache, home-directory, macos, mamp, wordpress     No comments   

Issue

I recently installed wordpress on a Mac via MAMP with root URL, say, example.smt.els.com. To do this I had to stop the apache server that was running already in order to use the one provided with MAMP.

My problem is that, although the website is running without problems now, no user can access their home directories via example.smt.els.com/~username.

These /~username pages were accessible prior to wordpress. I have no problem accessing subfolders I create in the root directory (i.e example.smt.els.com/bananas)

I'd appreciate any help.


Solution

The configuration of the apache server that is running from MAMP is done below

/Applications/MAMP/conf/apache/

The first thing that needs to be done is to load the configuration files of the individual users. This can be done by uncommenting the line where the file httpd-userdir.conf is loaded. Hence, the first step is to uncomment the following line:

$ cat httpd.conf | grep httpd-userdir.conf
Include /Applications/MAMP/conf/apache/extra/httpd-userdir.conf
$ 

Now, under the directory extra one can modify the httpd-userdir.conf file so that it is loaded with the options that you want. The first observation is that the httpd-userdir.conf that comes with MAMP has a line that reads:

UserDir public_html

Notice that this is not the expected directory under OS X. Hence, I would suggest to change that line and make it read like this:

UserDir Sites

since "Sites" is the expected directory for this purpose under OS X. Otherwise you should notify the users of the system that you are using public_html just like in traditional unix/linux distributions.

Similarly, further below in the httpd-userdir.conf file you should change the line

<Directory "/home/*/public_html">

to

<Directory "/Users/*/Sites">

Note that the MAMP version of httpd-userdir.conf is different in that respect compared to the default httpd-userdir.conf file that comes with the apache that is installed with OS X and can be found under /etc/apache2/extra/ . Compare these two files and use which ever version you prefer for the configuration. Personally, I would go for the default configuration that comes with OS X, meaning that I would use something like this:

#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
       RegisterUserSite customized-users
</IfModule>

since it gives you even more flexibility for the configuration of the individual users.



Answered By - MightyMouse
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing