Re: User access to /srv/www/htdocs
- From: houghi <houghi@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 31 Dec 2005 15:16:52 +0100
Ram wrote:
> Hi,
>
> I've just got ' Beginning PHP5, Apache, Mysql, Web Development' for xmas
> this book is aimed at windows user with appendix for setting up on
> Linux. I already have the apps installed on my mail server.
>
> My question is how do I create a 'test' folder in /srv/www/htdocs to run
> the examples in the book. I know I could su create the folder and then
> chmod it, but is there away I can do it with group permissions for the
> user.
When you install Apache, these folders will be made for you. Here is
what I did to get my stuff going as a user AND be able to test is very
easily.
As root I do `mkdir /srv/www/htdocs/website`, then I do `chown
houghi:users /srv/www/htdocs/website`
Next, again as root, I make the follwoing file:
/etc/apache2/vhosts.d/houghi.conf This file can have any name, as long
as it ends in *.conf Look in the directory for more examples. This is
how mine looks like:
<VirtualHost *:80>
ServerAdmin houghi
ServerName houghi
DocumentRoot /srv/www/htdocs/website
ErrorLog /var/log/apache2/houghi-error_log
CustomLog /var/log/apache2/houghi-access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
<Directory "/srv/www/htdocs/website">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I then reastart apache with `rcapche2 restart` and if there are no
errors, I can log out. I will now be able to reach the website with
http://houghi
Then as user I want it to be able to reach it easily, so I do `ln -s
/srv/www/htdocs/website` in my homedirectory. Now I can add a page in
~/website. I add test.php with first just `hello world` as content.
I then look at http://houghi and see the file test.php wich I click and
I should be able to see `Hello world`.
To sum it up:
1) make directory as root
2) chown (change owner) from directory
3) Add virtual host
4) restart Apache
5) symlink directory
Step 5 is not really needed. However it is convinient.
--
houghi Please do not toppost http://houghi.org
You are about to enter another dimension, a dimension not only of
sight and sound but of mind. A journey into a wondrous land of
imagination. Next stop, Usenet
.
- Follow-Ups:
- Re: User access to /srv/www/htdocs
- From: David Bolt
- Re: User access to /srv/www/htdocs
- From: Ram
- Re: User access to /srv/www/htdocs
- References:
- User access to /srv/www/htdocs
- From: Ram
- User access to /srv/www/htdocs
- Prev by Date: Re: Linksys WPC54GX and SuSE 10
- Next by Date: Re: OT: Bike Stories
- Previous by thread: User access to /srv/www/htdocs
- Next by thread: Re: User access to /srv/www/htdocs
- Index(es):