B
B
Bogdan Bembenok2016-02-26 01:12:59
Nginx
Bogdan Bembenok, 2016-02-26 01:12:59

Angular html5mode works but gives 404 on reload, what's the problem?

I added a line to my app.js file
$locationProvider.html5Mode(true);
after that the "#" disappeared, the site starts up, but when the page is reloaded, it says "Cannot get", in nginx:

location ~* \.(ttf|eot|svg|woff|jpg|jpeg|gif|png|ico|css|zip|tgz|tar|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|avi|swf|php)$ { 
root /wwwmywebsite/public; 
expires 360s; 
add_header Cache-Control public; 
} 

location / { 
proxy_pass http://127.0.0.1:5000; 
expires -1; 
add_header Pragma "no-cache"; 
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; 
root /www/mywebsite/public; 
try_files $uri $uri/ /index.html; 
} 
}

Help(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_ _, 2016-02-26
@AMar4enko

You have proxy_pass in location /, which seems to work before try_files there are nuances with regexp, but we will omit them).

A
Alexander, 2016-02-26
@w4r_dr1v3r

If with a simple poke, then return to the point at which everything worked and use the elimination method to sort through all the additions to the code that you made until you find the variable that causes everything to fall. Her relationship with nginx is something to smoke. From experience I can say that you still have a few. wait hours anyway - until Toaster wakes up. I'm a beginner, I can't tell you much, but I would spend these hours on just such a "scientific poke" method, by the way, it rules at all times;))
Good luck!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question