Skip to content

[Help]: How can I setup vite config with nginx to serve project at /app #19168

Closed Answered by iserioton
iserioton asked this question in Q&A
Discussion options

You must be logged in to vote

The issue was related to my Nginx configuration. Since I was using alias to serve the Vite React build, Nginx was loading the default index.html. To resolve this, I explicitly specified /app/index.html in the configuration. Here's the updated location block:

# Vite React app
    location /app {
        alias /var/www/html/myapp/dist/;
        index index.html;
        try_files $uri /app/index.html;
    }

This ensures the correct fallback behavior for routes under /app.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by iserioton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
1 participant
Converted from issue

This discussion was converted from issue #19167 on January 09, 2025 04:48.