IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Administration système Discussion :

Paramètre Nginx fonctionnant sous AlmaLinux (RHEL) mais plus sous Debian


Sujet :

Administration système

  1. #1
    Membre confirmé
    Homme Profil pro
    Architecte sys d'info géographique
    Inscrit en
    Juin 2011
    Messages
    64
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Architecte sys d'info géographique
    Secteur : Transports

    Informations forums :
    Inscription : Juin 2011
    Messages : 64
    Par défaut Paramètre Nginx fonctionnant sous AlmaLinux (RHEL) mais plus sous Debian
    Bonjour,

    j'avais un certain paramétrage qui fonctionnait sous AlmaLinux, un dérivé RHEL, mais plus du tout sur Debian.

    Il me permettait d'accéder autant à https://website.fr/benelux (code 1) qu'à https://website.eu/benelux/base+gen+...27+y2.5159+z6+ (code 2), les paramètres étant passés en PHP/javascript.

    Voici le paramétrage Nginx en question :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    location ~ /benelux {
    rewrite ^/(.*)$ /benelux/index.php?params=$1 last; }
    Pour chaque accès à https://website.fr/benelux et le code 2 aussi, le résultat est dans le navigateur un 500 Internal Server Error et dans le log nginx :

    2024/07/26 11:26:01 [error] 326299#326299: *663478 rewrite or internal redirection cycle while processing "/benelux/index.php", client: 97.036.66.2, server: website.fr, request: "GET /benelux/ HTTP/2.0", host: "website.fr"
    En commentant / supprimant le paramétrage Nginx :
    l'accès à https://website.fr/benelux est possible
    mais le code 2, en toute logique ne fonctionne plus : The page you are looking for is not found.

    Je voudrais donc corriger ma règle Rewrite avec votre aide svp.

  2. #2
    Membre confirmé
    Homme Profil pro
    Architecte sys d'info géographique
    Inscrit en
    Juin 2011
    Messages
    64
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Architecte sys d'info géographique
    Secteur : Transports

    Informations forums :
    Inscription : Juin 2011
    Messages : 64
    Par défaut
    La totalité du code


    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
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    # For more information on configuration, see:
    #  d * Official English Documentation: http://nginx.org/en/docs/
    #   * Official Russian Documentation: http://nginx.org/ru/docs/
    user www-data;
    #user nginx;
    worker_processes auto;
    error_log /var/log/nginx/error.log;
    pid /run/nginx.pid;
     
    # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;
     
    events {
        worker_connections 1024;
    }
     
    http {
    client_max_body_size 20m;
     
     
    disable_symlinks off;
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
     
        access_log  /var/log/nginx/access.log  main;
     
        sendfile            on;
        tcp_nopush          on;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 2048;
     
        include             /etc/nginx/mime.types;
        default_type        application/octet-stream;
     
        # Load modular configuration files from the /etc/nginx/conf.d directory.
        # See http://nginx.org/en/docs/ngx_core_module.html#include
        # for more information.
        include /etc/nginx/conf.d/*.conf;
     
        server {
            listen       80 default_server;
            listen       [::]:80 default_server;
            server_name  _;
            root         /usr/share/nginx/html;
    # root /home/useraaa/html;
     
     
    	#	try_files $uri $uri/ /index.php?$args;
    return 301 https://website.fr$request_uri;
    #try_files $uri $uri/ =404;
    add_header Access-Control-Allow-Origin *;
    access_log /var/log/nginx/80.access;
    error_log /var/log/nginx/80.error;
     
            # Load configuration files for the default server block.
            include /etc/nginx/default.d/*.conf;
     
            location / {
     
    	     try_files $uri $uri/ /index.php?$args; 
     
     
    	}
            error_page 404 /404.html;
                location = /40x.html {
            }
            error_page 500 502 503 504 /50x.html;
                location = /50x.html {
            }
     
     
    	location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm/www.sock;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
        }
     
    # Settings for a TLS enabled server.
     
        server {
            listen       443 ssl http2 default_server;
            listen       [::]:443 ssl http2 default_server;
            server_name  website.fr www.website.fr;
            root         /usr/share/nginx/html;
    # root /home/useraaa/html;
     
    client_max_body_size 20m;
     disable_symlinks off;
     
    access_log /var/log/nginx/443.access;
    error_log /var/log/nginx/443.error;
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
    add_header Access-Control-Allow-Origin *;
    	ssl_certificate "/ssl/website_fr_chain.crt";
    ssl_certificate_key "/ssl/server.key";
            ssl_session_cache shared:SSL:1m;
            ssl_session_timeout  10m;
    	#       ssl_ciphers PROFILE=SYSTEM;
            ssl_prefer_server_ciphers on;
     
            # Load configuration files for the default server block.
            include /etc/nginx/default.d/*.conf;
     
            location / {
    rewrite ^/map-(.*)$ /index.php?mymap=$1 last;
            }
            error_page 404 /404.html;
                location = /40x.html {
            }
            error_page 500 502 503 504 /50x.html;
                location = /50x.html {
            }
     
     
    # location ^~ /gallery {
    # root /usr/share/nginx;
    #index index.php;
    # try_files $uri $uri/ /gallery/index.php;
     
     
    #location ~ \.php$ {
    #root /usr/share/nginx;
    #try_files $uri =404;
    #include fastcgi_params;
    #fastcgi_pass unix:/run/php-fpm/www.sock;
    #fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #fastcgi_index index.php;
    #fastcgi_param SCRIPT_FILENAME $document_root$request_filename;
    #        }}
     
    #location ~ ^(/gallery/)(?<script_name>.[^\/]+)(?<path_info>.*)$ {
    #  include fastcgi_params;
    #  set $php_extension ".php";
    #  fastcgi_param SCRIPT_FILENAME /usr/share/nginx/gallery/$script_name$php_extension;
    #  fastcgi_param SCRIPT_NAME /gallery/$script_name$php_extension;
    #  fastcgi_param PATH_INFO $path_info;
    #  fastcgi_param PATH_TRANSLATED $path_info;
    #  fastcgi_pass 127.0.0.1:9000;
    #}
     
     
    location /test {
    root /usr/share/nginx;
    index index.php;
     
    #location ~ \.php$ {
    #include fastcgi_params;
    #fastcgi_pass unix:/run/php-fpm/www.sock;
    #fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #fastcgi_index index.php;
    #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #}  }
     
     
    location ~ \.php$ {
     
         	include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        #   fastcgi_index index.php;
        # try_files $uri $uri/ /index.php =404;
     
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     
    }}
     
     
     
    location ~ /antillesguyane {
    rewrite ^/(.*)$ /antillesguyane/index.php?params=$1 last; }
     
    location ~ /benelux {
    rewrite ^/(.*)$ /benelux/index.php?params=$1 last; }
     
    location ~ /brasil {
    rewrite ^/(.*)$ /brasil/index.php?params=$1 last; }
     
    location ~ /deutschland {
    rewrite ^/(.*)$ /deutschland/index.php?params=$1 last; }
     
    #location ~ /france {
    #rewrite ^/(.*)$ /france/index.php?params=$1 last; }
     
    location ~ /icelandfaroe {
    rewrite ^/(.*)$ /icelandfaroe/index.php?params=$1 last; }
     
    #location ~ /italia {
    #rewrite ^/(.*)$ /italia/index.php?params=$request_uri last; }
     
    #location ~ /ukir {
    #rewrite ^/(.*)$ /ukir/index.php?params=$1 last; }
     
    location ~ /usa {
    rewrite ^/(.*)$ /usa/index.php?params=$1 last; }
     
    #location ~ \.php$ {
    #include fastcgi_params;
    #fastcgi_pass unix:/run/php-fpm/www.sock;
    #fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #fastcgi_index index.php;
    #fastcgi_param SCRIPT_FILENAME document_rootdocument\_rootdocument_rootfastcgi_script_name;  
    #	}
     
    location ~ \.php$ {
    	#try_files $uri =404;
        	include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
     
     
     
    location /geoserver {
    proxy_pass http://localhost:8080/geoserver;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect off;
     
    }
     
    #location /gallery/ {
    #proxy_pass http://localhost:8081/gallery/;
    #proxy_set_header Host $host;
    #proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_redirect off;
     
    #fastcgi_pass unix:/run/php-fpm/www.sock;
     
    #location ~ \.php {
    #    proxy_pass http://localhost:8081;
    #}
     
    #}
     
     
    }
    }

  3. #3
    Membre confirmé
    Homme Profil pro
    Architecte sys d'info géographique
    Inscrit en
    Juin 2011
    Messages
    64
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Architecte sys d'info géographique
    Secteur : Transports

    Informations forums :
    Inscription : Juin 2011
    Messages : 64
    Par défaut
    Help ! Help, I need somebody, Help, not just anybody, Help, you know I need someone, Help !

    When I was younger, so much younger than today,
    I never needed anybody's help in any way.
    But now these days are gone, I'm not so self assured
    Now I find I've changed my mind and I opened up the doors.

    Help me if you can, I'm feeling down
    And I do appreciate you being round
    Help me get my feet back on the ground
    Won't you please, please help me !

Discussions similaires

  1. Réponses: 7
    Dernier message: 17/03/2016, 18h20
  2. [LibreOffice][Base de données] boutons de formulaires fonctionnent sous openoffice mais plus sous libreoffice
    Par melodie69 dans le forum OpenOffice & LibreOffice
    Réponses: 4
    Dernier message: 04/12/2015, 07h37
  3. popup fonctionne sous Mozilla mais pas sous IE
    Par pimpmyride dans le forum Langage
    Réponses: 3
    Dernier message: 30/05/2006, 21h45
  4. [JMF] Code fonctionnant sous Linux mais pas sous XP
    Par Monsieur_Max dans le forum Multimédia
    Réponses: 4
    Dernier message: 25/05/2006, 18h57
  5. Réponses: 4
    Dernier message: 27/09/2005, 22h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo