Note that there are some explanatory texts on larger screens.

plurals
  1. PONginx configurations
    text
    copied!<p>I'm looking through several documents but for some reason I can't wrap my head around the configuration necessary for what I'm trying to do. Basically I want:</p> <ul> <li><p>All directory requests should keep their url but be processed by index.php</p></li> <li><p>All .js, .css, .jpeg and .png files in their respective directories (/js/, /css/, and /images/) should be provided without php processing.</p></li> <li><p>All other file access should be denied (including all .php).</p></li> </ul> <p>I've tried setting up locations for the .php processing but I can never figure out how to get it working correctly. I'm going to keep at it but was hoping for some quick help as well :)</p> <p>Thanks!</p> <p>Edit 2: I think I came up with something decent. It may not be perfect but it should work.</p> <pre><code>server { listen 80; server_name _; server_tokens off; root /mypath/www; access_log /mypath/access.log; error_log /mypath/error.log; index index.html; location ^~ /app { return 404; } location ~ \.conf { return 404; } location ~ \.php { return 404 ; } location ~ /images/.*.(jpg|jpeg|png|gif) { try_files $uri $uri = 404; expires max; } location ~ /css/.*.css { try_files $uri $uri = 404; expires 1d; } location ~ /js/.*.js { try_files $uri $uri = 404; expires 1d; } location / { try_files $uri @PHPProxy; error_page 500 501 502 503 504 505 $document_root/error.html; } location @PHPProxy { include fastcgi_params; fastcgi_pass unix:/tmp/php.socket; fastcgi_param SCRIPT_FILENAME $document_root/index.php; } } </code></pre>
 

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