• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

How to connect nginx to work with a directory "web_users"?

Evgeny_Maltsev

New Pleskian
Hi.
How to connect nginx to work with directory web_users for some virtual host?
This directory contains two accounts (user1, user2) with a large amount of static content (files .jpg), the downloaded web users themselves. At the moment they are processed by Apache, which causes an additional load on the server.
In hosting configuration for virtual host "domain.tld" set:
document root: httpdocs. (That is, the "httpdocs" and "web_users" directories are on the same level).
In the web server configuration settings (in additional nginx directives) i can't use the directive "server" (refuses to save), where you can specify the location of the additional "document root" for nginx.
Help, please.
 
Have you tried add needed custom directives to the following file /var/www/vhosts/system/<domain_name>/conf/vhost_nginx.conf manually?
Do not forget to reconfigure vhosts after that with

# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain <domain_name>
 
I tried in web server configuration settings (in additional nginx directives), all with negative result:
1. vhost_nginx.conf:
location ~ ^/\~user1/pub/(.+\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|swf|tar|tgz|txt|wav|xls|xlsx|zip))$ {
alias /var/www/vhosts/domain.tld/web_users/user1/$1;
}
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.tld
2. vhost_nginx.conf:
location ~ ^/~user1/pub/(.+\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|swf|tar|tgz|txt|wav|xls|xlsx|zip))$ {
alias /var/www/vhosts/domain.tld/web_users/user1/$1;
}
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.tld

This "locations" added in vhost_nginx.conf, but include of /var/www/vhosts/system/domain.tld/conf/vhost_nginx.conf in file nginx_ip_default.conf in section "server" follows the directive
location ~ ^/(.*\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|swf|tar|tgz|txt|wav|xls|xlsx|zip))$ {
try_files $uri @fallback;
}

Here is section "server" from nginx_ip_default.conf (relevant to the issue directives):

server {
listen 1.1.1.1:80 default_server;

server_name domain.tld;
server_name www.domain.tld;
root "/var/www/vhosts/domain.tld/httpdocs";

if ($host ~* ^domain.tld$) {
rewrite ^(.*)$ http://www.domain.tld$1 permanent;
}

location / {
proxy_pass http://1.1.1.1:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}

location @fallback {
proxy_pass http://1.1.1.1:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}

location ~ ^/(.*\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|swf|tar|tgz|txt|wav|xls|xlsx|zip))$ {
try_files $uri @fallback;
}

include "/var/www/vhosts/system/domain.tld/conf/vhost_nginx.conf";
}

What is my mistake?
 
I try more without result:
1. vhost_nginx.conf:
location /~user1/pub/ {
alias /var/www/vhosts/domain.tld/web_users/user1/;
}
2. vhost_nginx.conf:
location /\~user1/pub/ {
alias /var/www/vhosts/domain.tld/web_users/user1/;

Any ideas?
 
Back
Top