• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Resolved Nginx Error (13: Permission denied)

netcomander

New Pleskian
Hello
i've see on all wordpress website logs "nginx error (13: Permission denied)" i think its update problem i dont know what happend my server. its look like permisson problem but i cant found anything.
could you help me please.
‪CentOS Linux 7.2.1511 (Core)‬
Plesk Onyx Version 17.0.17 Update #8, last updated on Dec 5, 2016 09:29 PM
Best Regards
Umut
 
Hi netcomander,

when you "think", that this might be an update/upgrade/patch problem, pls. always consider to use the Plesk repair utility in the first place.

=> Plesk Repair Utility ( Plesk Onyx ( 17.0 ) - online documentation - Administrator's Guide )


Investigations are mostly done with the help of log - files, pls. consider to read and bookmark:


It is always adviced, to POST the corresponding log - entries, which you found in your log - files, if you desire help and suggestions from people willing to help you.


Pls. be informed, that the most common issues/errors/problems for wordpress and apache+nginx - usage result of wrong or missing rewrite directives. If you desire help from people willing to help you, pls. consider to provide ADDITIONAL informations, as for example:
  • PHP - configuration: apache + nginx, o.k... BUT WHICH PHP - handler do you use? FastCGI? PHP-FPM? Which PHP - version? Pls. go to "Home > Subscriptions > (SUBDOMAIN.)YOUR-DOMAIN.COM" and check the settings at "PHP Settings"
  • Webserver - configuration: Pls. go to "Home > Subscriptions > (SUBDOMAIN.)YOUR-DOMAIN.COM" and check the settings at "Apache & nginx Settings" and let us know your current configuration.
  • .htaccess - files: If you use ".htaccess" - files, pls. be aware that you might need "Additional NGINX directives", because NGINX can't read ".htaccess" - files. Pls. inform us with the content from possible ".htaccess" - files. Pls. note, that some wordpress - plugins might need "Additional APACHE + NGINX rewrites", when you use apache+nginx on your domain. The plugin - provider will normally provide such informations and you have to add these directives to your webserver - configuration. Consider to name additional plugins, so that people willing to help, have something to start with for their investigations.
 
Hello
i've change apache module to prefork.
my php version 5.4.16
apache & nginx setting Fpm app. serverd apache settings choosed.
and
htaccess file
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>

# END WordPress
 
i've change apache settings to prefork, but i cannot logrotate settings my os Centos 7 maybe its different i cannot fix my issue could you help me please
 
Hi netcomander,

pls. try the following as "Additional NGINX directives" at "Home > Subscriptions > (SUBDOMAIN)YOUR-DOMAIN.COM > Apache & nginx Settings":

Code:
location ~* ^/index\.php$ {
    break;
}
try_files $uri $uri/ /wp/wp/index.php$is_args$args;
As you can see in your ".htaccess" - file, you configured a RewriteBase "/wp/" and you added as well another RewriteRule "/wp/index.php", which implies, that your document-root - folder for your worpress - instance is at "/var/www/vhosts/YOUR-DOMAIN.COM/httpdocs/wp/wp/"

If you misconfigured that ".htaccess" - file, pls. be informed, that the general STANDARD for worpress would look like this:
Code:
# BEGIN WordPress

    <IfModule mod_rewrite.c>
               
        #uploaded files + plugins
        RewriteRule ^(.*/)?files/$ index.php [L]
        RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
        RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

        # add a trailing slash to /wp-admin
        RewriteCond %{REQUEST_URI} ^.*/wp-admin$
        RewriteRule ^(.+)$ $1/ [R=301,L]

        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule . - [L]
        RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
        RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
        RewriteRule . index.php [L]
   
    </IfModule>

# END WordPress
... while your wordpress - instance should be in the folder: "/var/www/vhosts/YOUR-DOMAIN.COM/httpdocs", which would need "Additional NGINX directives" as for example:
Code:
rewrite ^/(.*/)?files/$ /index.php last;
if ($uri !~ ".*wp-content/plugins.*"){
    set $rule_1 1;
}
if ($rule_1 = "1"){
    rewrite ^/(.*/)?files/(.*) /wp-includes/ms-files.php?file=$2 last;
}
if ($uri ~ "^.*/wp-admin$"){
    set $rule_2 1;
}
if ($rule_2 = "1"){
    rewrite ^/(.+)$ /$1/ permanent;
}
if (-f $request_filename){
    set $rule_3 1;
}
if (-d $request_filename){
    set $rule_3 1;
}
if ($rule_3 = "1"){
    break;
}
rewrite ^/([_0-9a-zA-Z-]+/)?(wp-.*) /$2 last;
rewrite ^/([_0-9a-zA-Z-]+/)?(.*\.php)$ /$2 last;
rewrite /. /index.php last;
 
Last edited by a moderator:
Hello
its true i've changed my htaccess file to standart .
our friend wordpress has been located "/var/www/vhosts/YOUR-DOMAIN.COM/httpdocs/wp/"
site open now but image and script problem is still running..
i've add
location ~* ^/index\.php$ {
break;
}
try_files $uri $uri/ /wp/wp/index.php$is_args$args;
to Additional NGINX directives but i change last line to try_files $uri $uri/ /wp/index.php$is_args$args;
is there a problem ?
thank you so much but my problem dont resolve. i hope we'll fix
 
Hi netcomander,

pls. be informed, that the above suggestions depend to the used ".htaccess" - file. If you changed something, they are no longer valid as suggestion. Pls. always post BOTH ( CURRENT ".htaccess" - file AND CURRENT - used "Additional NGINX directives" ), if you need further help.

Plesk offers as well a wonderfull tool called "htaccess to nginx" - converter. You find this ( free ) Plesk - extension at the "Extension catalog" ( "Home > Extensions > Extensions Catalog" ), or at => htaccess to nginx over ext.plesk.com
 
My .htaccess
Code:
# BEGIN WordPress

    <IfModule mod_rewrite.c>
              
        #uploaded files + plugins
        RewriteRule ^(.*/)?files/$ index.php [L]
        RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
        RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

        # add a trailing slash to /wp-admin
        RewriteCond %{REQUEST_URI} ^.*/wp-admin$
        RewriteRule ^(.+)$ $1/ [R=301,L]

        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule . - [L]
        RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
        RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
        RewriteRule . index.php [L]
  
    </IfModule>

# END WordPress

# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache

and i've add this to
Additional nginx directives
Code:
location ~* ^/index\.php$ {
    break;
}
try_files $uri $uri/ /wp/wp/index.php$is_args$args;
 
Hi netcomander,

you can try TWO suggestions here:

First suggestion:
  • Use the the mentioned htaccess to nginx - converter on your domain. When installed on your server you have the choice to add the ( current ) content of your ".htaccess" - file in the textbox ".htaccess content" and you may click on the button "Convert to nginx" afterwards.
1.png


Second suggestion:
  • If the current ".htaccess" - content is
Code:
# BEGIN WordPress

    <IfModule mod_rewrite.c>
   
        #uploaded files + plugins
        RewriteRule ^(.*/)?files/$ index.php [L]
        RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
        RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

        # add a trailing slash to /wp-admin
        RewriteCond %{REQUEST_URI} ^.*/wp-admin$
        RewriteRule ^(.+)$ $1/ [R=301,L]

        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule . - [L]
        RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
        RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
        RewriteRule . index.php [L]
 
    </IfModule>

# END WordPress

# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
you might ( manual ) add as "Additional NGINX directives" ( when the wordpress instance is installed at "/var/www/vhosts/YOUR-DOMAIN.COM/httpdocs/wp/":
Code:
    location /wp {
        try_files $uri $uri/ /wp/index.php?$args;
        }
OR
Code:
    location /wp {
        if (!-e $request_filename){
            rewrite ^(.*)$ /wp/index.php break;
            }
        }

Pls. be aware, that IF you use additional wordpress plugins/themes, they might need additional "Additional NGINX directives" as well. Pls. see the plugin/theme - providers - information/discussion - site for such informations!
 
Last edited by a moderator:
i've tried htaccess convert to nginx i see this error .
Invalid nginx configuration: nginx: [emerg] invalid variable name in /var/www/vhosts/system/trio-agentur.com/conf/vhost_nginx.conf:24 nginx: configuration file /etc/nginx/nginx.conf test failed
 
Hi netcomander,

this is an absolute normal and correct behaviour, IF you used code, which can't be read by NGINX. In order to get help here, pls. POST the CONTENT from the mentioned file, where the build-in nginx - configtest detected misconfigurations. You will notice, that even the corresponding configuration line has been declared, where the misconfiguration has been detected:

Invalid nginx configuration: nginx: [emerg] invalid variable name in /var/www/vhosts/system/trio-agentur.com/conf/vhost_nginx.conf:24 nginx: configuration file /etc/nginx/nginx.conf test failed
 
if i've write
location /wp {
try_files $uri $uri/ /wp/index.php?$args;
}

its give HTTP 500 internal server error..


if i've write

location /wp {
if (!-e $request_filename){
rewrite ^(.*)$ /wp/index.php break;
}
}

its give 403 forbidden error
 
So sorry i dont understant what happened it was work same setting same directory sutructure i wasn't change anything intresting server update something and all wordpress site down..
 
Hi netcomander,

unfortunately, you only provide informations, when someone asked them directly... which makes it really hard to help you with suggestions. :(

In addition, you constantly change your current configuration, even while you wait for an answer to your post, which makes it nearly impossible for people willing to help you, to investigate your root causes. At the moment, the site loads fine, without issues. If you experience further issues, pls. INCLUDE ALL configuration files in your next post from the location "/var/www/vhosts/system/trio-agentur.com/conf" and pls. don't change something afterwards, so that people willing to help don't waste time with their investigations!
 
Back
Top