Model Kursus/ Pelatihan
Materi Umum TKJ
CENTOS 6.4 : Apache Userdir Active Directory |
Ditulis oleh Tutor TKJ CLUB |
Senin, 28 Oktober 2013 13:31 |
This is quick guide howto enable Apache userdirs with SELinux on Fedora 19/18/17, CentOS 6.4/6.3/6.2/6.1/6/5.9 and Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9. This guide assumes that you have Apache (httpd) server installed on your system. This guide uses separeted userdir.conf without touching httpd.conf so later default httpd.conf can be overrided or whole configuration moved simply. This guide uses user called testuser and should be replaced by real user name(s).
1. Change root user
su - ## OR ## sudo -i
2. Create /etc/httpd/conf.d/userdir.conf file
nano -w /etc/httpd/conf.d/userdir.conf
# # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # UserDir enabled testuser # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disabled" line above, and uncomment # the following line instead: # UserDir public_html Options Indexes Includes FollowSymLinks ## Apache 2.4 users use following ## Require all granted ## Apache 2.2 users use following ## AllowOverride All Allow from all Order deny,allow
3. Start/Restart Apache (httpd)
## CentOS / RHEL ## /etc/init.d/httpd start ## OR ## /etc/init.d/httpd restart ## Fedora ## service httpd start ## OR ## service httpd restart
4. Create public_html directory/directories
mkdir /home/testuser/public_html
5. Change the correct permissions to home and public_html directories
## home directory ## chmod 711 /home/testuser ## public_html directory ## chown testuser:testuser /home/testuser/public_html chmod 755 /home/testuser/public_html
6. Set proper SELinux settings for Apache homedirs (httpd_enable_homedirs)
setsebool -P httpd_enable_homedirs true
Looks like older SELinux versions needs also following (example CentOS and Red Hat):
chcon -R -t httpd_sys_content_t /home/testuser/public_html
Sumber : http://www.if-not-true-then-false.com/ |