Description
Describe the bug
I'm using a plesk server and wanted to install the blocker. After setting everything up I need to mass update the vhosts configuration files.
Unfortunately when trying this I notice a few issues
On the installation the vhosts files are stored in
/etc/nginx/plesk.conf.d/vhosts
with symlinks like this
like this lrwxrwxrwx 1 root root 47 May 29 09:21 ioweb.gr.conf -> /var/www/vhosts/system/ioweb.gr/conf/nginx.conf
Moreover they have multiple server {} blocks declared
To Reproduce
I run
setup-ngxblocker -x -d -v /etc/nginx/plesk.conf.d/vhosts/ -e .conf
And the script did the following
- It converted the symlinks to actual files. It should have modified the files without altering the symlinks
- It added the directive only on the last server block
Expected behavior
The directive include /etc/nginx/bots.d/blockbots.conf
is included in all server blocks on the original files and not break the symlinks
Screenshots
Copy of nginx.conf
If applicable please paste your nginx.conf file here
(paste in between the
markers)
#user nginx;
worker_processes 16;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
include /etc/nginx/modules.conf.d/*.conf;
events {
worker_connections 4096;
}
http {
include mime.types;
default_type application/octet-stream;
log_format post_logs '[$time_local] "$request" $status '
'$body_bytes_sent "$http_referer" '
'"$http_user_agent" [$request_body]';
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#tcp_nodelay on;
#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server_tokens off;
include /etc/nginx/ioweb-custom/http-directives/*.conf;
include /etc/nginx/conf.d/*.conf;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
Copy of vhost / website / host .conf file
If applicable please paste your site/vhost configuration file in between the code ticks
(paste in between the
markers)
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
server {
listen 1.2.3.4:443 quic;
listen 1.2.3.4:443 ssl;
server_name example.com;
# ...other directives like ssl_certificate, location, etc. would go here...
}
server {
listen 1.2.3.4:443 quic;
listen 1.2.3.4:443 ssl;
server_name www.example.com;
server_name ipv4.example.com;
# ...other directives like ssl_certificate, location, etc. would go here...
}
server {
listen [abcd:1234::1]:443 quic;
listen [abcd:1234::1]:443 ssl;
server_name example.com;
# ...other directives like ssl_certificate, location, etc. would go here...
}
server {
listen [abcd:1234::1]:443 quic;
listen [abcd:1234::1]:443 ssl;
server_name www.example.com;
server_name ipv6.example.com;
# ...other directives like ssl_certificate, location, etc. would go here...
}
server {
listen 1.2.3.4:80;
server_name example.com;
# ...other directives like location, etc. would go here...
}
server {
listen 1.2.3.4:80;
server_name www.example.com;
server_name ipv4.example.com;
# ...other directives like location, etc. would go here...
}
server {
listen [abcd:1234::1]:80;
server_name example.com;
# ...other directives like location, etc. would go here...
}
server {
listen [abcd:1234::1]:80;
server_name www.example.com;
server_name ipv6.example.com;
# ...other directives like location, etc. would go here...
}
Server (please complete the following information):
-
Operating System:
-
Ubuntu
-
Alpine
-
Arch Linux
-
Debian
-
CentOS
-
Fedora
-
Deepin
-
Windows
-
Other
-
Specify Exact Version of OS: 20.04
Linux 5.4.0-215-generic #235-Ubuntu SMP Fri Apr 11 21:55:32 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
- Nginx Version [post output of sudo nginx -v]
nginx version: nginx/1.26.3
built with OpenSSL 1.1.1f 31 Mar 2020
TLS SNI support enabled
configure arguments: --prefix=/usr/share --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --modules-path=/usr/share/nginx/modules --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --user=nginx --group=nginx --with-file-aio --with-compat --with-ld-opt=-L/var/jenkins/workspace/PLESK/CI/rapid-ci/buck-out/gen/unix/plesk/packages/brotli/brotli.files/usr/lib/x86_64-linux-gnu --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_dav_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_v2_module --with-http_v3_module --add-dynamic-module=mod_brotli --add-dynamic-module=mod_passenger/src/nginx_module --add-dynamic-module=mod_pagespeed --add-dynamic-module=mod_security --add-dynamic-module=mod_geoip2
-
Other Environments [include Version information]
-
Plesk
-
CPanel
-
Synology NAS
-
Other
-
Specify Other / Specific Version Information Here:
-
Any other applicable log / error messages that may help us to help you.
Paste any log / error messages here (paste in between the ``` ``` markers)
Additional information
Add any other context about the problem here.