how to enable userdir?

zenonymous

New member
Joined
Nov 12, 2017
Messages
8
I upgraded my directadmin so I can use letsencrypt, only to find out that in this process the once working userdir $ip/~username/ has been disabled:

how do I get this working again? Thanks in advance!
 
Hello,

Userdir should be enabled. I did not find any mention that it was disabled in Directadmin. What error do you have?
 
Hi zEItEr, thanks for your response.

somehow since the update when I visit the ip address of the server I get presented with the first (alphabetical order) website I host on that server, when I try to visit $ip/~username/ I get a 404 error page from the first website I host: really don't know where to look to get this fixed.
 
What is your setup? What is your OS name? OpenSSL version?

Are behind NAT? Are you using nginx standalone? nginx+apache ? or single apache?
 
Do you have single or multiple IPs? Are all of them added into Directadmin?

Do you see your IPs in /etc/httpd/conf/ips.conf ?
 
Hi AMzEitEr,

I have a single ip, the following is the content of ips.conf:

Code:
# Auto generated apache config file by DirectAdmin version 1.51.3
# Modifying this file is not recommended as any changes you make will be
# overwritten when you add/remove ip's through DirectAdmin.

LogFormat "%O \"%r\"" homedir
 
With a single IP you should find a default virtual host with your IP here: /etc/httpd/conf/extra/httpd-vhosts.conf
Please check it and let us know what you see there.
 
this is the content of the config file in question, only editing I did was censor the ip address

Code:
#
# Virtual Hosts
#
# Required modules: mod_log_config
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

##########################################################
# Use name-based virtual hosting.                        #
# All NameVirtualHost lines are in this file             #
# Don't remove this line or apache will generate errors. #
##########################################################
Include /etc/httpd/conf/ips.conf

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost $ip_address $ip_address:80>
    ServerAdmin webmaster@localhost
    UserDir public_html
    DocumentRoot /var/www/html
    ServerName localhost
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    CustomLog /var/log/httpd/homedir.log homedir
    CustomLog /var/log/httpd/access_log combined
    ErrorLog /var/log/httpd/error_log

    <IfModule !mod_ruid2.c>
        SuexecUserGroup webapps webapps
    </IfModule>
</VirtualHost>

<VirtualHost $ip_address $ip_address:443>
    ServerAdmin webmaster@localhost
    UserDir public_html
    DocumentRoot /var/www/html
    ServerName localhost
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    CustomLog /var/log/httpd/homedir.log homedir
    CustomLog /var/log/httpd/access_log combined
    ErrorLog /var/log/httpd/error_log

    SSLEngine on
    SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
    SSLCACertificateFile /etc/httpd/conf/ssl.crt/server.ca

    <IfModule !mod_ruid2.c>
        SuexecUserGroup webapps webapps
    </IfModule>
</VirtualHost>
 
With the config you should have access to UserDirs. I have the same config and UserDir works fine. What is you apache version?

Do you see your server's IP there? Why do you have $ip_address $ip_address (two times)? Is it a typo?
 
Thank you for your help, turns out from the 2 listed ip addresses in the config only 1 was the correct one so I deleted the other one.

now when I visit $ip I get the
Apache is functioning normally
message again so that's nice, however when I try to visit $ip/~username/ I get a

Not Found

The requested URL /~user/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

My apache version is 2.4.12, again thanks for all the help I feel like we almost got this!
 
You might have the wrong IP in virtual hosts as well.

did you try
Code:
./build rewrite_confs
?

Do you see correct IP addresses in Directadmin at admin level? Do you have linked IPs?

and here?

Code:
grep ^lan_ip /usr/local/directadmin/conf/directadmin.conf

Code:
ls -1 /usr/local/directadmin/data/admin/ips/
 
Thank you so much! turns out there was a not correct ip present in

/usr/local/directadmin/data/admin/ips/

after removing this one and rebuilding the config it's working properly again :D
 
Back
Top