Giter Site home page Giter Site logo

Comments (3)

Shyam-Chen avatar Shyam-Chen commented on May 20, 2024 1

Here is an Nginx configuration I had a long time ago, sharing it with you:

server {
  server_name ${NGINX_HOST};
  listen ${NGINX_PORT};

  root /usr/share/nginx/html;
  index index.html;

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

  location /service-worker.js {
    add_header Cache-Control "max-age=0,no-cache,no-store,must-revalidate";
  }

  client_max_body_size 4G;
  keepalive_timeout 10;
}

If you still can't make it work successfully, you can consider downgrading the mode of Vue Router to createWebHashHistory. This issue pertains to Nginx and SPA (Single Page Application). I will close the issue.

from vue-starter.

Shyam-Chen avatar Shyam-Chen commented on May 20, 2024

You need to configure Single Page Applications in Nginx, and I suppose the possible configuration could be:

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

I personally use Caddy, and below is my configuration:

https://github.com/Shyam-Chen/Vue-Starter/blob/main/Caddyfile#LL6C32-L6C32

from vue-starter.

swallowcc avatar swallowcc commented on May 20, 2024

Thank you for your prompt response.

In fact, I currently have a requirement to integrate the built files into a Java project, which is why I was testing with nginx.

However, after making the modifications based on the configuration values you provided, the situation has now changed to a 500 error. It seems that the situation has worsened.

from vue-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.