• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question How to create directory alias

scool

Basic Pleskian
Hello everyone. I am trying to create a directory alias on plesk , so that when someone navigates to example.com/somename , it will be accessed via /var/www/vhosts/domain.com/folder/foldername. this folder is outside of httpdocs.

On Apache & nginx Settings , i have created a rule Alias /foldername/ /var/www/vhosts/domain.com/folder/foldername/

but when you are trying to navigate to this page , it justs downloads the file

has anyone used directory alias?

unfortunatly plesk support is not very responsive , i am waiting 8hours+ for a response
 
Referring to PHP files outside of the document root of the domain is not supported by Plesk. That is expected behavior which is a consequence of virtual host isolation measures.
 
Thank you for your reply Igor,
We have an application that we dont want to be publicly accessible, how would you suggest to implement it with plesk ?
 
Well, by creating an alias in Nginx or Apache to a directory, even if this directory is outside of httpdocs, the contents of the directory would become publicly accessible. I assume this is not what you want.

If you would like your application to access directories and files that are not publicly accessible, then this must be accomplished by the application itself to begin with. There are popular web applications out there that work like this, let's take Moodle as an example. As you may know, the recommended way of installing Moodle is to keep the Moodle's data directory outside of web accessible space, while the core of the application remains accessible.

Under Plesk, one would do this:

- install Moodle and any plugins and themes under httpdocs
- the contents of httpdocs (but not httpdocs itself) can be owned as user and group root, with standard access rights of 755 for subdirectories and 644 for files
- create a new directory outside of httpdocs, e.g. /var/www/vhosts/example.com/moodle_data_dir
- set this moodle_data_dir to be owned as example.com's system user and group psaserv, access rights 750 (so same as httpdocs)
- the contents of the moodle_data_dir should be owned by the example.com's system user and group psacln, with standard access rights of 755 for subdirectories and 644 for files.

In Plesk GUI, under the example.com PHP Settings, set the open_basedir to be:
Code:
{DOCROOT}{/}{:}{TMP}{/}:{WEBSPACEROOT}{/}moodle_data_dir

Note that we prefer to set the open_basedir to DOCROOT (that's httpdocs) ant TMP and only allow additional directories as needed.
 
Well, by creating an alias in Nginx or Apache to a directory, even if this directory is outside of httpdocs, the contents of the directory would become publicly accessible. I assume this is not what you want.

If you would like your application to access directories and files that are not publicly accessible, then this must be accomplished by the application itself to begin with. There are popular web applications out there that work like this, let's take Moodle as an example. As you may know, the recommended way of installing Moodle is to keep the Moodle's data directory outside of web accessible space, while the core of the application remains accessible.

Under Plesk, one would do this:

- install Moodle and any plugins and themes under httpdocs
- the contents of httpdocs (but not httpdocs itself) can be owned as user and group root, with standard access rights of 755 for subdirectories and 644 for files
- create a new directory outside of httpdocs, e.g. /var/www/vhosts/example.com/moodle_data_dir
- set this moodle_data_dir to be owned as example.com's system user and group psaserv, access rights 750 (so same as httpdocs)
- the contents of the moodle_data_dir should be owned by the example.com's system user and group psacln, with standard access rights of 755 for subdirectories and 644 for files.

In Plesk GUI, under the example.com PHP Settings, set the open_basedir to be:
Code:
{DOCROOT}{/}{:}{TMP}{/}:{WEBSPACEROOT}{/}moodle_data_dir

Note that we prefer to set the open_basedir to DOCROOT (that's httpdocs) ant TMP and only allow additional directories as needed.


Had to chime in after countless hours of trying to get a lavarel app (specifically freescout) to work and going back and forth with Plesk support with phone calls and tickets. After trying to modify nginx ROOT directive (which cannot be done unfortunately with plesk even when you create custom nginx hosts), your solution with open base dir was the actual solution. Apps that require outside folders from the web host need to access hidden files with the correct file permissions as you mentioned. Your solution with open base dir option in PHP settings is what makes it work. Youd have to do the following setup below to get it to work. Here is an example with the lavarel app called Freescout:

1. Set domain folder to httpdocs/domain.com/public (public is lavarels generic name for public html) in the domains Host settings in plesk.
2. Copy your lavarel system files to httpdocs/domain.com
3. Copy your lavarel apps public folder files to httpdocs/domain.com/public - Be careful here to make sure to do this after the first step. If you do this before the first step, then plesk will delete ALL files in the public folder, which means you will lose all of your laravel app public files.
4. Modify your open basedir to allow to php to read and write to httpdocs/domain.com (my configuration to do this in openbase dir was:
{WEBSPACEROOT}{/}httpdocs{/}domain.com

Now when you run you lavarel app install, css, scripts and everything else will work as intended. This should work for all other apps that require files and folders outside from web root of your plesk domain. Great job Ales, you should sticky this somehow on the forums and or plesks support questions. I am sure many others have this issue and have probably given up on installing specific software.
 
Back
Top