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

Default nginx.conf #38

Closed
phaleth opened this issue Sep 15, 2024 · 12 comments
Closed

Default nginx.conf #38

phaleth opened this issue Sep 15, 2024 · 12 comments

Comments

@phaleth
Copy link

phaleth commented Sep 15, 2024

Any chance to provide the default nginx.conf such as the following one, but maybe without logs enabled by default?

Also while leaving out the current server section and including the include line at the bottom so that the user of the image can copy in their own config or maybe override the /etc/nginx/conf.d/default.conf if it's present, as shown bellow.

# configuration file /etc/nginx/nginx.conf:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

Very nice and compact image, btw.

Example usage would then be:

FROM ghcr.io/ammnt/freenginx:main
...
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
@ammnt ammnt pinned this issue Sep 15, 2024
@ammnt
Copy link
Owner

ammnt commented Sep 15, 2024

@phaleth, thank you for your feedback. Good idea actually! I need to think about this :)

@ammnt
Copy link
Owner

ammnt commented Sep 15, 2024

Okay. it will be added during next release. Please pay attention that configuration path has been changed too:
--conf-path=/etc/freenginx/freenginx.conf \

@ammnt ammnt closed this as completed Sep 15, 2024
@phaleth
Copy link
Author

phaleth commented Sep 15, 2024

That was quick. Thank you, @ammnt

@phaleth
Copy link
Author

phaleth commented Sep 21, 2024

We have deployed one of our sites using the freenginx image and it works quite well.

Here's a little bit of a feedback. If I try to use port 8080 in a server section of my own included nginx.conf It's not serving the site that I need, even tho I provide the config at the /etc/freenginx/conf.d/ dir. The reason is that this port is already taken by a server section in freenginx.conf.

Would you consider moving away the server section from the default freenginx.conf to /etc/freenginx/conf.d/default.conf?

@ammnt ammnt reopened this Sep 21, 2024
@ammnt
Copy link
Owner

ammnt commented Sep 21, 2024

@phaleth, I think it doesn't make sense because you can just mount and use your own global conf file. But I want to change default internal port and use above 8080 next time. So it has been changed to 35400.

@phaleth
Copy link
Author

phaleth commented Sep 21, 2024

I guess it does make sense cause now there is a server running on port 35400 for no reason and so the freenginx engine needs to make it's workers aware of that unused server.

Please, take a look into what the official nginx image does by running one of those containers and checking the defaults by executing nginx -T within the container.

@phaleth
Copy link
Author

phaleth commented Sep 21, 2024

Also I'd rather keep the defaults from your global freenginx.conf and adjust only what's really necessary in custom nginx.conf.

@ammnt
Copy link
Owner

ammnt commented Sep 21, 2024

I understand what you want to do, but what if you have more than one sites? In cases like these better change listen port in /etc/freenginx/conf.d/ conf files and keep global conf file I think.

@phaleth
Copy link
Author

phaleth commented Sep 21, 2024

Great. In cases you have more than one site you definitely might want to create a new file in the /etc/freenginx/conf.d/ dir for each of those sites, while always inheriting defaults from your freenginx.conf.

@ammnt
Copy link
Owner

ammnt commented Sep 21, 2024

@phaleth, okay. I need to think about this.

@ammnt
Copy link
Owner

ammnt commented Sep 21, 2024

It's done now.

@ammnt ammnt closed this as completed Sep 21, 2024
@phaleth
Copy link
Author

phaleth commented Sep 21, 2024

Again, that was super quick. Thank you. @ammnt

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

No branches or pull requests

2 participants