-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
Adds root directive to vhost_header and vhost_ssl_header templates. #143
Conversation
@@ -26,6 +26,10 @@ server { | |||
} | |||
<% end -%> | |||
|
|||
<% if defined? @www_root -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if @www_root
should be more than sufficient here, since it is undef
by default. https://github.com/jfryman/puppet-nginx/blob/master/manifests/resource/vhost.pp#L121
Also, <%-
?
Dig it! Can you clean it up a bit? I'll get it merged in. |
Tidied up the two new blocks, stripped an extra newline so I can leave it without |
@@ -25,6 +25,9 @@ server { | |||
return 301 https://$host$request_uri; | |||
} | |||
<% end -%> | |||
<% @www_root -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be if @wwwroot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that @www_root
is right, but there absolutely needs to be an if
here. Thanks for double-checking!
https://github.com/jfryman/puppet-nginx/blob/master/manifests/resource/vhost.pp#L123
@bradfirj: can you make this change really quickly? I'll get it merged in. 🍻
Thanks @3flex, chucked the missing ''if'' in. |
Also now there are tests, do you think you could add these conditions to |
@bradfirj Unfortunately having root defined inside location block does have significant side effects:
Please check http://linux.ioerror.us/2013/05/cant-get-php-fpm-with-nginx-to-work/ P. S. Sorry about the late reply. :) I missed your comment somehow. :( |
@schkovich The example you linked gives an error not because the questioner has defined a root inside a location but because they have defined it wrongly! Consider, from the linked article/question:
The issue here is not that Thus the SCRIPT_FILENAME passed to FastCGI will be All that said, there are a limited number of circumstances where you would want to define root inside a location block instead of using alias, however I thought it would be useful to allow the sysadmin to make their own decision on that matter. |
@bradfirj I am sorry I did not check the question at all but only the answer. Anyway get https://github.com/schkovich/ultramarin spin up Virtualbox and you will get the error. Further on, I truly do not understand why an option to do something that is clearly wrong should be provided. IMHO it is way more better to prevent sysadmins from doing stupidity. |
@bradfirj I'm going to second the need for tests here. Also, needs another rebase. :) @schkovich You bring up an interesting point. As far as the ability to do something wrong ... I'd rather provide sane defaults and let a user make silly decisions on their own. For the most part, our target audience is going to be sysadmins or other administrators. Those wanting to go far off the beaten path should absolutely be able to. |
This change will result in there being a 'root' directive in both the server block, and the location sub-block. This is a perfectly valid configuration and avoids the possible issue of having a location with no 'root' if it isn't explicitly set.
Drops the explicit ''defined?'' check as suggested by jfryman, and clears some pointless whitespace.
Way old. Thanks for taking a pass at this... going to revisit when 🕐 allows. Please reopen and rebase if you wanna take another pass at this. |
This change will result in there being a 'root' directive in both the
server block, and the location sub-block. This is a perfectly valid
configuration and avoids the possible issue of having a location
with no 'root' if it isn't explicitly set.
From #142, I thought this was the most concise way to solve the 'no root' issue, another possibility would be to remove the root directive from the default '/' location, but having the duplicate has no ill-effects and keeps the '/' location consistent with any others added to the vhost.
I don't like schkovich's solution (d22a259) as it removes the ability to define locations blocks with different document roots.