Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feelchi1star/0124e5d18215f75105a11ce940e5293a to your computer and use it in GitHub Desktop.
Save feelchi1star/0124e5d18215f75105a11ce940e5293a to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
#ONE FOR EACH NEXTJS APP AND SUBDOMAIN
#BIKES - PORT 3001
location /bikes/_next/static {
autoindex on;
alias /home/ubuntu/bikes/.next/static;
}
location /bikes/api {
proxy_pass http://localhost:3001/api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;proxy_cache_bypass $http_upgrade;
}
location /bikes {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
#CARS - PORT 3002
location /cars/_next/static {
autoindex on;
alias /home/ubuntu/cars/.next/static;
}
location /cars/api {
proxy_pass http://localhost:3002/api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;proxy_cache_bypass $http_upgrade;
}
location /cars {
proxy_pass http://localhost:3002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
#TRUCKS - PORT 3003
location /trucks/_next/static {
autoindex on;
alias /home/ubuntu/trucks/.next/static;
}
location /trucks/api {
proxy_pass http://localhost:3003/api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;proxy_cache_bypass $http_upgrade;
}
location /trucks {
proxy_pass http://localhost:3003;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment