Last active
December 10, 2023 03:19
-
-
Save marklkelly/6db8862a0261997cadfd to your computer and use it in GitHub Desktop.
OpenResty & ssl_certificate_by_lua_file example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Simplified for illustrative purposes. | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
gzip on; | |
lua_shared_dict cert_cache 10m; | |
server { | |
listen 80; | |
server_name localhost; | |
#access_log logs/host.access.log main; | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
# redirect server error pages to the static page /50x.html | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
} | |
server { | |
listen 443 ssl default_server; | |
ssl on; | |
ssl_certificate /usr/local/openresty/nginx/ssl/default.pem; | |
ssl_certificate_key /usr/local/openresty/nginx/ssl/default.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_certificate_by_lua_file conf/tls-redis.lua; | |
# Some test output | |
location / { | |
content_by_lua ' | |
ngx.header["Content-Type"] = "text/plain" | |
ngx.status = 201 ngx.say("foo") | |
ngx.exit(201)'; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment