Comments (11)
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.
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.
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.
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.
@tufanbarisyildirim any ideas?
from gonginx.
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.
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.
give it a test!
from gonginx.
That's perfect, it works ! May I ask you to release a version for us ? Thanks a lot !
from gonginx.
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.
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)
- Painc casued by parsing config which contained lua block HOT 2
- panic: unexpected token BlockEnd (}) HOT 2
- > ${var} breaks the parser. HOT 2
- example request HOT 4
- set_by_lua_block $wocao {} not support HOT 2
- DumpConfig not print lua block content HOT 1
- is this project given up?
- Dumper does not preserve the formatting in Lua blocks.
- Dumper does not preserve the formatting in log_format
- NewParser use os.Open and how to close it HOT 3
- unquote parameters HOT 2
- got "unexpected token" with the follow nginx config file at line 45 ("text/css") HOT 1
- unknown directive 'check_status' HOT 2
- can't use custom directives HOT 1
- Adding a new location block
- panic: unknown directive '''' on line 32, column 2
- mime.types are not recognized properly
- unknown directive 'application/octet-stream' HOT 3
- [feature request]enhanced server object capabilities for easier access and modification of nginx configuration HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gonginx.