Chapter 1. Installing the software
# cd
# /etc/init.d/httpd start
Starting httpd: [ OK ]
Figure 1-12. Manually starting the web server
If you take this easy approach then you need to know the following few facts.
What you get for the quick & dirty approach
• If the server’s DNS name is server then any file placed in
/var/www/html/some/path/here/file.html will be presented as URL
http://server/some/path/here/file.html.
• Two log files will be maintained in the directory /var/log/httpd called
access_log and error_log. These will be rotated weekly and four weeks’ worth
of logs will be kept.
You can make life much simpler for yourself (as the system administrator) if you
create a group of users who are allowed to edit the document tree /var/www/html.
We will create a group, webadmin, who will have access to the site.
Setting up and using the webadmin group
1. Creating the group
# groupadd -r webadmin
The -r option on groupadd sets up a system group. These are no different from
user groups in reality, but Red Hat Linux assigns them from a different range of
numeric IDs to keep them apart.
2. Setting up /var/www/html
Next we have to change /var/www/html so that this newly created group has
sway over it. We need to do a number of things.
• We must change the group of the directory to be webadmin. It starts out con-
trolled by the root group.
• We must change the permissions so that this group can add things.
• We must set the permissions so that anything created in the directory also is
controlled by the webadmin group.
The change of group is done with the chgrp command and the two changes of
permissions can be done with a single use of the chmod command.
# chgrp webadmin /var/www/html
# chmod g+ws /var/www/html
3. Adding users to the group
We will add the users alice and bob to the webadmin group.
You can directly edit the file /etc/group to add users to the group line. They
should be comma-separated with no spaces and no trailing comma.
apache:x:48:
webalizer:x:67:
webadmin:x:101:alice,bob
Alternatively, we can use the usermod command to change the groups that the
users are in. The -G option sets a user’s groups.
8
Komentarze do niniejszej Instrukcji