Runcloud nginx try_files help!


#21

Do you recommend having this by default?

location ~ .(ico|css|gif|jpe?g|png|gz|zip|flv|rar|wmv|avi|css|js|swf|png|htc|mpeg|mpg|txt|otf|ttf|eot|woff|woff2|svg)$ {
    expires     1M;
	add_header X-Frame-Options "SAMEORIGIN";
	add_header X-XSS-Protection "1; mode=block";
	add_header X-Content-Type-Options "nosniff";
    add_header Cache-Control "public";
}

#22

Caching for 1minute?

Rest of the configuration is fine and can be used.


#23

It’s added by default by RC. is it good or bad?


#24

It’s useless tbh!

It’s just asking the server to not keep files in cache for more than 1 minute.

You can keep it it won’t harm anything.


#25

It’s browser cache or server level cache?


#26

Browser cache it is.


#27

Ohh… understood…

What’s the value for 30 days?


#28

expires 720h;

or

expires 30d;


#29
location ~ .(html)$ {
    expires     24h;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";
    add_header  Cache-Control "public";
}

This mean .html files are cached for 24 hours.
So, if change context of a .html files, it won’t be reflected to the users until 24 hours? right?


#30

only if the file is cached in browser and it decides not to request a fresh version.


#31

That’s terrible, IDK why they added this in the first place.
It should be,

no-cache, no-store, must-revalidate

IMO.


#32

or better yet, don’t add anything. it works fine too :wink:


#33

That’s better…!


#34


#35

root will be better as it ascertains that all the files are to be found in that exact directory.

(I don’t know if alias would even work)


#36

Could you please explain this line?

fastcgi_split_path_info ^(.+\.php)(/.+)$;

What is it do?
And the meaning of the regex?


#37

Regular Expression. (a sequential denotion of characters/numbers in the order they would appear)

It will split the request into two parts: Script name and Path Info.
It is generally used to remember the URI and scriptname for caching purposes but there are other advanced uses as well.


#38

LMAO. What I meant was what the regex do! Definition of the regex.


#39
location /noindex {
    add_header	X-Robots-Tag "noindex, nofollow" always;
}

I added this code to nginx block any files under /noindex directory should get X-Robots-Tag, header.

But that does not seem to work, while testing…

Is my code correct?


#40

That’s what I explained!
if You want to set conditions that include a wide set of characters, instead of writing each character individually you denote a range using regex.