"Primary script uknown" on one server

SYSTEM INFORMATION
OS type and version Ubuntu 20.04
Virtualmin version 6.17-3

I moved one virtualmin server to another VPS and it went haywire somehow. i used the Backup and Restore feature. Both VPS are running the same Ubuntu and Virtualmin versions. When I enter the domain, it says “File not found”.

In apache error logs, I have

AH01071: Got error ‘Primary script unknown’

Here’s my apache host for SSL version

SuexecUserGroup "#1039" "#1007"
ServerName domain.com
ServerAlias www.domain.com
ServerAlias webmail.domain.com
ServerAlias admin.domain.com
DocumentRoot /home/domain/public_html
ErrorLog /var/log/virtualmin/domain.com_error_log
CustomLog /var/log/virtualmin/domain.com_access_log combined
ScriptAlias /cgi-bin/ /home/domain/cgi-bin/
DirectoryIndex index.php index.php4 index.php5 index.htm index.html
<Directory /home/domain/public_html>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch 
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted
</Directory>
<Directory /home/domain/cgi-bin>
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.domain.com
RewriteRule ^(?!/.well-known)(.*) https://domain.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.domain.com
RewriteRule ^(?!/.well-known)(.*) https://domain.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php7.3
RemoveHandler .php7.4
RemoveHandler .php8.1
<FilesMatch \.php$>
    SetHandler proxy:fcgi://localhost:8012
</FilesMatch>
SSLEngine on
SSLCertificateFile /home/domain/ssl.combined
SSLCertificateKeyFile /home/domain/ssl.key
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
Header set Content-Security-Policy "frame-ancestors 'none';"
Protocols h2 h2c http/1.1

PHP FPM config file

[157492832919133]
user = domain
group = domain
listen = localhost:8041
pm = ondemand
pm.max_children = 15
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5
php_admin_value[upload_tmp_dir] = /home/domain/tmp
php_admin_value[session.save_path] = /home/domain/tmp
pm.process_idle_timeout = 10s
pm.max_requests = 50

I have read a lot on it but can’t seem to figure out a solution.

  • A few people mentioned rebooting the system fixed it but it didn’t for me.
  • I’ve checked file permissions as well and they’re ok.
  • Changed PHP version, didn’t make a difference

How do I diagnose the problem?

are you able to pass error log line from apache error log - what scripts have 404 or other errors? also once you see script name in that error log line - can you check manually that domain owner that is trying to run that script have successful permissions to run this script be it cronjob or server it self as root etc…(I mean via terminal) ?

The logs you provided right now does tell nothing…

Not sure what you mean? This is happening on every php page including home page. If you want to see the entire line of error, its this
[Mon Feb 28 20:03:02.388315 2022] [proxy_fcgi:error] [pid 155206:tid 140107059291904] [client 45.148.10.247:62441] AH01071: Got error 'Primary script unknown'

I can execute php /home/domain/public_html/index.php when logged in to SSH via root user. I get the page contents. Not sure if the domain owner can access it? How can I test that?

The sites had been down for so long. I ended up taking another backup from the old location, this time did not select Apache configuration and SSL configuration (had a feeling this is the problem). Restored it again on the new location and they worked. I guess that option should only be used when backing up and restoring on the same machine.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.