# Setting up nginx reverse proxy

**URL:** <https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142>\
**Category:** Installing and Using OpenWrt\
**Created:** [January 29, 2024, 11:12pm UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142 "2024-01-29T23:12:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcon](https://forum.openwrt.org/letter_avatar/mcon/32/6_449c533f586939b6e5f246632a46421f.png) [@mcon](https://forum.openwrt.org/u/mcon)\
**Post date:** [January 29, 2024, 11:12pm UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142/1 "2024-01-29T23:12:02Z")

</div>

I am trying to setup nginx reverse proxy and I used `nginx-util add_ssl myserver` to add SSL capabilty.

It dutifully "Created self-signed SSL certificate" as `myserver.crt`, but that certificate seems to be a copy OpenWrt own certificate as I can see:

```plaintext
Subject: C = ZZ, ST = Somewhere, L = None, CN = OpenWrt, O = OpenWrtAE6672445A9BB5DA

```

which is not for "myserver" and "recreating" it from scratch actually produces the same `.crt` so I suspect it just copies it from somewhere.

What am I missing?

I don't (currently) care for a properly signed certificate as this should just provide end-to-end security between two endpoints; later I will probably need to learn how to interact with ACME, but for now I should "just" need to get the right "Subject:".

---

<div class="post-metadata">

**Author:** ![trendy](https://forum.openwrt.org/user_avatar/forum.openwrt.org/trendy/32/8800_2.png) [@trendy](https://forum.openwrt.org/u/trendy)\
**Post date:** [January 30, 2024, 9:55am UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142/2 "2024-01-30T09:55:44Z")

</div>

Is it pulling them from [here](https://openwrt.org/docs/guide-user/services/webserver/uhttpd#https_enable_and_certificate_settings_and_creation)?

---

<div class="post-metadata">

**Author:** ![mcon](https://forum.openwrt.org/letter_avatar/mcon/32/6_449c533f586939b6e5f246632a46421f.png) [@mcon](https://forum.openwrt.org/u/mcon)\
**Post date:** [January 30, 2024, 10:05am UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142/3 "2024-01-30T10:05:38Z")

</div>

I'm not sure.  
Some fields seem identical, but others (e.g.: "O"rganization) seem computed somehow.

---

<div class="post-metadata">

**Author:** ![trendy](https://forum.openwrt.org/user_avatar/forum.openwrt.org/trendy/32/8800_2.png) [@trendy](https://forum.openwrt.org/u/trendy)\
**Post date:** [January 30, 2024, 10:49am UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142/4 "2024-01-30T10:49:42Z")

</div>

Maybe there is something in `/etc/ssl/` ?

> **[How to get rid of LuCI HTTPS certificate warnings](https://openwrt.org/docs/guide-user/luci/getting_rid_of_luci_https_certificate_warnings?s%5B%5D=openssl#create_install)**
>
> How to get rid of LuCI HTTPS certificate warnings Do you like the security of using LuCI-SSL (or Luci-SSL-OpenSSL), but sick of the security warnings your browser gives you because of an invalid certificate? You can fix this by installing a...

---

<div class="post-metadata">

**Author:** ![mcon](https://forum.openwrt.org/letter_avatar/mcon/32/6_449c533f586939b6e5f246632a46421f.png) [@mcon](https://forum.openwrt.org/u/mcon)\
**Post date:** [January 30, 2024, 11:23am UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142/5 "2024-01-30T11:23:51Z")

</div>

In `/etc/ssl/` I have standard OpenWrt stuff, nothing more.

Question is: is `nginx-util add_ssl` supposed to provide a certificate/key with the right `Common Name` for the site (which is _not_ LuCI)?

Apparently it doesn't and I see no way to force it to comply.

I (should) know how to use `openssl` to handle certificates, but I tried to use OpenWrt facilities, if possible. I confess I have lots of trouble finding what I need in docs (and to follow instructions after I find the relevant section).

---

<div class="post-metadata">

**Author:** ![trendy](https://forum.openwrt.org/user_avatar/forum.openwrt.org/trendy/32/8800_2.png) [@trendy](https://forum.openwrt.org/u/trendy)\
**Post date:** [January 30, 2024, 1:07pm UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142/6 "2024-01-30T13:07:52Z")

</div>

I don't have experience with nginx-util, but bottom line is that you can create the certificate with openssl if it doesn't work for you and you don't need to be limited to OpenWrt only, but you can create it anywhere.

---

<div class="post-metadata">

**Author:** ![mk24](https://forum.openwrt.org/letter_avatar/mk24/32/6_449c533f586939b6e5f246632a46421f.png) [@mk24](https://forum.openwrt.org/u/mk24)\
**Post date:** [January 30, 2024, 1:20pm UTC](https://forum.openwrt.org/t/setting-up-nginx-reverse-proxy/186142/7 "2024-01-30T13:20:30Z")

</div>

I use `xca`, which is available for Windows and Linux, as a GUI frontend to OpenSSL certificate functions.

Best security practice is _not_ to have the reverse proxy handling certificates. You don't want the certificate private key stored on a machine that is directly exposed to the Internet. Either the individual servers behind the proxy sign for their own sites, or for large sites a certificate server is used.
