Bug 1564768 - Please do not include "location / {" in default nginx.conf
Summary: Please do not include "location / {" in default nginx.conf
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: nginx
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Felix Kaechele
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-07 16:28 UTC by Jon Dufresne
Modified: 2020-05-18 10:45 UTC (History)
12 users (show)

Fixed In Version: nginx-1.18.0-1.fc30 nginx-1.18.0-1.fc31 nginx-1.18.0-1.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-03 04:40:44 UTC
Type: Bug


Attachments (Terms of Use)

Description Jon Dufresne 2018-04-07 16:28:56 UTC
The /etc/nginx/nginx.conf installed by the package includes the directive:

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

This is a nice feature that allows users to easily create NGINX configurations with minimal effort. User can simply create a file in /etc/nginx/default.d/ without any additional modifications.

Unfortunately, there is also the directive:

        location / {
        }

Which prevents these configuration files from also using the location /. Trying to do so results in an error:

  [emerg] 30858#0: duplicate location "/" in /etc/nginx/nginx.conf:47

The user must now also customize /etc/nginx/nginx.conf in order to use the defaults.d feature.

I suggest not including "location / {" in nginx.conf, so users can more easily use this location with less configuration.

Version-Release number of selected component (if applicable):

nginx-1.12.1-1.fc27.x86_64

Comment 1 Jan Kurik 2018-08-14 10:07:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 2 Felix Kaechele 2019-07-11 18:15:38 UTC
Have you tried dropping your config in conf.d (thus including the whole server block as well, maybe even setting the default_server directive on the listen statement) and see if it does what you need?

Comment 3 Ben Cotton 2019-10-31 19:03:58 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Jon Dufresne 2019-11-01 14:55:54 UTC
Still in F31.

Comment 5 Jon Dufresne 2019-11-01 14:58:17 UTC
> Have you tried dropping your config in conf.d (thus including the whole
> server block as well, maybe even setting the default_server directive on the
> listen statement) and see if it does what you need?

While I can certainly take steps to workaround or undo this default -- I have
done so in Ansible scripts -- but that doesn't address my suggestion in the
report.

I'm suggesting removing as much friction as possible to take a default NGINX
installation and serve from location /. I think the way to do this would be to
remove the empty location block.

Comment 6 Fedora Update System 2020-04-24 03:16:27 UTC
FEDORA-2020-318ce3d301 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2020-318ce3d301

Comment 7 Fedora Update System 2020-04-24 03:16:27 UTC
FEDORA-2020-b17de7fa07 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-b17de7fa07

Comment 8 Fedora Update System 2020-04-25 04:18:56 UTC
FEDORA-2020-b17de7fa07 has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-b17de7fa07`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-b17de7fa07

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2020-04-25 04:55:29 UTC
FEDORA-2020-318ce3d301 has been pushed to the Fedora 30 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-318ce3d301`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-318ce3d301

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2020-04-25 12:20:52 UTC
FEDORA-2020-78690e2cdd has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-78690e2cdd`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-78690e2cdd

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2020-05-03 04:40:44 UTC
FEDORA-2020-318ce3d301 has been pushed to the Fedora 30 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2020-05-03 04:53:52 UTC
FEDORA-2020-b17de7fa07 has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2020-05-03 05:29:35 UTC
FEDORA-2020-78690e2cdd has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.