Skip to content

Plesk

File permissions and ownership for web root

For Magento 2 the root should be part of the psacln group. The main httpdocs should be part of the psaserv group.

If you encounter 403 forbidden errors you can use Plesk to repair the permissions with plesk repair fs

Specify which PHP version to use

Web server

This can be changed in PHP settings.

Cron

You can control which version of PHP is used in a cron job for example by specifying the full path:

/opt/plesk/php/<version>/bin/php

Create Subdomain

  1. On 'Websites & Domains' select 'Add Subdomain'.
  2. Enter your subdomain name
  3. Add your subdomain root folder
  4. Click 'OK'

And that's it!

Redirecting to other domain

  • Create a new domain - Not an alias
  • Enable lets encrypt for the domain
  • Disable Proxy mode
  • Add the following additional nginx directives
## Hack to get everything to redirect successfully
if ($uri !~ "^/.well-known/") {
    set $rewrite_to_index 1;
}

############################################
## rewrite everything else to index.php
if ($rewrite_to_index = "1") {
    return 301 https://www.example.com$request_uri;
}

HTTP/2

Make sure you have nginx web server updated to the latest version and running. You can do this on the Tools & Settings -> Server Components and the Tools & Settings -> Services Management pages.
Login to your server via SSH under root and enable HTTP/2 support in Plesk using the following command line utility:

$ plesk bin http2_pref enable
If you wish to return to HTTP 1.x and to disable HTTP/2, please use the following command:
$ plesk bin http2_pref disable
Plesk support documentation

Switch PLESK from nginx Proxy Mode to just nginx

  • First you will have to make sure you have access to an admin account.
  • Go to Subscriptions -> [domain name] -> PHP Settings and choose FPM application served by nginx
  • Go to Apache & nginx Settings -> nginx settings and untick Proxy mode and Serve static files directly by nginx
  • As soon as you make these changes, the site will no longer work. You will need to add the Magento 1 nginx config in Additional nginx directives
    ############################################
    ## uncomment next line to enable light API calls processing
    #rewrite ^/api/([a-z][0-9a-z_]+)/?$ /api.php?type=$1 break;
    
    ############################################
    ## rewrite API2 calls to api.php (by now it is REST only)
    rewrite ^/api/rest /api.php?type=rest last;
    
    ############################################
    ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
    if ($request_method ~ "^TRAC[EK]") {
        return 405;
    }
    
    ############################################
    ## always send 404 on missing files in these folders
    if ($uri !~ "^/(media|skin|js)/") {
        set $rewrite_to_index 1;
    }
    
    ###########################################
    ## Deny access to release notes to prevent disclosure of the installed Magento version
    if ($uri ~* "/RELEASE_NOTES.txt") {
        return 404;
    }
    
    # Don't rewrite if file exists
    if (-e $request_filename) {
        set $rewrite_to_index 0;
    }
    
    ############################################
    ## rewrite everything else to index.php
    if ($rewrite_to_index = "1") {
        rewrite / /index.php;
    }
    
    ############################################
    ## Prevent character encoding issues from server overrides
    ## If you still have problems, use the second line instead
    charset off;
    #charset utf-8;
    
    ############################################
    ## Add default Expires header
    ## http://developer.yahoo.com/performance/rules.html#expires
    expires 365d;
    
    ##Taken from http://wiki.nginx.org/Magento
    # Hide the system directories
    location ~ ^/(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ {
        internal;
    }