I need help accessing my docker container via my subdomain

Hi family
I am new and a junior developer,
I am running a nextcloud in my docker but, i am stocked at how to access the Docker container via my domain.
I have tried to read REVERSE PROXY TRAFFIC TO DOCKER CONTAINER ON CYBERPANEL but couldn’t understand the way forward. Ps i need your assistant

Hi,

actually, reverse proxy is actually the way. First of all, you need to create your website wich you use to access your container.

Second step, you create your container and keep in mind your forward port.

After that, edit your /usr/local/lsws/conf/httpd_config.conf file, and add the following code in the end of file:

extprocessor ARANDOMNAME {
  type                    proxy
  address                 http://yourcyberpanelip:yourportforwared // http://123.123.345:3334
  maxConns                100
  pcKeepAliveTimeout      60
  initTimeout             60
  retryTimeout            0
  respBuffer              0
}

Save your file and go back to your website and edit the .htaccess file, with the follwing code:

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
REWRITERULE ^(.*)$ http://THERANDOMNAMEINPREVIOUSFILE/$1 [P]

After that, do not forget to restart your Litespeed service.

For reference, check my tutorial about installing N8N on cyberpanel, wich is almost the same path.

1 Like

how do i edit this file: /usr/local/lsws/conf/httpd_config.conf
How can i access it. I AM VERY NEW PLEASE.

To edit it, you need to access your server’s ssh. Then, after that, do:

sudo vi /usr/local/lsws/conf/httpd_config.conf

Go to the end of your file, press “i” to edit file, paste/write the code, then press “esc”, following by “:” in your keyboard, add “wq!” and hit enter

You should have root ssh access for this and edit thing carefully