What I want to do is like this,
Change the destination of proxy depending on domain name.
However it shows the error
a duplicate default server for 0.0.0.0:8090 in /etc/nginx/sites-enabled/default:7
default.conf is here
server{
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name exmaple.com;
location / {
proxy_pass http://127.0.0.1:8021/;
include /var/www/html/exmaple/current/uwsgi_params;
}
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name exmaple2.com;
location / {
proxy_pass http://127.0.0.1:8022/;
include /var/www/html/exmaple2/current/uwsgi_params;
}
}
I should not duplicate the server delective.
However how can I use multiple proxy_pass.
CodePudding user response:
Remove default_server
from the first or the second server config.