Nginx domain name configuration for react and spring boot application
- Manbodh ratre
- Nov 28, 2023
- 1 min read
http {
# React App configuration
server {
listen 80;
server_name domain_name www.domain_name;
location / {
proxy_pass http://127.0.0.1:3000;
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;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
# Spring boot configuration
server{
listen 80;
server_name subdomain_name www.subdomain_name;
location / {
proxy_pass http://127.0.0.1:8000;
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;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
}
Make sure your react app and spring application is up and running
Comments