Answer the question
In order to leave comments, you need to log in
How to set up 2 servers on a local network on the same domain?
There are two servers under the same domain, united by a local network (s0.server.net and s1.server.net - on the phone), you need to configure s1 so that if it does not have the desired subdomain, then it transfers to s0. As I understand it, this can be done through proxy_pass, but it doesn’t work out very well for me, it gives a 503 error
. Settings s1:
worker_processes 4;
error_log /data/data/nginx/servers/CCX/logs/nginxerror.log;
events {
worker_connections 1024;
}
http {
include /data/data/nginx/base/conforig/mime.types;
default_type application/octet-stream;
include /data/data/nginx/base/conforig/fastcgi.conf;
access_log /data/data/nginx/servers/CCX/logs/nginxaccess.log;
error_log /data/data/nginx/servers/CCX/logs/nginxerror.log;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name server.net *.server.net;
root $subdomain;
set $subdomain "";
autoindex on;
index index.html index.htm index.php;
if ($host ~* ^([a-z0-9-\.]+)\.server.net$) {
set $subdomain /storage/emulated/0/www/$1.server.net;
}
if ($host ~* ^server.net$) {
set $subdomain /storage/emulated/0/www/server.net;
}
location / {
proxy_pass http://192.168.1.47;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* \.php$ {
fastcgi_pass 0.0.0.0:9009;
include /data/data/nginx/base/conforig/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question