You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

https-support.md 2.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. date: "2018-06-02T11:00:00+02:00"
  3. title: "Usage: HTTPS setup"
  4. slug: "https-setup"
  5. weight: 12
  6. toc: true
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "usage"
  11. name: "HTTPS setup"
  12. weight: 12
  13. identifier: "https-setup"
  14. ---
  15. # HTTPS setup to encrypt connections to Gitea
  16. ## Using built-in server
  17. Before you enable HTTPS make sure that you have valid SSL/TLS certificates.
  18. You could use self-generated certificates for evaluation and testing. Please run `gitea cert --host [HOST]` to generate a self signed certificate.
  19. To use Gitea's built-in HTTPS support you must change your `app.ini` file:
  20. ```ini
  21. [server]
  22. PROTOCOL=https
  23. ROOT_URL = `https://git.example.com:3000/`
  24. HTTP_PORT = 3000
  25. CERT_FILE = cert.pem
  26. KEY_FILE = key.pem
  27. ```
  28. To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server).
  29. ## Using Let's Encrypt
  30. [Let's Encrypt](https://letsencrypt.org/) is a Certificate Authority that allows you to automatically request and renew SSL/TLS certificates. In addition to starting Gitea on your configured port, to request HTTPS certificates Gitea will also need to listed on port 80, and will set up an autoredirect to HTTPS for you. Let's Encrypt will need to be able to access Gitea via the Internet to verify your ownership of the domain.
  31. By using Lets Encrypt **you must consent** to their [terms of service](https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf)
  32. ```ini
  33. [server]
  34. PROTOCOL=https
  35. DOMAIN=git.example.com
  36. ENABLE_LETSENCRYPT=true
  37. LETSENCRYPT_ACCEPTTOS=true
  38. LETSENCRYPT_DIRECTORY=https
  39. LETSENCRYPT_EMAIL=email@example.com
  40. ```
  41. To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server).
  42. ## Using reverse proxy
  43. Setup up your reverse proxy like shown in the [reverse proxy guide](../reverse-proxies).
  44. After that, enable HTTPS by following one of these guides:
  45. * [nginx](https://nginx.org/en/docs/http/configuring_https_servers.html)
  46. * [apache2/httpd](https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html)
  47. * [caddy](https://caddyserver.com/docs/tls)
  48. Note: You connection between your reverse proxy and gitea might be unencrypted. To encrypt it too follow the [built-in server guide](#using-built-in-server) and change
  49. the proxy url to `https://[URL]`.