Valet: Custom nginx configurations - is it possible?

Created on 3 Jan 2017  路  6Comments  路  Source: laravel/valet

May I ask what does

include VALET_HOME_PATH/Nginx/*;

do exactly in nginx.conf or how should I use it right for any custom nginx configurations?

Most helpful comment

It auto-loads all the files in your ~/.valet/Nginx/ folder, into your nginx http config.

So, you "could" put files in there (not ending in .dev) if you wanted to add http-suitable configs there.
They wouldn't be domain-specific though (since those are all inside your .dev files.)

But the ~/.valet folder is somewhat volatile, subject to alteration by valet install activities.
Instead you could put your http customizations into the /usr/local/etc/nginx/servers/ folder, which is read after all the *.dev directives are read.

All 6 comments

It auto-loads all the files in your ~/.valet/Nginx/ folder, into your nginx http config.

So, you "could" put files in there (not ending in .dev) if you wanted to add http-suitable configs there.
They wouldn't be domain-specific though (since those are all inside your .dev files.)

But the ~/.valet folder is somewhat volatile, subject to alteration by valet install activities.
Instead you could put your http customizations into the /usr/local/etc/nginx/servers/ folder, which is read after all the *.dev directives are read.

How can I enable the directory listing output. I'm trying to create a nginx.conf on /usr/local/etc/nginx/servers/ with directive

location / {
     autoindex on; 
}

but doesn't work

I suspect yours is an issue of "priority", where one rule is superceding another.

Thanks for your reply, can you guide me how to do it?

@Inter95 nginx entry point is /usr/local/etc/nginx/nginx.conf if you open this file you will see several includes at the bottom:

include /Users/<user>/.valet/Nginx/*;
include servers/*;
include valet/valet.conf;

In my case I found the parameter I was trying to set in nginx.conf.default was being overridden in valet/valet.conf.

Check there and also any configuration files in your servers folder.

@bossrabbit Thanks for your reply, I tried your suggestion but didn't work. I'm using this commit 8039d7c doesn't work exactly like "autoindex on;" but do the work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marianvlad picture marianvlad  路  5Comments

sadhakbj picture sadhakbj  路  3Comments

webartistse picture webartistse  路  4Comments

eberkund picture eberkund  路  4Comments

dannygsmith picture dannygsmith  路  5Comments