Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Instead of slang, would you like to describe the task in a human way, to match it in your understanding, do you want to compare them or what? Or you need to pass only the third level domain, if so, then through variables, something like this:
map $host $host_wo_www {
default $host;
~^www\.(?P<wo_www>.+)$ $wo_www;
}
server {
server_name ~^(?:www\.)?(?P<host_wo_www>.+)$;
server_name_in_redirect off;
resolver 127.0.0.1;
root /var/www/$host_wo_www;
#Передавать на php-fpm примерно так, тут пример передачи для апача, для передачи на php-fpm суть та-же в принципе.
location / {
proxy_redirect off;
proxy_set_header Host $host_wo_www;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffers 8 2m;
proxy_buffer_size 10m;
proxy_busy_buffers_size 10m;
proxy_pass http://backend; # В качестве бэкенда вешайте что нравится.
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question