Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is, that you need something to identify the files without any extension. A sub-directory or something that’s always present within the request. Your regular expression only matched for requests that start end end with a dot (e.g. <code>http://example.com/.</code>). The following server configuration assumes that all URLs start with <code>storage</code>, as this would be the only possibility to identify those files.</p> <p>Please note that I’m using the <code>try_files</code> directive to rewrite the internal path where nginx should look for the file. The <code>root</code> directive is not meant for what you want to achieve.</p> <p>And last but not least, you should always nest location blocks with regular expressions. There is no limit in the nesting level. nginx will create some kind of tree data structure to search for the best matching location. So think of a tree while writing the blocks.</p> <pre><code>server { listen 80 default; listen [::]:80 default ipv6only=on; server_name www.website.com website.com; root /home/website/public_html/app; location / { # Matches any request for a URL ending on any of the extension # listed in the regular expression. location ~* \.(jpe?g|gif|css|png|js|ico|txt|xml)$ { expires 30d access_log off; try_files /public$uri =404; } # Matches any request starting with storage. location ~* ^/storage { access_log /var/log/nginx/bt.views.access.log; error_log /var/log/nginx/bt.views.error.log; try_files /app$uri; } proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080/; access_log off; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload