Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx configuration #161

Closed
oligriffiths opened this issue Oct 18, 2013 · 16 comments
Closed

Nginx configuration #161

oligriffiths opened this issue Oct 18, 2013 · 16 comments
Labels
enhancement New feature or request

Comments

@oligriffiths
Copy link

Hi

Is it possible to direct nginx to read the configuration file from within my project repo?

I have a config file to configure nginx for the specific vhost contained within the project, I want nginx to use this config file when booting (adds various options/rewrite rules etc to the config) when it boots?

Thanks

Oli

@3flex
Copy link
Contributor

3flex commented Oct 22, 2013

You can put it in /etc/nginx/conf.d/ with a .conf extension. The configuration will then be included in the http context when the server is reloaded/restarted.

@cyrusstoller
Copy link

Out of curiosity, is there a reason that conf files are put in the /etc/nginx/conf.d directory instead of /etc/nginx/sites-enabled? I see that that the line that links to sites-enabled was explicitly removed in config.pp.

@3flex
Copy link
Contributor

3flex commented Oct 23, 2013

Hi @oligriffiths, would you consider closing this issue if there's nothing else outstanding?

@cyrusstoller Are you talking about the vhost configuration? I think that's put there because the way the module currently works is all vhost configurations are combined into a single file, so it doesn't make sense to put it in sites-enabled since it would be a single monolithic file rather than being split out as they should be in that directory.

PR #167 will stop creating a single monolithic file and split things up by vhost. If/when that's merged someone could look at putting the vhost configs in sites-enabled.

@cyrusstoller
Copy link

@3flex thanks for sharing the rationale. I'm not a fan of big monolithic files. Hopefully #167 will be merged soon.

@3flex
Copy link
Contributor

3flex commented Nov 20, 2013

Hi @oligriffiths, can you please close this issue if there's nothing outstanding?

@oligriffiths
Copy link
Author

Sorry, I didn't see your previous comment. I don't think this answers my question, perhaps I need to be clearer.

I contacted https://puphpet.com about allowing for the nginx configuration to reside within the project files (such that they can be bundled with the project and kept under VC). They said it should be possible but I should contact you.

So what I want to be able to do is to have my nginx config included within the package that puphpet generates (vhost names, routing, config options, etc)

Is this possible?

@3flex
Copy link
Contributor

3flex commented Nov 21, 2013

Can you provide an example with the file/folder structure you intend to use? I'm not familiar with puphpet.

@oligriffiths
Copy link
Author

Hi

I'm not quite sure who to direct this at to be honest. I was directed from here puphpet/puphpet#166

Perhaps @puphpet could provide some clarification?

Thanks

@binhnv
Copy link

binhnv commented Apr 20, 2014

I am trying to do the same thing that oligriffiths is trying to do but I don't think it is possible with the current code. Basically I have a ready for use vhost configuration file and I just want to copy it to server without any change. I can't find the way to do it if I want to use nginx::resource::vhost

@3flex
Copy link
Contributor

3flex commented Apr 10, 2015

@oligriffiths @binhnv I'm still not following, be aware that I am 100% unfamiliar with PuPHPet. It sounds like something that may be useful, but I'm trying to understand exactly what the requirements are and whether any changes are in scope for this module.

Are you saying that you want to use the nginx::resource::vhost type, but do something like:

nginx::resource::vhost { 'puphpet':
  custom_file => '/path/to/custom/file'
}

and then have that file copied to /etc/nginx/sites-available just like the other vhost configs would be? Or are you trying to just link to the file from nginx somehow, and not copy the config to sites-available?

@3flex 3flex added the needs-feedback Further information is requested label Apr 10, 2015
@3flex
Copy link
Contributor

3flex commented May 6, 2015

I'm closing this for now. @oligriffiths @binhnv please comment if you have any information to add and I'll reopen. Thanks!

@3flex 3flex closed this as completed May 6, 2015
@oligriffiths
Copy link
Author

Sorry for not replying. Yeah that's pretty much what im talking about. That way a general puppet config for the box can be created, but the vhost information for the specific application can be loaded from a file within a project directory for example, that way the nginx config for myapp.com can live within the myapp repo.

@3flex 3flex reopened this May 6, 2015
@3flex 3flex added the enhancement New feature or request label May 6, 2015
@3flex
Copy link
Contributor

3flex commented May 6, 2015

How would you reference that custom file from PuPHPet? That won't happen automatically, you still need to copy the file somehow and PuPHPet doesn't support doing that automatically from what I can tell.

@3flex
Copy link
Contributor

3flex commented May 6, 2015

Or do you want the support added here first so PuPHPet can leverage it?

@oligriffiths
Copy link
Author

Exactly. If it's possible to specify the path to a custom vhost declaration, then PuPHPet could add support for it.

@3flex 3flex removed the needs-feedback Further information is requested label May 6, 2015
@wyardley
Copy link
Collaborator

wyardley commented Oct 7, 2016

It also might be nice to support custom vhost templates, and this might be another way of supporting something like what you're talking about.

Between the custom_cfg and raw appends / prepends for locations, I've found it possible to do a lot of custom things, but it should also be possible to just push the file outside of the module if that's your goal. Since conf.d and the sites-enabled directories are already included, you can also put files there from outside of the module, and they'll be included (being mindful of $vhost_purge / $confd_purge settings).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants