Answer the question
In order to leave comments, you need to log in
How to block domains in nginx?
Dom1.com and dom2.com are proxied via curl to the server where nginx + apache is located on the domnginx.com domain, dom1.com
and dom2.com must be banned in nginx, the config below does not block
server {
listen *:80;
server_name domnginx.com;
location / {
proxy_pass http://6.6.6.6:8080;
}
if ($host ~* dom1.com|dom2.com) {
return 403;
break;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
if ($http_user_agent ~ (iPhone|Android) ) {
>>>blablalba
}
location ~ (testpage|test$) {
return 200 "Host - $host Http_Host - $http_host";
}
Host - domnginx.com Http_Host - domnginx.com
Answer the question
In order to leave comments, you need to log in
Please explain the phrase
Is it just that when you connect to dom[1,2].com, there are requests via cURL from php or another language to the domnginx.com domain?
Далее:
server {
listen *:80;
server_name domnginx.com;
location / {
proxy_pass http://6.6.6.6:8080;
}
if ($host ~* dom1.com|dom2.com) {
return 403;
break;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
if ($host ~* dom1.com|dom2.com) {
return 403;
break;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question