http {
...
upstream apache {
server 127.0.0.1:8080;
}
server {
listen 80 default_server;
server_name 123.456.789.012;
location / {
proxy_pass http://apache;
}
}
server {
listen 80;
server_name site1.ru;
...
location / {
proxy_pass http://apache;
}
}
server {
listen 80;
server_name site2.ru;
...
location / {
proxy_pass http://apache;
}
}
}
upstream backend {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 12.23.34.45; /* внешний ip-адрес сервера */
location / {
proxy_pass http://backend/;
proxy_redirect off;
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location ~ /\.ht {
deny all;
}
}