LAMP: How do I set up http://myservername.com/~user access?

0

0

Been trying to Google this, but I can't figure out good search terms to find any info about what I need, since I don't really know what it's called.

I'm pretty much being thrown to the wolves to figure out how to set up a LAMP server. We had someone who knew how to do it, he set one up and then quit. It was set up so that when I went to "http://{myservername}.com/~travis" it showed the contents of my /home/travis/public_html folder. This worked fine, then we lost power and the server restarted (I know, battery backup, but this is a dev server in a dev building so it's OK). Now, the browser can't find that URL.

I also need to know how to set this up on a new server, so instead of wasting time diagnosing this problem (probably just something dumb I did messing with settings or something), I really need to know how to set this up from scratch.

Travesty3

Posted 2010-06-01T14:44:47.583

Reputation: 513

Which webserver are you using? – Christoffer Madsen – 2010-06-01T15:31:34.383

1"LAMP server" = Linux + Apache + MySQL + PHP – Sean Edwards – 2010-06-01T15:38:15.697

Answers

2

In Apache it's called mod_userdir.

http://httpd.apache.org/docs/1.3/mod/mod_userdir.html

Just the one config directive, as long as mod_userdir is loaded. To mimick your old setup, it should be:

 UserDir public_html

Assuming your users homedirs are all in /home

(Edit) It's a little different in Apache 2.2. Here's the link to those docs: http://httpd.apache.org/docs/2.2/mod/mod_userdir.html

But the config is exactly the same:

UserDir public_html

Sean Edwards

Posted 2010-06-01T14:44:47.583

Reputation: 298

I know this is the answer, but I need it dumbed down if possible, as I am still in the process of learning everything...including Linux. I created a link from /etc/apache2/mods-enabled/userdir.load to /etc/apache2/mods-available/userdir.load, added "<Directory /home/*> Allow from All

</Directory>

UserDir public_html" to /etc/apache2/httpd.conf (which was empty, so now all it has is that), and restarted apache using "/etc/init.d/apache2 restart". I have no doubt that one of those steps was wrong. I'm using Ubuntu with a standard installation, no special stuff going on that I know of. – Travesty3 – 2010-06-01T16:31:57.460

Take a look in /etc/apache2/mods-available/userdir.conf. In Apache2 nothing really needs to go in httpd.conf anymore. Take that stuff out and symlink userdir.conf as well and you should have all the configuration you need. (a2enmod is a nice little app that will do all that symlinking for you: 'a2enmod userdir' / The antonym to that is a2dismod, which works the same way. They stand for 'Apache2 enable/disable module'.) – Sean Edwards – 2010-06-01T17:17:22.733

For some reason that wasn't working on my dev server even though it should have. I got sick of messing with it so I reinstalled Ubuntu, created the public_html directory in /home/travis, ran a2enmod userdir, and restarted apache and it worked fine. Not sure what my complication was before. Thanks for your help! – Travesty3 – 2010-06-01T18:02:36.930