Переписать правило для языкового префикса в пользовательский php в nginx - PullRequest
0 голосов
/ 01 июля 2019
I'm trying to call php interpreted with a parameter depending on the prefix of the domain : 

Что-то вроде: en.domain.com должен вызывать phpscript с параметром? Lang = en. Fr.domain.com должен вызывать phpscript с параметром? Lang = fr

server {
    root /var/www/html;
    listen 443 ssl;

    index index.php;
    server_name _;

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

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
            rewrite ^(/(fr|en|it|es|de))?/(.*)$ /$3?language=$2 break;
    }

    location ~ /\.ht {
            deny all;
    }
}
server {
    listen 80;
    server_name _;
    return 301 https://$host$request_uri;
}
...