How to host files in subfolder

Hi,
i installed jitsi server on my server and pointed subdomain to my server, everything works fine, i dont have any problem regarding jitsi server. But i want to host a html file in a subfolder to guide my users regarding how to use jitsi by leading them to “meet.my_jitsi_server.com/howtodo” url, how can i achieve this by configuring nginx files. I am not professional please help me.

Kinds.

You need to list it as location in your nginx config, as:

Thank you for reply,
is this enough? easy as it is? i am not familiar with nginx!

kinds.

index index.html index.htm;
error_page 404 /static/404.html;

gzip on;
gzip_types text/plain text/css application/javascript application/json image/x-icon application/octet-stream application/wasm;
gzip_vary on;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 512;

location = /config.js {
    alias /etc/jitsi/meet/meet.my_jitsi_server.com-config.js;
}
	
	location = /howtodo {
    alias /var/www/howtodo;
		index index.html;
}

this didn’t worked!
i have howtodo folder in /var/www and i restarted nginx, but it did not worked!.

kinds.

Which config file did you changed?

Have to change “/etc/nginx/sites-available/your.domain.conf”.

i changed the correct one, but i solved by modifying this part;

# ensure all static content can always be found first
location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$

i added howtodo folder into /usr/share/jitsi-meet and it is solved, but this is not the one i want.

You should redefine root parameter.
The root value is

root /usr/share/jitsi-meet;

location = /howtodo {
root /var/www;
index index.html;
try_files $uri $uri/ =404;
}

I think you should change “alias” to “root”

Also try to add try_files directive.
because you used

location = /howtodo

instead of

location = /howtodo/

location ~ /howtodo {
    root /var/www;
    index index.html;
    try_files $uri $uri/ =404;
}

what is the meaning of

~

?

thank you

regex match

1 Like

Hi @damencho @emrah

In my installation, I have also enabled grafana monitoring which runs on port 3000

I want to achieve this → https://subdomain.domain.com/monitoring

When I hit the URL, it should redirect me to the grafana page. In the current scenario, a new meeting is created. What changes do I have to make in nginx to achieve this and not create a meeting ?

You should put the related location block before the static content block and use the regex match because of the location priority

@emrah :slightly_smiling_face: Can you explain the difference of these?

location ~ /howtodo
location /howtodo

with simple example…

They catch exactly the same URL but their priorities are different
check this

thanks for your time

1 Like

I have been away for a while, sorry. I could not test your suggestions. I will try and let you guys know.

This worked very well, thank you.
Teşekkür ederim :slight_smile:

1 Like

Hi, @emrah

Congratulations for Jitas, just saw the results. :smiley:

I am using the docker version and I tried editing nginx in the web container, seems nginx was crashing

I added these lines - the /files proxypass in /etc/nginx/sites-enabled/default, and reloaded nginx, seems it didn’t work

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;
       location /files {
                 proxy_pass http://container-name:3000;
        }
        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}

What you mean by “crashing”? Any log…?