I'm using Express 4.10, nginx, ubuntu 16.04 LTS and I want to create a javascript folder in my public folder.
public/js/myfile.js
I see lot of question on stackoverflow about this but I always get a 404 on my javascript file.
Then here is my html code:
<script src="js/login.js" type="text/javascript"/>
And in my node.js file I have this :
app.use(express.static(path.join(__dirname, '/public')));
Here is my nginx node configuration
upstream node {
server 127.0.0.1:3000;
keepalive 8;
}
location ~ ^/(node|socket\.io) {
proxy_pass http://example.com:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
Thanks.