Giter Site home page Giter Site logo

Comments (11)

tufanbarisyildirim avatar tufanbarisyildirim commented on June 25, 2024 2

I think we can close this issue, it's good enough at least for now ;-) Once again thanks a lot for your help, @tufanbarisyildirim !

You are welcome, happy to help. will keep this version as base of v2.x.x, thanks for pointing out issues.

from gonginx.

tufanbarisyildirim avatar tufanbarisyildirim commented on June 25, 2024 1

Hello @kehoecj , sorry I have missed this, this looks like an interesting bug, thanks for raising it. I will be back here around weekend.

from gonginx.

onlineque avatar onlineque commented on June 25, 2024 1

Hi @tufanbarisyildirim,
thanks a lot for the fix, now the missing eof in block seems to be catched properly.

But when I feed the config with some nonsense keyword like "listena" in this example:


#user http;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    server {
        listena       8000;
        # listen       somename:8080;
        # server_name  somename  alias  another.alias;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

The gonginx says it's valid. But it's not. Testing with nginx -t -c nginx-bad-2.conf gives me expected:

2023/12/21 21:50:36 [emerg] 252611#252611: unknown directive "listena" in /etc/nginx/nginx-bad-2.conf:85
nginx: configuration file /etc/nginx/nginx-bad-2.conf test failed

Is it something what can be fixed, too ?

Thanks !

from gonginx.

tufanbarisyildirim avatar tufanbarisyildirim commented on June 25, 2024 1

oh hmm, that's an easy one I will add directive validation as well but it actually does not suppose to validate logically because nginx -t can also check the files, permissions etc, but still a good star to add directive validation, will add it.

from gonginx.

kehoecj avatar kehoecj commented on June 25, 2024

@tufanbarisyildirim any ideas?

from gonginx.

tufanbarisyildirim avatar tufanbarisyildirim commented on June 25, 2024

Honestly, I didn't expect it to be utilized so extensively, and I absolutely enjoy the BUGS that can offer opportunities to reshape the core logic.

DEAL

from gonginx.

tufanbarisyildirim avatar tufanbarisyildirim commented on June 25, 2024

Hello @kehoecj can you please try to see if that version helps you? https://github.com/tufanbarisyildirim/gonginx/tree/v2

That was a simple workaround, I will release a version for you that you can stick with and then jump in refactoring it.

from gonginx.

tufanbarisyildirim avatar tufanbarisyildirim commented on June 25, 2024

give it a test!

from gonginx.

onlineque avatar onlineque commented on June 25, 2024

That's perfect, it works ! May I ask you to release a version for us ? Thanks a lot !

from gonginx.

tufanbarisyildirim avatar tufanbarisyildirim commented on June 25, 2024

That's perfect, it works ! May I ask you to release a version for us ? Thanks a lot !

sure: https://github.com/tufanbarisyildirim/gonginx/releases/tag/2.0.0

from gonginx.

onlineque avatar onlineque commented on June 25, 2024

I think we can close this issue, it's good enough at least for now ;-) Once again thanks a lot for your help, @tufanbarisyildirim !

from gonginx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.