What causing this error proxy_fcgi:error] AH01071: Got error 'Primary script unknown'

21.5k views Asked by At

I'm getting the proxy_fcgi:error] AH01071: Got error 'Primary script unknown' error very frequently. Can anyone tell me what causing this error. What I learned so far is Rewrite rule may cause this issue. But do not understand exactly what causing this issue. Following are my Rewrite rules:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www

    <Directory /var/www/>
        Options -Indexes +FollowSymLinks -MultiViews
        AllowOverride None
        Require all granted

        # Setting rewrite rules
        RewriteEngine on
        RewriteBase /
   
        RewriteCond %{HTTPS} off [OR]       
        RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
        RewriteRule (.*) https://www.example.com/$1 [R=301,L]

        # Show 404 error if there is any slash after page name
        RewriteRule ^.+?\.(php|html?)/ - [L,R=404,NC]

        # Custom Directory Index Files
        DirectoryIndex index.php index.html
    </Directory>
</VirtualHost>


<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www

    <Directory /var/www/>
        Options -Indexes +FollowSymLinks -MultiViews
        AllowOverride None
        Require all granted

        # Setting rewrite rules
        RewriteEngine on
        RewriteBase /

        RewriteCond %{HTTP_HOST} ^example.com$ [NC]
        RewriteRule (.*) https://www.example.com/$1 [R=301,L]
        
        # Show 404 error if there is any slash after page name
        RewriteRule ^.+?\.(php|html?)/ - [L,R=404,NC]

        # Custom Directory Index Files
        DirectoryIndex index.php index.html
    </Directory>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>
0

There are 0 answers