Hi,
I have a website built with Angular and Java (Spring Boot) and a domain, abcdef.com. How can I configure it so that when users access abcdef.com, it points to Angular, and when they access abcdef.com/api, it points to Java? Essentially, abcdef.com/api should map to 127.0.0.1:8080 for the Java backend.
Normally, on a server without AAPanel, I would manually install Nginx and configure reverse proxy like this:
server {
listen 80;
server_name abcdef.com;
location / {
proxy_pass http://127.0.0.1:4200; # Angular app running on port 4200
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /api/ {
proxy_pass http://127.0.0.1:8080; # Java app running on port 8080
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
I don’t understand how Nginx works on AAPanel. Does AAPanel use a shared Nginx proxy instance for all websites, or does it create a separate Nginx instance for each website individually?
I would appreciate guidance on configuring reverse proxy on AAPanel. Thanks, happy coding!