Add new comment

Bonsoir,

J'héberge mon site web sur une distribution yunohost à base de debian 10. Je souhaitai mettre en place la protection d'un dossier comme proposé dans votre tutoriel et comme esquissé dans ce forum. Malheureusement je bloque sur la directive location.

Voilà mon fichier de configuration; my_webapp__3.conf:

rewrite ^/site3$ /site3/ permanent;
location /site3/ {

# Path to source
alias /var/www/my_webapp__3/www/;

# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}

# Default indexes and catch-all
index index.html index.php;
try_files $uri $uri/ /site3/index.php?$args;

# Prevent useless logs
location = /site3/favicon.ico {
log_not_found off;
access_log off;
}
location = /site3/robots.txt {
allow all;
log_not_found off;
access_log off;
}

# Deny access to hidden files and directories
location ~ ^/site3/(.+/|)\.(?!well-known\/) {
deny all;
}

# Execute and serve PHP files
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm-my_webapp__3.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}

# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;

location /var/www/my_webapp__3/www/_ecam {
auth_basic “Zone Ecam”;
auth_basic_user_file /var/www/my_webapp__3/www/_ecam/.htpasswd;
}
}

Et mon fichier d'erreur partiel me renvoie systématiquement une erreur 46:

Feb 09 15:50:48 nginx[10529]: nginx: [emerg] location "/_ecam" is outside location "/site3/" in /etc/nginx/conf.d/wendling.xyz.d/my_webapp__3.conf:46

Auriez-vous une piste pour me guider vers une solution? En vous remerciant.

You must have Javascript enabled to use this form.