Хочу сделать в одном файле nginx который находится у меня по пути
/etc/nginx/sites-available
два сервиса.
Вот как сейчас выглядит код nginx:
upstream admin_app_server {
server unix:/home/ubuntu/Project/admin.sock fail_timeout=0;
}
upstream api_app_server {
server unix:/home/ubuntu/Project/src/admin/rest_api.sock fail_timeout=0;
}
server {
listen 80;
server_name admin.project.tech www.admin.project.tech;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header Upgrade $http_upgrade;
proxy_redirect off;
proxy_pass http://admin_app_server;
}
}
server {
listen 80;
server_name api.project.tech www.api.project.tech;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header Upgrade $http_upgrade;
proxy_redirect off;
proxy_pass http://api_app_server;
}
}