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

mime.types are not recognized properly #43

Open
puzhengwu opened this issue Mar 14, 2024 · 0 comments
Open

mime.types are not recognized properly #43

puzhengwu opened this issue Mar 14, 2024 · 0 comments

Comments

@puzhengwu
Copy link

package main

import (
"fmt"
"log"

"github.com/tufanbarisyildirim/gonginx/parser"

)

func main() {
p, err := parser.NewParser("/etc/nginx/nginx.conf", parser.WithIncludeParsing())
if err != nil {
log.Fatalln("parser", err)
}

c, err := p.Parse()
if err != nil {
	log.Fatalln("parser2", err)
}

directives := c.FindDirectives("server")

for _, block := range directives {
	for _, directive := range block.GetBlock().GetDirectives() {
		if directive.GetName() == "server_name" {
			fmt.Println(directive.GetName(), directive.GetParameters())
		}
	}
}

}

unknown directive 'text/html' on line 3, column 5

nginx.conf
#...
include /etc/nginx/mime.types;
#...

mime.types

types {
text/html html htm shtml;
....

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

1 participant