spro / simon

Dynamic routing/vhosts with nginx + Lua + Redis
73 stars 11 forks source link

it support https ? #3

Closed w796933 closed 5 years ago

w796933 commented 5 years ago

sir . is support https vhost ?

spro commented 5 years ago

Yes, the virtual host can use HTTPS with a correctly configured server block. The proxied-to server is still regular HTTP. An example:

    server {
        listen 443;
        server_name mywebsite.io;
        ssl on;

        ssl_certificate ssl/my.crt;
        ssl_certificate_key ssl/my.key;

        # Pass all requests through Simon
        location / {
            set $proxy_to "";
            set $proxy_host "";
            access_by_lua_file "/opt/openresty/lualib/simon/simon.lua";
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $proxy_host;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_pass http://$proxy_to$request_uri;
        }

    }