Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

php-fpm subdomain rewrite problem

Discussion in 'EasyApache' started by vacancy, Feb 22, 2017.

Tags:
  1. vacancy

    vacancy Well-Known Member

    Joined:
    Sep 20, 2012
    Messages:
    140
    Likes Received:
    14
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hello there

    The rewrite function does not work in some subdomains I have enabled php-fpm.

    I see a not found error when I enter the rewritten pages.

    Html pages and home page are also fine.

    Apache log


    Code:
    [Thu Feb 23 01:23:46.537039 2017] [proxy_fcgi:error] [pid 11216:tid 107208547481344] [client 178.240.*.*:60759] AH01071: Got error 'Primary script unknown\n', referer: http://www.google.com.tr/
    [Thu Feb 23 01:23:46.538710 2017] [proxy_fcgi:error] [pid 11216:tid 107208652609280] [client 84.51.*.*:60760] AH01071: Got error 'Primary script unknown\n', referer: http://tv.domain.com/
    [Thu Feb 23 01:23:46.704341 2017] [proxy_fcgi:error] [pid 11216:tid 107208661464832] [client 84.51.*.*:60769] AH01071: Got error 'Primary script unknown\n', referer: http://tv.domain.com/
    [Thu Feb 23 01:23:46.714214 2017] [proxy_fcgi:error] [pid 11216:tid 107208511764224] [client 151.135.*.*:60770] AH01071: Got error 'Primary script unknown\n', referer: http://m.facebook.com/
    Htaccess

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond $1 !^(index\.php|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule>
    
    
    # remove ETag from images
    Header unset ETag
    FileETag none
    
    <ifModule mod_expires.c>
      ExpiresActive On
      ExpiresDefault "access plus 1 seconds"
      ExpiresByType text/html "access plus 1 seconds"
      ExpiresByType image/gif "access plus 2592000 seconds"
      ExpiresByType image/jpeg "access plus 2592000 seconds"
      ExpiresByType image/png "access plus 2592000 seconds"
      ExpiresByType text/css "access plus 604800 seconds"
      ExpiresByType text/javascript "access plus 216000 seconds"
      ExpiresByType application/x-javascript "access plus 216000 seconds"
      ExpiresByType application/javascript "access plus 216000 seconds"
    </ifModule>
    
    <ifModule mod_headers.c>
      <filesMatch "\\.(ico|mp3|jpg|jpeg|png|gif|swf|ttf)$">
        Header set Cache-Control "max-age=2592000, public"
      </filesMatch>
      <filesMatch "\\.(css)$">
        Header set Cache-Control "max-age=604800, public"
      </filesMatch>
      <filesMatch "\\.(js)$">
        Header set Cache-Control "max-age=216000, private"
      </filesMatch>
      <filesMatch "\\.(xml|txt)$">
        Header set Cache-Control "max-age=216000, public, must-revalidate"
      </filesMatch>
      <filesMatch "\\.(html|htm|php)$">
        Header set Cache-Control "max-age=1, private, must-revalidate"
      </filesMatch>
    </ifModule>
    <FilesMatch ".(eot|ttf|otf|woff)">
            Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
    
    # php -- BEGIN cPanel-generated handler, do not edit
    # NOTE this account's php is controlled via FPM and the vhost, this is a place holder.
    # Do not edit. This next line is to support the cPanel php wrapper (php_cli).
    # AddType application/x-httpd-ea-php55 .php .phtml
    # php -- END cPanel-generated handler, do not edit
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @vacancy,

    The "Primary script unknown"error message occurs with PHP-FPM when a rewrite rule in the .htaccess file forces the use of a specific file that does not exist.

    You can verify an index.php file exists in the document root where this happened to confirm that's what lead to the error message.

    Thank you.
     
Loading...

Share This Page