How to enable userdir_access

Hostmavi

Verified User
Joined
Jul 7, 2019
Messages
56
this is workround who want to using userdir_access

1. check whit command if the mod_userdir enable

httpd -M | grep userdir_module
Output : userdir_module (static)

open the file to edit /etc/httpd/conf/extra/httpd-vhosts.conf
find the lines ServerAdmin webmaster@localhost

<VirtualHost $ip_address:80>
ServerAdmin webmaster@localhost

<VirtualHost $ip_address:443>
ServerAdmin webmaster@localhost

add the lines UserDir public_html
it should look like this

<VirtualHost $ip_address:80>
ServerAdmin webmaster@localhost
UserDir public_html


<VirtualHost $ip_address:443>
ServerAdmin webmaster@localhost
UserDir public_html

save it and reload or restart httpd
service httpd reload or service httpd restart

http://$ip/~user should work for all users

if you want to Keep Setting don't Forget to copy
the file /etc/httpd/conf/extra/httpd-vhosts.conf to /usr/local/directadmin/custombuild/custom/ap2/conf/extra/

if you want disabled userdir_access

Just edit UserDir public_html to UserDir disabled

reload or Restart the httpd
service httpd reload or service httpd restart

2. if you want allow only some users like user1 user2 user3
then edit the lines like this

<VirtualHost $ip_address:80>
ServerAdmin webmaster@localhost
UserDir disabled
UserDir enabled user1 user2 user3


<VirtualHost $ip_address:443>
ServerAdmin webmaster@localhost
UserDir disabled
UserDir enabled user1 user2 user3

reload or start httpd
service httpd reload or service httpd Restart

PS: i will prefer to use 2. allow only users Need it
I hope this help who want to using userdir_access

Best Regards
 
Back
Top