'location' as an alias for 'server'?

B.R. reallfqq-nginx at yahoo.fr
Tue Nov 4 12:50:56 UTC 2014

The fact that sites-enabled contains 1 file per server is a *de facto*
standard. From nginx point of view, those are just include like others.
Since nginx.conf must have some include sites-enabled/*.conf rule, those
files are already loaded at http level.

To have the behavior you wish, I would do the following:
location /lalala {
    alias /usr/share/webapps;
    include locations/lalala.conf;

The locations directory shall include your per-location rules.

Note that directives working at server level might not do inside a
location. Those are 2 different scope with specific purposes.

I hope you know what you are doing. I do not know what you have in mind. :o)
*B. R.*

On Tue, Nov 4, 2014 at 10:03 AM, lockheed <nginx-forum at nginx.us> wrote:

> I have nginx set up with several servers in /etc/nginx/sites-enabled
> However, I want to convert my setup to one domain ***myserver.com*** , so
> typing in a browser
>     "lalala.com"
> will no longer get me to the appropriate ***/usr/share/webapps/lalala***
> subfolder.
> Therefore, I want to create some kind of bind (if possible) so that if I
> type
>     "myserver.com/lalala"
> it will redirect me to ***/usr/share/webapps*** while still applying all
> the
> configuration from
> ***/etc/nginx/sites-enabled/lalala***
> Is it doable, or do I have to rewrite all the server files from
> /sites-enabled/ as locations?
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,254563,254563#msg-254563
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141104/e963eb29/attachment.html>

More information about the nginx mailing list