<div dir="ltr">Are you sure you don't want to use try_files for this?<div><br></div><div><a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files">http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 1, 2016 at 1:15 AM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<span class=""><br>
On Sun, Jul 31, 2016 at 06:55:54PM -0400, Denis Papathanasiou wrote:<br>
<br>
> I have the following configuration file defined in<br>
> /etc/nginx/conf.d/my-project.conf (this is on debian).<br>
><br>
> It does what I want, in that it serves static contet in the /css, /images,<br>
> /js folders along with index.html correctly.<br>
><br>
> And for dynamic requests (I'm running an fcgi-enabled server on port 9001)<br>
> to /contact, /login, and /singup it also works correctly.<br>
><br>
> I would just like to be able to declare that anything *except* index.html,<br>
> /css, /images, and /js, it should all go to the fcgi server.<br>
><br>
> I've experimented with various definitions of "location", but the only<br>
> one that seems to work is the one I have below, where all the possible<br>
> fcgi paths are defined explicitly.<br>
><br>
> Is there a better, simpler way of doing this?<br>
<br>
</span>So, you need to pass to fastcgi anything except /, /index.html,<br>
and anything starting with /css/, /images/, and /js/, right?<br>
<br>
Most simple solution would be exactly this, by defining a catch-all<br>
"location /" to pass anything to fastcgi, and explicitly excluding<br>
required paths using additional locations:<br>
<br>
   root   /var/www/my-project/html;<br>
   index  index.html;<br>
<br>
   location / {<br>
       fastcgi_pass ...<br>
       include fastcgi_params;<br>
   }<br>
<br>
   location = / {}<br>
   location = /index.html {}<br>
   location /css/ {}<br>
   location /images/ {}<br>
   location /js/ {}<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/" rel="noreferrer" target="_blank">http://nginx.org/</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</font></span></blockquote></div><br></div>