Reputation: 397
i've an nginx container used as front-end for a web application.
This is my config file:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
root /usr/share/nginx/html/shaka-player-master/demo;
index index.html index.htm;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
If i point to localhost:port it returns me correctly /usr/share/nginx/html/shaka-player-master/demo/index.html ... but i have a problem:
This application, a dash library, needs i run a python script that generate files names "deps.js", base.js and others, hosted in:
/usr/share/nginx/html/shaka-player-master/third_party/closure/goog/base.js
/usr/share/nginx/html/shaka-player-master/dist/deps.js
/usr/share/nginx/html/shaka-player-master/shaka-player.uncompiled.js
These files are inside these folders, but browser returns me 404 because of i don't know how to expose these contents from config file.
I tried adding some code like:
location = third_party/closure/goog/base.js {
root /usr/share/nginx/html/shaka-player-master/third_party/closure/goog/base.js;
}
But still 404.
Can anyone help me?
Upvotes: 0
Views: 384
Reputation: 49702
The correct location
and root
syntax would be:
location = /third_party/closure/goog/base.js {
root /usr/share/nginx/html/shaka-player-master;
}
location = /dist/deps.js {
root /usr/share/nginx/html/shaka-player-master;
}
location = /shaka-player.uncompiled.js {
root /usr/share/nginx/html/shaka-player-master;
}
See location and root manual pages for details.
There will also be configurations that allow this root to be the default and make the demo location the exception.
However, there is another potential problem - why is your application using localhost:9900
as the server name?
Upvotes: 1