Skip to content

Instantly share code, notes, and snippets.

@skolhustick
Last active March 31, 2023 07:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save skolhustick/dcbec823ad78c43380112d3136e028cf to your computer and use it in GitHub Desktop.
Save skolhustick/dcbec823ad78c43380112d3136e028cf 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;
}
}
@ankurpata
Copy link

ankurpata commented Jul 11, 2021

What about static images from the NextJS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment