• 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!
  • 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.

Issue Change Root in ngnix directives

Lrnt

Basic Pleskian
I am running Plesk Onyx Version 17.8.11 on Debian 9.8‬.
I want to specify a custom root location for a subdomain.
This works well in Apache but not in nginx.

"root /var/www/vhosts/{mydomain}/httpdocs;" under nginx directives on the subdomain ({mysubdomain}) configuration give the error "ginx: [emerg] "root" directive is duplicate in /var/www/vhosts/system/{mysubdomain}/conf/vhost_nginx.conf:2 nginx: configuration file /etc/nginx/nginx.conf test failed

Has someone a solution for this?
Thanks :)

Temporary fix: disable nginx. but that's not a solution
 
Last edited:
When you go to Hosting Settings of your subdomain you can change the Document root there. Or it's not enough?
 
Thank you @IgorG but unfortunately no, it's not enough! Here why:

  • I host a website on mywonderful.site
    Note: this is not a real domain, just a subscription, not directly accessible over the internet without a domain
  • I set up several domains which need to access mywonderful.site
  • Then I use the domain name to init database, data, theme etc.

So as you can understand, the document root is in another subscription than the domain so not accessible in hosting settings.

Here is my Apache directive to do this without nginx, maybe it will help to understand:

Code:
DocumentRoot "/var/www/vhosts/mywonderful.site/httpdocs"
<Directory /var/www/vhosts/mywonderful.site/httpdocs>
    <IfModule mod_proxy_fcgi.c>
        <Files ~ (\.php$)>
            SetHandler proxy:unix:///var/www/vhosts/system/mywonderful.site/php-fpm.sock|fcgi://127.0.0.1:9000
        </Files>
    </IfModule>
</Directory>

This is working without nginx. I just want to make it working with it but I can not change document root in nginx directive: "nginx: [emerg] "root" directive is duplicate..."
 
@Lmt,

this part

  • I host a website on mywonderful.site
    Note: this is not a real domain, just a subscription, not directly accessible over the internet without a domain
  • I set up several domains which need to access mywonderful.site
  • Then I use the domain name to init database, data, theme etc.
So as you can understand, the document root is in another subscription than the domain so not accessible in hosting settings.

of your response is simply indicating that you want to

- use other domains to proxy your mywonderful.site domain,
- use or run an application on the mywonderful.site domain,

and, in summary, you only need to

a) use Nginx as proxy, in the sense of domain x, domain y, domain z etc. proxying to the mywonderful.site domain,

b) configure Nginx properly - this is a bit difficult, since you will probably need custom Nginx config templates.

You surely do not need Apache and/or Apache config.

Nevertheless, the thing I do not understand : why do you not use domain aliases?

In essence, a domain setup as a domain alias would solve your problem without any modification : traffic to the domain alias would simply be redirected properly to your one domain called mywonderful.site - with the additional advantage that you can separately use services (like mail service) on the domain aliases.

Kind regards..........
 
Back
Top