Control Web Panel
WebPanel => Apache => Nginx => Topic started by: ppalma8 on March 26, 2025, 05:41:00 PM
-
I cannot see another way to restrict access by IP to a pre configured CWP service such as round cube or php my admin
In this example phpmyadmin /pma when running Nginx other than to edit for example:
usr/local/cwpsrv/conf/cwp_services.conf
And under the location for pma:
location /pma {
if ($http_x_real_ip != XXX.XXX.XXX.XXX) {
return 404;
}
}
Is there a better way to do this using CWP ?
-
Would the CSF firewall work for you, or are you trying to be very selective about individual services?
-
(...)
Is there a better way to do this using CWP ?
Create a file /usr/local/cwpsrv/conf/security.conf with the following content:
#...
satisfy any;
allow 192.168.1.1/24;
allow 127.0.0.1;
deny all;
auth_basic "Restricted access";
auth_basic_user_file conf/ht_passwd;
Choose yours IP adresses, and/or define additional authentication on cwpsrv.
Create a file '/usr/local/cwpsrv/conf/ht_passwd' with your passwords:
# /usr/local/apache/bin/htpasswd /usr/local/cwpsrv/conf/ht_passwd
In file '/usr/local/cwpsrv/conf/cwp_services.conf', change your directive to:
location /pma {
root /usr/local/cwpsrv/var/services;
index index.html index.htm index.php;
include /usr/local/cwpsrv/conf/security.conf;
(...)
}
...and restart cwp on the panel, or with the command:
# /scripts/restart_cwpsrv
Regards,
Netino
-
As an aside, does anyone actually use an index file named "index.htm"? I have deleted that possibility from my servers ages ago and only support index.php and index.html as possibilities for the index directive.
-
Sorry I just read your post again so with this conf file Nginx will apply the apache directives:
cwp_services.conf
Is this necessary? or I can just continue with my Nginx conf to filter i.p access to certain directories / urls ?
Thanks, however I always find Apache Directives get ignored when running Nginx in CWP .
What am I missing that means the apache directives don't work, are you running Nginx ?
(...)
Is there a better way to do this using CWP ?
Create a file /usr/local/cwpsrv/conf/security.conf with the following content:
#...
satisfy any;
allow 192.168.1.1/24;
allow 127.0.0.1;
deny all;
auth_basic "Restricted access";
auth_basic_user_file conf/ht_passwd;
Choose yours IP adresses, and/or define additional authentication on cwpsrv.
Create a file '/usr/local/cwpsrv/conf/ht_passwd' with your passwords:
# /usr/local/apache/bin/htpasswd /usr/local/cwpsrv/conf/ht_passwd
In file '/usr/local/cwpsrv/conf/cwp_services.conf', change your directive to:
location /pma {
root /usr/local/cwpsrv/var/services;
index index.html index.htm index.php;
include /usr/local/cwpsrv/conf/security.conf;
(...)
}
...and restart cwp on the panel, or with the command:
# /scripts/restart_cwpsrv
Regards,
Netino