How do i host static vinxi build with nginx so the routing works, is there any guide?

Official docs are pretty much WIP.
4 Replies
Madaxen86
Madaxen866mo ago
Well, like any other nodejs app. By default vinxi will build nitros standard nodejs app. So running „npm run start“ you are starting the server. In the nginx config you just map the port to the domain. So something like this should be in your nginx config ‘‘‘ location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
} ‘‘‘
Root:3000
Root:3000OP6mo ago
Static vinxi gives html js css output, why do I need node js server for?
bigmistqke
bigmistqke6mo ago
i think they missed the static part. if it's just about serving static files, it's just like any other other nginx setup:
server {
listen 80;
server_name mywebsite.com; # Replace with your domain name or IP address

root /var/www/mywebsite; # Path to your website directory
index index.html;

location / {
try_files $uri $uri/ =404;
}
}
server {
listen 80;
server_name mywebsite.com; # Replace with your domain name or IP address

root /var/www/mywebsite; # Path to your website directory
index index.html;

location / {
try_files $uri $uri/ =404;
}
}
Root:3000
Root:3000OP6mo ago
but the nested and dynamic [routes] doesnt work returns 404 This worked
server {
listen 80;
server_name localhost;
index index.html index.htm;

location / {
try_files $uri $uri/ /index.html;
}

}
server {
listen 80;
server_name localhost;
index index.html index.htm;

location / {
try_files $uri $uri/ /index.html;
}

}
Want results from more Discord servers?
Add your server