Skip to content

Clarify and update web server configuration examples in the admin guide #175

@jputrino

Description

@jputrino

Is your feature request related to a problem? Please describe

This request came in via the Community Forum:

Docs referenced:

Examples, where e.g the design changed from say 1.24 to 1.25 and then again from 1.25 to 1.26. I seems (and I could be wrong here (and I can accept that)) there was a design change as to where the configs are set. As a learner - there seems more confusion.
It is ok to change design but allowance for design change impact examples may help.
This will allow folks like me to adapt to the change and have a path to upgrade.
I want to really communicate that this is not a run in with the dev team at all as I support opensource as much as I can. I understand that maybe there is a capacity problem or such (and when is it never the case).
I am stating that newbies may need more help than experienced folks, and docs (ref model) may help - especially like me you are on your own with noone to ask 😉

A simple example:
In the docs it states as below - (however the doc does not tell you where the file is or it’s name. If you are experienced you already know but if yo not well … I am building everything from scratch and depend on the docs basically and I cannot follow.

(source: https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/)

Sample Configuration File with Multiple Contexts

The following configuration illustrates the use of contexts.

user nobody; # a directive in the 'main' context

events {
    # configuration of connection processing
}

http {
    # Configuration specific to HTTP and affecting all virtual servers

    server {
        # configuration of HTTP virtual server 1
        location /one {

Describe the solution you'd like

  • Update the web server docs to make them more accessible to newer NGINX users.
  • Give more specific, copy/pasteable examples, including for a web server use cases that has multiple contexts
  • Make sure the docs accurately reflect the state of NGINX OSS and Plus.

Additional context

Original Forum post:

I installed nginx on vps with ubuntu 24.04

I then apt install nginx 1.27

Then I went to /etc/nginx/sites-available and created “mysite”. I then ln -s site-available and site-enabled as I learnt to do. The site works when the url was mysite IP addr …BUT… it points to the default file and not my “mysite”.

I have no clue where anything is!!! And the nginx.org or the new docs.nginx.org documentation is rather poor in this regard. I understand the ideas presented in it - unless I am mistaken the approach is to surpass the sites-available/enabled approach and move to a nginx.conf to do the switching from default to “mysite” . An example would help as to where the nginx.conf is - (thew doc states that it is found typically one of /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx locations.

response:

It sounds like the default.conf is still being loaded and without a DNS name, it will accept traffic. If you remove the default.conf from sites-enabled and reload nginx, it should fix the issue. Another option would be to define a server_name for your site and try to reach it with that instead of an IP.

The default.conf usually has the ‘default_server’ parameter set in the listen directive, which will make that the config used for any requests directly to the server IP or if there is not a match for a server_name in any other part of the config.

related post: https://community.nginx.org/t/config-differences-between-1-24-and-1-27/253/2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions