OpenResty Usage Guide
·
1 min read
Recently, I needed to modify the GZIP configuration for a web service. After checking the network, I noticed the response header showed
server:openresty/1.21.4.1
, which revealed that the gateway was using OpenResty. After confirming with the backend team, I needed to modify the GZIP configuration, which required some understanding of OpenResty.
What is OpenResty
OpenResty is a web server based on nginx that integrates nginx’s powerful performance with Lua’s dynamic capabilities.
Modifying GZIP Configuration in OpenResty
OpenResty’s GZIP configuration is similar to nginx’s configuration, primarily using the gzip
directive.
nginx configuration path: /usr/local/openresty/nginx/conf/nginx.conf
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 256;
Testing Configuration
In practice, you should first test if the configuration is correct before restarting.
openresty -t
Restarting OpenResty
openresty -s reload
Checking OpenResty Version
openresty -v
Final Thoughts
- So far, I’ve only worked with OpenResty’s GZIP configuration. I’ll add more when I encounter other configurations.
- As of now, I still prefer Caddy’s configuration approach - it’s more straightforward and clear.