• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.

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