Your comments

Thanks very much, I worked it out with your help. I've tried many times and got the method
Apache 2.4, due to /ajenti:socket/1/websocket/ use ws://, just add a specical, this works well for me, share with others. Thanks again.

sudo a2enmod proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http
sudo a2enmod proxy_wstunnel
sudo a2enmod headers


visit http://localhost:8000 to close ajenti's SSL may be more easier to reliaze this.

#########################################
RequestHeader
set Origin "http://localhost:8000"
ProxyPass /ajenti http://localhost:8000
ProxyPass /ajenti:socket/1/websocket/ ws://localhost:8000/ajenti:socket/1/websocket/
ProxyPassMatch ^/(ajenti.*)$ http://localhost:8000
#########################################

This may be the answer, but I get the error. WebSocket connection to 'ws://www.example.com/ajenti:socket/1/websocket/720613736357' failed: Error during WebSocket handshake: Unexpected response code: 403
It doesn't work,  ajenti:socket is not severed
The login page is right, but when I submit, I stopped at /ajenti:auth
Thanks, but It seems I don't understand what you mean(location ~ /ajenti.* ). I use apache2 and copied the code from here: http://support.ajenti.org/topic/349870-ajenti-behind-nginx/, not right?

It doesn't work when redirect to /ajenti:auth    ,can't login into the site