Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return 404 Not Found when refreshing the url on browser after running with nginx #6

Open
qweisong opened this issue Apr 2, 2020 · 2 comments

Comments

@qweisong
Copy link

qweisong commented Apr 2, 2020

Hello:

The projects are building and running well, but got one big problem. It will return 404 Not Found when refreshing the url on browser. For example, if just open the url: http://localhost:8081/vue#/, it will show the error. It is because of the routing mechanism or because of the nginx config?

here is the nginx conf file:
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile        on;
keepalive_timeout  65;

#gzip  on;

server {
    listen       8081;
    server_name  localhost;

    #location /vue {
    #root   E:\sunDemo1\sop\dist;
    #index  index.html index.htm;
    #try_files $uri /index.html;
    #   proxy_pass  http://localhost:3000/;
    #}
    
    location / {
        root   E:\sunDemo1\sop\dist;
        index  index.html index.htm;
    #    proxy_pass  http://localhost:3000/;
    }
}

server {
    listen       3000;
    server_name  localhost;

    location / {
        root   E:\sunDemo1\vue\dist;
        index  index.html index.htm;
    }
}

}

@zenjava
Copy link
Member

zenjava commented Apr 15, 2020

Are you open http://localhost:8081/ is '404 Not Found' too ?

@qweisong
Copy link
Author

With 8081, it works well. It only happens when refreshing the url of subprojects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants