• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Wordpress "File Not Found" error with custom permalinks on subdirectory

Xavier12

Regular Pleskian
Hey guys,

For some reason I am having issues with wordpress and custom permalinks. When installing wordpress on domain.com/wordpress directory, for some reason custom permalinks are leading to a "file not found" white page, but it works fine with the default permalinks. Below is the error in the proxy error log if that helps.

error] 10137#0: *83 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: MYIPADDRESS, server: DOMAIN.com, request: "GET /futura/events/ HTTP/1.1", upstream: "fastcgi://unix:/var/www/vhosts/system/MYDOMAIN.com/php-fpm.sock:", host: "www.MYDOMAIN.com", referrer: "http://www.MYDOMAIN.com/futura/"


Please advise, thnx!
 
Try to restart nginx service in CLI and show me output.
 
Hey Igor,

Thanks for the follow-up. Restarted nginx service in command line, went through just fine with no errors. But for some odd reason, I have an error log for nginx that looks totally off.. Please see the attachment. I retrieved it from /var/log/nginx
 

Attachments

  • error.log.txt
    64.9 KB · Views: 1
Hi Xavier12,

you might consider adding "psacln" to the groups "www-data" and "nginx" manually, to avoid permission failures for this group as well, if you use FastCGI. As you can see in the pool - definitions for php5-fpm, the group "psacln" ( and the domain - specific domain-user ) handle FastCGI - requests, but "psacln" is not in the group "www-data" and "nginx" by default.

usermod -a -G psacln www-data
usermod -a -G psacln nginx
The info about the "keep - alive - connections" are pretty normal and are just an information. You might consider using another loglevel, in order you avoid the "info - messages"
 
Additional informations:

Depending on your wordpress installation and your server configurations ( apache only, apache with FastCGI, apache + nginx + FastCGI .... ) and the usage of custom permalinks in wordpress, you should define speific rewrite rules Because the rewrites for apache are done over htaccess - files, I will just suggest the needed additional nginx configurations:

You could add custom rewrite rule - definitions in your "vhost_nginx.conf" - or over your Plesk Control Panel: Domains > YOURDOMAIN ( > YOURSUBDOMAIN ) > Webserver - Settings > Additional NGINX directives ( TEXT - Box ):

HTML:
    # General wordpress rewrites
        location ~ /$ {
            index index.php index.cgi index.pl index.html index.htm index.xhtml index.shtml;
            try_files $uri $uri/ /index.php?$args;
        }

        if (!-e $request_filename) {
            rewrite /wp-admin$ $scheme://$host$uri/ permanent;   
            rewrite ^(/[^/]+)?(/wp-.*) $2 last;                   
            rewrite ^(/[^/]+)?(/.*\.php) $2 last;
        }

    set $cache_uri $request_uri;

    # POST requests and URLs with a query string should always go to PHP
        if ($request_method = POST) {
            set $cache_uri 'null cache';
        } 
        if ($query_string != "") {
            set $cache_uri 'null cache';
        }

    # Don't cache URLs that contain the following definitions
        if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
            set $cache_uri 'NULL';
        }

    # Don't cache logged-in users or latest commenters
        if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
            set $cache_uri 'NULL';
        }

    # Add trailing slash to */wp-admin requests.
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    # Directives to send expires headers
        location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
              expires 365d;
        }

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; }
    location ~ /\. { deny  all; access_log off; log_not_found off; }
 
Hi there,

Thanks for this. Completed it. What else would I need to provide to solve the issue, it seems to be still occurring for some reason.

EDIT: Didn't realize another response was sent. Trying now
 
Yup, entered it and the error still continues. I pasted the directive into the domain.com of the site.. its setup where I ftp'ed the wordpress files to a specific folder, and successfully installed a database username and password. So it can be viewed by visiting domain.com/wordpress.

I even tried auto install and it did not work. It just shows "file not found", which I believe should be a 404 error but isn't showing because there is no 404 template existent in the root of that specific folder.

However, wordpress works fine with custom permalinks in the root of a folder, just not subdirectories.

Please advise, thnx

EDIT: Here is the most recent error I received in the proxy log, there are no errors in error log.
2014/12/03 04:04:06 [error] 9525#0: *160 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 173.2.113.236, server: mydomain.com, request: "GET /new/sample-page/ HTTP/1.1", upstream: "fastcgi://unix:/var/www/vhosts/system/mydomain.com/php-fpm.sock:", host: "www.mydomain.com", referrer: "http://www.mydomain.com/new/wp-admin/edit.php?post_type=page"
 
Last edited:
Hi Xavier12,

please don't add code into files, which are generated by Plesk. You have the above mentioned methods to add additional directives... please use them.

Please inform yourself about "rewrite rules" for nginx, Xavier12... there are hundreds of tutorials for wordpress around the web. You will get the best results, by using Google search with the combined words

"wordpress" "nginx" "custom permalinks"

for your issue and you will then learn how to set the specific locations and rewrites.

Hint:

You have as well the possibilty to use the "location" - part for specific subfolders and define the docroot for this custom directives. As well you are able to define customized FastCGI - parameters which are suggested by the software developpers for your additional software ( i.e. "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;" ).


Please be aware that this is a Parallels Forum and people willing to help normally only point to the directions, especially when the issues are non-related Plesk ones.
 
Hey there,

Yes, I know. The information that was provided was pasted into the additional directives when you go to the domain in plesk, web server settings, and at the bottom there is the option for the additional directives. I make sure not to alter core files of Plesk unless required to.

Thanks for the heads up :)
 
Same problem everytime with PLESK if you want to rewrite when WP is installed with toolkit.

OK this is the last time I will use this stupid toolkit
But I would like to understand what is the problem for me and for all the other people that waste time is these things
 
If you install WP without toolkit
to rename Site URL (without change the installation directory) takes 15 sec.

With Plesk 1 day.
Maybe something is to fix
 
Back
Top