I want to add my static files, which should be available, for example, at this address:
https://site.com/static_file.html
Tell me how can I do this?
I want to add my static files, which should be available, for example, at this address:
https://site.com/static_file.html
Tell me how can I do this?
I know, but I thought the Peertube config files had a special directory for storing static files. It would be nice to do this in the future
I think we would be better off not reinventing (and maintaining) the wheel, and leave it to Nginx.
You can simply replace the line:
location ~ ^/static/(thumbnails|avatars)/ {
With:
location ~ ^/static/(thumbnails|avatars|folder_name)/ {
This will serve files in /var/www/peertube/storage/folder_name/
Thanks for the advice. I will definitely try this
Unfortunately your code doesn’t work- (
This option works:
location ~* .(txt|html|png|avi)$ {
root /var/www/peertube/storage-fs/files;
error_page 404 = 404;
}
but in this case the browser throws errors
GET https://peervideo.ru/lazy-static/avatars/404
What is your peertube’s version? Have you the standard nginx configuration file?
It works perfectly for me. I’m using this for a while now.
Peertube v 3.0.1
NGINX 1.14.2
What standard NGINX file are you talking about?
This one: https://github.com/Chocobozzz/PeerTube/blob/69e0e678beb7f1a3b6753eeff585a14f9a61ea86/support/nginx/peertube#L186
Ligne 186, add «|your_folder_name» (replace with the correct folder name, of course). Then, create a folder /var/www/peertube/storage/your_folder_name (if peertube is in /var/www/peertube/storage).
I specifically recorded a video … only one file works pv.png
The urls of static files is https://peervideo.ru/static/files/pv.png
The name you add to the location («files») will be accessible with «/static/files/»
And to avoid problem in future, you should choose a name that will never be used by peertube. Like «peervideo_ru» for example.
Of course, I’ll check it now … But I need the file to be available exactly from the root of the site … For example, this is necessary to confirm search engines like google or yandex and others
Oh, ok.
So you have to modify the location «/».
I don’t know enough about Nginx to tell you the right syntax.
If there is only several files, you can also add a location:
location ~ ^(file_name_1|file_name_2)$ {
try_files $uri @api;
}
Thank you very much for your attention and your help, but I’ll probably leave previous version for now. I hope there will be no major problems in the distribution of traffic.
location ~ ^/static/(thumbnails|avatars|folder_name)/ {