Ir para o conteúdo
ou

Software livre Brasil

0 amigos

Nenhum(a)

0 comunidades

Nenhum(a)

Diego Búrigo Zacarão

 Voltar a Blog em dieg...
Tela cheia

Enabling apache UserDir (public_html) with SELinux enabled on Fedora

7 de Março de 2010, 0:00 , por Software Livre Brasil - 0sem comentários ainda | Ninguém está seguindo este artigo ainda.
Visualizado 765 vezes

I do it barely and for me it’s kinda getting a headache every time I need to do it. I never remember exactly how it needs to be done. So here there are some steps in order to get a specific user using its home dir (usually ~/public_html/) with Apache. It will surely help me in the future and maybe it might help you too. :)

  1. Edit the /etc/httpd/conf/httpd.conf file.
    Change the ‘UserDir disabled’ line to ‘UserDir enabled <username>’.
    Uncomment the ‘UserDir public_html’ line.
    Also uncomment the whole ‘<Directory /home/*/public_html>’ section until the ‘</Directory>’.
  2. Apply the proper permissions:
    # chmod 711 ~<username>
    # chmod 755 -R ~<username>/public_html/
  3. Run the following commands so SELinux wouldn’t bother you:
    # setsebool -P httpd_enable_homedirs true
    # chcon -R -t httpd_sys_content_t ~<username>/public_html   # It looks like it’s not necessary. See dgrift’s comments below.
  4. Extra Tip: It looks like on PHP versions  >= 5.3.0, to allow the short tag ‘<?’ we need to set ’short_open_tag = On’ in the /etc/php.ini.

Restart the httpd service and after it you should be able to access http://localhost/~<username>/

References:
http://fedoraproject.org/wiki/SELinux/apache
http://albertux.ayalasoft.com/2010/01/30/fedora-12-httpd-userdir-selinux-works/
http://www.yolinux.com/TUTORIALS/LinuxTutorialWebSiteConfig.html

UPDATE 1: Altered ’setsebool httpd_enable_homedirs true’ into ’setsebool -P httpd_enable_homedirs true’. Also added comment about the ‘chcon’ command. Thanks, dgrift.


Fonte: http://diegobz.net/2010/03/07/enabling-apache-userdir-public_html-with-selinux-enabled-on-fedora/

0sem comentários ainda

Enviar um comentário

Os campos são obrigatórios.

Se você é um usuário registrado, pode se identificar e ser reconhecido automaticamente.