CloudPanel version(s) affected
2.5.4
Description
After changing the custom domain assigned to a CloudPanel instance, CloudPanel generated an Nginx configuration containing the directive:
pagespeed off;
On systems where the PageSpeed module is not installed or available, this causes Nginx configuration validation to fail with an [emerg] unknown directive "pagespeed" error.
How to reproduce
Configure a CloudPanel instance with a custom domain:
cloudpanel.old.com
Remove the existing custom domain.
Configure a new custom domain:
cloudpanel.new.com
Inspect the generated configuration:
/etc/nginx/sites-enabled/custom-domain.conf
Observe that the generated configuration contains:
pagespeed off;
Test the Nginx configuration:
nginx -t
Possible Solution
No response
Additional Context
root@cloudpanel:/etc/nginx/sites-enabled# cat custom-domain.conf
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate_key /etc/nginx/ssl-certificates/custom-domain.key;
ssl_certificate /etc/nginx/ssl-certificates/custom-domain.crt;
server_name cloudpanel.new.com;
client_max_body_size 5048M;
root /home/clp/htdocs/app/files/public;
#access_log /home/clp/logs/nginx/access.log;
error_log /home/clp/logs/nginx/error.log;
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
add_header Cache-Control no-transform;
pagespeed off;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $http_host;
proxy_pass https://127.0.0.1:8443/;
proxy_max_temp_file_size 0;
proxy_connect_timeout 7200;
proxy_send_timeout 7200;
proxy_read_timeout 7200;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
}
root@cloudpanel:/etc/nginx/sites-enabled# nginx -t
nginx: [emerg] unknown directive "pagespeed" in /etc/nginx/sites-enabled/custom-domain.conf:20
nginx: configuration file /etc/nginx/nginx.conf test failed
CloudPanel version(s) affected
2.5.4
Description
After changing the custom domain assigned to a CloudPanel instance, CloudPanel generated an Nginx configuration containing the directive:
pagespeed off;
On systems where the PageSpeed module is not installed or available, this causes Nginx configuration validation to fail with an [emerg] unknown directive "pagespeed" error.
How to reproduce
Configure a CloudPanel instance with a custom domain:
cloudpanel.old.comRemove the existing custom domain.
Configure a new custom domain:
cloudpanel.new.comInspect the generated configuration:
/etc/nginx/sites-enabled/custom-domain.confObserve that the generated configuration contains:
pagespeed off;Test the Nginx configuration:
nginx -tPossible Solution
No response
Additional Context
root@cloudpanel:/etc/nginx/sites-enabled# cat custom-domain.conf
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate_key /etc/nginx/ssl-certificates/custom-domain.key;
ssl_certificate /etc/nginx/ssl-certificates/custom-domain.crt;
server_name cloudpanel.new.com;
client_max_body_size 5048M;
root /home/clp/htdocs/app/files/public;
#access_log /home/clp/logs/nginx/access.log;
error_log /home/clp/logs/nginx/error.log;
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
add_header Cache-Control no-transform;
pagespeed off;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $http_host;
proxy_pass https://127.0.0.1:8443/;
proxy_max_temp_file_size 0;
proxy_connect_timeout 7200;
proxy_send_timeout 7200;
proxy_read_timeout 7200;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
}
root@cloudpanel:/etc/nginx/sites-enabled# nginx -t
nginx: [emerg] unknown directive "pagespeed" in /etc/nginx/sites-enabled/custom-domain.conf:20
nginx: configuration file /etc/nginx/nginx.conf test failed