2

I have troubles with nginx location block.

location /myApp/api/account/tutorialPage { alias /data/www/; index tutorial.html; } 

if a have strict match - all is fine, a have access to my tutorial.html.
But i want every link that contains /tutorialPage would lead to tutorial.html.
So i made next location:

location ~ /tutorialPage { alias /data/www/; index tutorial.html; } 

It must be something like "if link contains /tutorialPage than go to tutorial.html". But i have 403 error.

[error] 10148#0: *65346 directory index of "/data/www" is forbidden, client: 194.183.181.44, server: , request: "GET /myApp/api/account/tutorialPage/ HTTP/1.1", host: "my.domain.com", referrer: "https://my.domain.com/"

I have double checked that data/www dir is has chmod 755 (e.g can be read by enyone)

----UPD


Example of locations that works

 location ~ /tutorialPage\z { rewrite ^/.* /tutorial redirect; } location /tutorial { alias /data/www; index tutorial.html; } 

1 Answer 1

2

You need to internally rewrite the URI:

location ~ /tutorialPage { rewrite ^ /tutorial.html last; } 

The index directive determines the default action when encountering a directory, which is not the case here.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.