DirectAdmin Website Error: 421 Misdirected Request

Refer: https://docs.directadmin.com/changelog/version-1.680.html#software-version-changes

DirectAdmin Version 1.680

Using apache2.4.64 together with nginx may require to enable passing of the server name through TLS Server Name Indication extension in nginx config when using ssl reverse proxy.

You need add config line in this file

/usr/local/directadmin/data/templates/nginx_server_secure.conf
/usr/local/directadmin/data/templates/nginx_server_secure_sub.conf

If server use custom nginx config, need to add line in custom config instead

/usr/local/directadmin/data/templates/custom/nginx_server_secure.conf
/usr/local/directadmin/data/templates/custom/nginx_server_secure_sub.conf

Add this 2 line in file

location /
        {
|CUSTOM2|
               # access_log off;
               proxy_buffering |PROXY_BUFFERING|;
               proxy_pass http://|PROXY_IP|:|PORT_8080|;
               proxy_set_header X-Client-IP $remote_addr;
               proxy_set_header X-Accel-Internal /nginx_static_files;
               proxy_set_header Host $host;
               proxy_ssl_name $host;                       #<------add this 2 lines
               proxy_ssl_server_name on;                   #<------add this 2 lines
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
               proxy_hide_header Upgrade;
         }
         location /nginx_static_files/
         {
               # access_log /var/log/nginx/access_log_proxy;
               alias |DOCROOT|/;
               internal;
         }

After add line in config, run build rewrite_confs

cd /usr/local/directadmin/custombuild
./build rewrite_confs

Website should work normally now.

Was this article helpful?

Related Articles