madman
January 25th, 2003, 23:08
It's me again! I hope that brings a smile to your face rather than sending chills down your spine... ;)
Ok, now with Apache set up, I can access my domain and see the little OBSD/Apache documentation and stuff letting me know its working, sweet!
However, i was trying to edit httpd.conf to allow user accounts... everything works out great, i have the user account set up in /home/*/public_html(/index.html) and i believe i should be able to access them with localhost/~username, however i get a 404 not found error even though the index.html is there, and i think the ~username should be pointing to the home directory... where am i going wrong? SOS!!
Thanks again in advance, you guys are the best!!!!!
v902
January 25th, 2003, 23:25
Where are the Apache files hosted? /www ? /var/www ? Well I believe you either have to make a symlink to /home/blah or have it there, i may be wrong but I think so.
madman
January 25th, 2003, 23:42
the files are at var/www for the obsd/apache documentation page for http://localhost. however i thought you could edit httpd.conf, change UserDir disabled to UserDir public_html and noting where that directory is <Directory /home/*/public_html (... etc ...)> to configure it to know that when trying to access localhost/~usernameX it looks in home/usernameX/public_html for the index.html. Maybe I'm wrong as well... I'm guessing i could just put the user account pages in the var/www/public_html maybe? and have it work from there, however, it would be nicer if the files for the user pages were in their respective directories. But again, I'm not very familiar with this so I couldn't definitely be wrong. I might resort to moving them to var/www if that would even work, do you think it would?? Or fix the problem with trying to point to /home. Thanks all! 8)
madman
January 26th, 2003, 01:03
Here is what I'm trying to do:
File: /var/www/conf/httpd.conf
----------------------------------------------------------------------------------
Change the lines that read:
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received. "disabled" turns this feature
# off; other reasonable defaults are "public_dir" and ".html"
#
UserDir disabled
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only and
# are located under /home/<username>public_html
# You will need to change this to match your site's home directories.
#
#<Directory /home/*/public_html>
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# <Limit GET POST OPTIONS PROPFIND>
# Order allow,deny
# Allow from all
# </Limit>
# <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
# Order deny,allow
# Deny from all
# </Limit>
#</Directory>
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
To read:
#Enable the mod_userdir.c module
UserDir public_html
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Order deny,allow
Deny from all
</Limit>
</Directory>
-----------------------------------------------------------------------------------
In the above example, we specify public_html as the directory each user-account can create and place their website. If user johndoe has his user directory at /home/johndoe then he needs to create a directory public_html from inside his home folder.
/home/johndoe/public_html will be johndoe's website. All URL requests addressed as http://server-name/~johndoe will look into this directory.
Note: If you want to use a directory name other than those specified in the httpd.conf file, then you may need to modify the mod_userdir source.
Restart apache
Before the configuration goes into effect, we need to force httpd to re-read it's configuration file.
# apachectl restart
Seems to simple, but if you forget to restart the server, you will be frustrated in trying to test the changes when the running server does not recognise them.
Create public_html in user accounts
For our example user johndoe we will create the public_html directory and create a dummy html file.
bash# su johndoe
bash$ cd ~
bash$ mkdir public_html
bash$ cd public_html
bash$ echo "<html><body><h1>Success</h1>Now, get real content</body></html>" > index.html
bash$ exit
Of course, you could move or place some more sophisticated files into this directory, but this is an adequate start for a test.
Access user accounts with the URL form http://server-name/~user-id/
Now we try to access the web page.
bash# lynx localhost/~johndoe/
[ lynx displays the following ...]
Success
Now, get real content
[ ... more stuff cut out ... ]
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
however at the end i don't get the proper lynx display... i get a 404 not found error...
Strog
January 26th, 2003, 03:15
UserDir public_html should be what you need if the userdir module is loaded.
Do you have a line like this in your conf?
LoadModule userdir_module modules/mod_userdir.so
You need to make sure that Apache was compiled with that option enabled or your not going very far with this.
You could always use
Alias /~username1 /home/username1
Alias /~username2 /home/username2
but this is a kludge and manual. Maybe this is all you really want if you only have a handful of users to give webpages.
frisco
January 26th, 2003, 03:51
are you running OpenBSD 3.2? if so, apache is chroot'd by default. refer to http://www.openbsd.org/faq/faq10.html#httpdchroot
for more info.
you will need to either turn off chroot by running httpd with the -u option (and lose the security benefits) or do some filesystem trickery.
bsdjunkie
January 26th, 2003, 10:35
Heh, frisco beat me to it looks like :) Sounds like your running it chroot, and that wont let you do the user dirs :roll: