• 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

Issue Permission denied 403 Nginx Wordpress site migration

dmetallidis

New Pleskian
Hello,

Even though it is a common problem for many people and a lot of answers being given, I am still getting the error of "403 Forbidden" by ngnix.

The configuration file of my Nginx vhost is the following:

Code:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
    listen MY_IP:80;

    server_name mysite.name.com;
    server_name www.mysite.name.com;
    server_name ipv4.mysite.name.com;

    client_max_body_size 128m;

    root "/var/www/vhosts/mysite.name.com/httpdocs";
    access_log "/var/www/vhosts/system/mysite.name.com/logs/proxy_access_log";
    error_log "/var/www/vhosts/system/mysite.name.com/logs/proxy_error_log";

    #extension wp-toolkit begin

    #extension wp-toolkit end

    #extension letsencrypt begin
    location ~ ^/\.well-known/acme-challenge/ {
        root /var/www/vhosts/default/htdocs;

        types { }
        default_type text/plain;

        satisfy any;
        auth_basic off;
        allow all;

        location ~ ^/\.well-known/acme-challenge.*/\. {
            deny all;
        }
    }
    #extension letsencrypt end

    location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
        return 301 https://$host$request_uri;
    }

    location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
        alias /var/www/vhosts/mysite.name.com/web_users/$1/$2;
        fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass "unix:///var/www/vhosts/system/mysite.name.com/php-fpm.sock";
        include /etc/nginx/fastcgi.conf;

    }

    location ~ \.php(/.*)?$ {
        fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass "unix:///var/www/vhosts/system/mysite.name.com/php-fpm.sock";
        include /etc/nginx/fastcgi.conf;

    }

    location ~ /$ {
        index "index.html" "index.cgi" "index.pl" "index.php" "index.xhtml" "index.htm" "index.shtml";
    }

    add_header X-Powered-By PleskLin;

    include "/var/www/vhosts/system/mysite.name.com/conf/vhost_nginx.conf";
}

Please note that I have done the following:
  1. Changed the permission of files in 755 mode
  2. Added the user in both Plesk groups (psaserv, psacln)
  3. Restarted nginx

    Also, I have migrated WordPress database and is working just fine, as Plesk is able to scan that there is a WordPress installation.
Can you please elaborate as it is a common problem although with an uncommon solution :)
 
Make sure that the files and directories of the the website are owned by the user that is the main subscription user of the subscription.
 
Back
Top