Control Web Panel
WebPanel => Information => Topic started by: pedromidiasf on October 12, 2025, 09:50:14 PM
-
Hi,
Is there a way to add .htpasswd and .htaccess (or configure vhosts to do the same) to the main CWP panel?
I tried to add these files there but they got "Operation not permitted". Also tried to chmod the folder and it got refused.
Is there a way to add them inside this folder or where can i find vhosts of the main panel?
-
Found it!!!
Just needed to add into "/usr/local/cwpsrv/conf/cwpsrv.conf" these 2 lines (inside second "server" into "location /"):
# HTTP Basic Auth
auth_basic "Acesso restrito";
auth_basic_user_file /usr/local/cwpsrv/htdocs/.htpasswd;
Also created a .htpasswd inside the main folder. Probably have to replace that after a CPW update.
Ok cool, now it is required to add a main password before starting using the panel (includes webmail and phpMyAdmin).
PS if you do this, don't forget to restart the service:
sh /scripts/restart_cwpsrv
Take into consideration that everyone will be required to know this password in order to access the panel. In my case there's no other people logging in.
-
The FYI for those interested is that cwpsrv runs under Nginx, not Apache -- so syntax for configuration changes needs to be appropriate for Nginx. And thus, .htaccess files are not read or considered.
Also, in order to preserve files through CWP updates, you need to set the immutable bit:
chattr +i /usr/local/cwpsrv/htdocs/.htpasswd
-
The FYI for those interested is that cwpsrv runs under Nginx, not Apache -- so syntax for configuration changes needs to be appropriate for Nginx. And thus, .htaccess files are not read or considered.
Also, in order to preserve files through CWP updates, you need to set the immutable bit:
chattr +i /usr/local/cwpsrv/htdocs/.htpasswd
Yes I fould out. I wasn't familier with Nginx, that's why it wasn't working what I was doing.
Thanks for the immutable bit! This will help!