Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Since you say you have Apache running, I assume it is there to run dynamic content such as PHP (Otherwise it is not needed). In that case, the example config below will serve all static content with Nginx and pass others to Apache.</p> <pre><code>server { # default index should be defined once as high up the tree as possible # only override lower down if absolutely required index index.html index.php # default root should be defined once as high up the tree as possible # only override lower down if absolutely required root /path/to/www/ location / { try_files $uri $uri/ @proxy; } location @proxy { proxy_pass http://127.0.0.1:8080; # Other Proxy Params } location ~ \.php$ { error_page 418 = @proxy location ~ \..*/.*\.php$ { return 400; } return 418; } } </code></pre> <p>What this assumes is that you are following a structured setup where the default file in every folder is either called "index.html" or "index.php" such as "/example/index.html", "some-folder/index.html" and "/some-other-folder/index.html".</p> <p>With this, navigating to "/example/", "/some-folder/" or "/some-other-folder/" will just work with no further action.</p> <p>If each folder has default files with random different names, such as "/example/example-content.html", "some-folder/some-folder.html" and "some-other-folder/yet-another-different-default.html", then it becomes a bit more difficult as you then need to do something like </p> <pre><code>server { # default index should be defined once as high up the tree as possible # only override lower down if absolutely required index index.html index.php # default root should be defined once as high up the tree as possible # only override lower down if absolutely required root /path/to/www/ location / { try_files $uri $uri/ @proxy; } location @proxy { # Proxy params proxy_pass http://127.0.0.1:8080; } location ~ .+\.php$ { error_page 418 = @proxy location ~ \..*/.*\.php$ { return 400; } return 418; } location /example/ { # Need to keep defining new index due to lack of structure # No need for alias or new root index example-content.html; } location /some-folder/ { # Need to keep defining new index due to lack of structure # No need for alias or new root index some-folder.html; } location /some-other-folder/ { # Need to keep defining new index due to lack of structure # No need for alias or new root index yet-another-different-default.html; } # Keep adding new location blocks for each folder # Obviously not the most efficient arrangement } </code></pre> <p>The better option is to have a structured and logical layout of files on the site instead of multiple differing locations. </p>
 

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