Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Missing mime.types file plus /etc/mime.types idea #240

Closed
tcrowe opened this issue Oct 22, 2019 · 2 comments
Closed

Missing mime.types file plus /etc/mime.types idea #240

tcrowe opened this issue Oct 22, 2019 · 2 comments

Comments

@tcrowe
Copy link
Contributor

tcrowe commented Oct 22, 2019

nginx -v
nginx version: nginx/1.14.2

Linux, Debian buster


After running this role nginx could not start. It was missing /etc/nginx/mime.types. 🤔

I searched around the system for it finding /etc/mime.types but this approach didn't work because it's a different format than what nginx uses. In the end I get_url from nginx's repo.

- name: check nginx mime.types exists
  stat:
    path: "/etc/nginx/mime.types"
  register: nginx_mime_types_file

# 🚫doesn't work
# - name: create nginx mime.types from /etc/mime.types
#   shell: |
#     echo 'types {' > /etc/nginx/mime.types
#     cat /etc/mime.types >> /etc/nginx/mime.types
#     echo '}' >> /etc/nginx/mime.types
#   when: nginx_mime_types_file.stat.exists == False

# ✅works
- name: replace missing mime.types
  get_url:
    url: https://raw.githubusercontent.com/nginx/nginx/master/conf/mime.types
    dest: /etc/nginx/mime.types
  when: nginx_mime_types_file.stat.exists == False

If you think this is helpful I can create a PR. I'm not sure why the file was missing though. Have you guys seen this?

Thank you, -TC

@tcrowe
Copy link
Contributor Author

tcrowe commented Oct 22, 2019

mime.types included here:

include {{ nginx_conf_dir }}/mime.types;

@jdauphant
Copy link
Owner

Good idea for the PR 👍
Use {{ nginx_conf_dir }}| instead of /etc/nginx in that case ;)

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

No branches or pull requests

2 participants