Код: Выделить всё
server {
listen 80 default_server;
add_header Content-Security-Policy "frame-ancestors 'self' https://${content_security_policy_url}";
add_header X-XSS-Protection "1; mode=block";
root /var/www/prod/public_html;
include /etc/nginx/fcgiwrap.conf;
include /etc/nginx/mime.types;
index index.php index.sec index.html;
error_page 405 =200 $uri;
# Create route of /dashboard to the domain name dashboard
location /dashboard {
proxy_pass http://$host/dashboard;
}
location / {
try_files $uri $uri/ /index.php?$args;
# set_real_ip_from ::/0;
# set_real_ip_from 0.0.0.0/0;
# real_ip_header X-Forwarded-For;
fastcgi_param HTTPS $fastcgi_param_https_variable;
error_page 500 502 503 504 /500.html;
}
location ~ \.php|\.sec$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param HTTPS $fastcgi_param_https_variable;
# fastcgi_param sitePath "https://$host/";
include fastcgi_params;
}
location = /500.html {
root /usr/share/nginx/html;
internal;
}
}
Пример: в URL-адресе, если я нажимаю abc.test.com в браузере ,$_SERVER['SERVER_NAME'] должно возвращать то же значение или xyz.abc.com, $_SERVER['SERVER_NAME'] должно быть xyz.abc.com.
Я попробовал следующее
1.
Код: Выделить всё
server {
server_name ~^(?.+)\.abc\.com$;
}
with this solution, If I print $_SERVER['SERVER_NAME'] in code, it doesnt replace the regex with actual value
2. location ~ \.php|\.sec$ {
fastcgi_param SERVER_NAME $http_host
}
This will not set the expected data, SERVER_NAME will be empty
fastcgi_param SERVER_NAME $server_name;
PHP и NGINX работают под Docker-контейнером< /p>
Будет здорово, если я получу информацию о том, как установить S_SERVER['SERVER_NAME'] со значением HTTP_HOST
TIA
Подробнее здесь: https://stackoverflow.com/questions/784 ... host-value
Мобильная версия