Bonjour,

Voila je rencontre un petit problème de configuration ou d'aiguillage avec mon routing Nginx.

Ce que je fais

J'ai mis un widlcard sur mon nom de domaine, car chaque sous-domaine est associé automatiquement au nom de mes clients.
C'est à dire : clientA.mondomaine.be, clientB.mondomaine.be,... de ce côté cela fonctionne, je n'ai rien à faire, à chaque nouveau client, le sous-domaine fonctionne sans que j'ai besoin de le créer grâce au wildcard.

Ce que je veux

J'aimerais réserver des sous-domaines, par exemple : "admin.mondomaine.be", "analytics.mondomaine.be", "blog.mondomaine.be",...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

upstream socket_mondomaine {
    server 127.0.0.1:6001;
}

server {
    listen 443;
    server_name www.mondomaine.be;
    return 301 https://mondomaine.be$request_uri;
}

server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    server_name .mondomaine.be mondomaine.fr mondomaine.eu;
    root /home/forge/mondomaine.be/public;

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/mondomaine.be/123456/server.crt;
    ssl_certificate_key /etc/nginx/ssl/mondomaine.be/123456/server.key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/mondomaine.be/server/*;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/mondomaine.be-error.log error;

    error_page 404 /index.php;

    location /socket.io {
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_pass http://socket_mondomaine;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

    client_max_body_size 5000m;
}

server {
    listen 80;
    server_name analytics.mondomaine.be;
    root /home/forge/analytics.mondomaine.be/matomo;
}

Ce que j'obtiens

Dans Nginx, j'ai créé un nouveau "server block" et l'ai fait pointer vers un root différent, cela à fonctionner un moment mais maitenant, nginx me renvoi l'adresse "analytics.mondomaine.be" vers "mondomaine.be" et je ne sais plus accéder à l'adresse "analytics.mondomaine.be".


Merci d'avance pour votre aide.