I bundle the scene from client and unzip it to nginx root path. Config the file as ‘.nginx-location.conf’ do.But I can’t load the scene in web sit .The informations I can provide bellow: web error:
The main issue is that the location directive takes a HTTP path of the resource, not the local path. It is the root directive which specifies where the resources are locally, and in your case it would be best to move it to the outer scope, to make it common for all the location directives.
Please try:
server {
listen 8090;
server_name localhost;
root E:/LearnForever/Threejs/threejs_git/webgldo/;
location ~ ^/exampleroom/index\.html$ {
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
}
location ~ ^/exampleroom/cover\.json$ {
# cover.json is precompressed in the bundle.
gzip off;
add_header Content-Encoding gzip;
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
}
location ~ ^/exampleroom(/.*\.(bmp|buf|js|json|ktx|svg|ico))$ {
# Disable gziping for these extensions, because such files are
# precompressed in the bundle.
gzip off;
add_header Content-Encoding gzip;
}
}
Are you accessing the scene as http://localhost:8090/webgldo/exampleroom or http://localhost:8090/exampleroom?
Could you disable browser cache in the Network tab of the Developer Tools? And then could you try to access: http://localhost:8090/exampleroom with the first of the above nginx configs once again?
I tried to disable browser cache and use the first nginx config .But it is still 404 error.Perhaps I have a wrong RegExp . I will try again and would you continue to help me?
Not working location directives looks like some mismatch between HTTP path and regexp or local path. If you are still trying to make the location directives work, could you please write where the bundled scene is currently on your hard drive (F:/shapespark/?), what the name of the scene directory is (exampleroom? without a dash between example and room?), and what what URL you are using to access the scene?
The location directives can also have root directives inside, but I’ve placed root directive in the outer level (server), because they would be the same.