All you have to do is editing these example lines in your httpd.conf
#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
<IfModule mod_userdir.c>
UserDir public_html
</IfModule>
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<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>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Note that the files and all the directories have to read permission for the user under which apache runs. That normally means they have to be world readable. Apache does not use the permissions of the refering user.
If it doesn't work, make sure you have mod_userdir installed.
Restricting what users are permitted to use this feature
Using the syntax shown in the UserDir documentation, you can restrict what users are permitted to use this functionality:
UserDir disabled root krish raj
The configuration above will enable the feature for all users except for those listed in the disabled statement. You can, likewise, disable the feature for all but a few users by using a configuration like the following:
UserDir disabled
UserDir enabled sai tester
Enabling a cgi directory for each user
In order to give each user their own cgi-bin directory, you can use a <Directory> directive to make a particular subdirectory of a user's home directory cgi-enabled.
<Directory /home/*/public_html/cgi-bin/>
Options ExecCGI
SetHandler cgi-script
</Directory>
Then, presuming that UserDir is set to public_html, a cgi program example.cgi could be loaded from that directory as:
http://example.com/~tester/cgi-bin/example.cgi
Save the file using :wq or x
Restart apache /etc/init.d/httpd restart
It will work
If you find any internal server error there must a permission issues for the files and directories.
Ensure that the directories have 755 permission and files have 644 permission.
you can also run the below command.
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
Try running the above command inside the directory so that other files in the server doesn't get affected.
Restart the apache . It will work.
By default when adding the user, the public_html directory will not be available. I tried by creating the public_html direcotry in /etc/skel .
After this when ever i create a user the public_html directory is created by default to the users home directory.
#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
<IfModule mod_userdir.c>
UserDir public_html
</IfModule>
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<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>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Note that the files and all the directories have to read permission for the user under which apache runs. That normally means they have to be world readable. Apache does not use the permissions of the refering user.
If it doesn't work, make sure you have mod_userdir installed.
Restricting what users are permitted to use this feature
Using the syntax shown in the UserDir documentation, you can restrict what users are permitted to use this functionality:
UserDir disabled root krish raj
The configuration above will enable the feature for all users except for those listed in the disabled statement. You can, likewise, disable the feature for all but a few users by using a configuration like the following:
UserDir disabled
UserDir enabled sai tester
Enabling a cgi directory for each user
In order to give each user their own cgi-bin directory, you can use a <Directory> directive to make a particular subdirectory of a user's home directory cgi-enabled.
<Directory /home/*/public_html/cgi-bin/>
Options ExecCGI
SetHandler cgi-script
</Directory>
Then, presuming that UserDir is set to public_html, a cgi program example.cgi could be loaded from that directory as:
http://example.com/~tester/cgi-bin/example.cgi
Save the file using :wq or x
Restart apache /etc/init.d/httpd restart
It will work
If you find any internal server error there must a permission issues for the files and directories.
Ensure that the directories have 755 permission and files have 644 permission.
you can also run the below command.
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
Try running the above command inside the directory so that other files in the server doesn't get affected.
Restart the apache . It will work.
By default when adding the user, the public_html directory will not be available. I tried by creating the public_html direcotry in /etc/skel .
After this when ever i create a user the public_html directory is created by default to the users home directory.
No comments:
Post a Comment