Gitea: Gitea setup using HTTPS

Created on 1 Jun 2018  路  6Comments  路  Source: go-gitea/gitea

To force Gitea to use HTTPS I had to use Google as such an item I did not see in the documentation, it can be there and you will tell me where it is, and so I think it needs to be created

kindocs kinquestion

Most helpful comment

Ah I'm sorry I mis-understood the question. I thought you already had HTTPS and were trying to have the redirect happen.

If you want Gitea to run HTTPS without a reverse proxy (nginx, apache, caddy, etc..), you will need a certificate, and a private key. Gitea can generate self-signed versions of these files with a command line call gitea cert -host=git.example.com, this will output to cert.pem and key.pem in the current directory and will overwrite any existing files.

Next in your configuration you'll need to add a path to the files in your configuration

[server]
PROTOCOL=https
ROOT_URL = `https://git.example.com:3000/`
HTTP_PORT = 3000
CERT_FILE = path/to/cert.pem
KEY_FILE = path/to/key.pem

All 6 comments

Hi @Mauladen,

This feature was added in #3262, the two config options you'll need are REDIRECT_OTHER_PORT and PORT_TO_REDIRECT. You can read more about the options here: https://docs.gitea.io/en-us/config-cheat-sheet/

I'll leave this issue open for the next bit of time in case you need any additional help.

Thanks,
@techknowlogick

Ah I'm sorry I mis-understood the question. I thought you already had HTTPS and were trying to have the redirect happen.

If you want Gitea to run HTTPS without a reverse proxy (nginx, apache, caddy, etc..), you will need a certificate, and a private key. Gitea can generate self-signed versions of these files with a command line call gitea cert -host=git.example.com, this will output to cert.pem and key.pem in the current directory and will overwrite any existing files.

Next in your configuration you'll need to add a path to the files in your configuration

[server]
PROTOCOL=https
ROOT_URL = `https://git.example.com:3000/`
HTTP_PORT = 3000
CERT_FILE = path/to/cert.pem
KEY_FILE = path/to/key.pem

Yes, I did, but that's not the point, you need to add it to the documentation

@Mauladen feel free to submit PR for docs, we really need help on that

I had the same question, have not tried again yet though

so seems like running gitea cert --host [HOST] instead of openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out cert.pem is the key to get this working ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonasfranz picture jonasfranz  路  3Comments

lunny picture lunny  路  3Comments

kifirkin picture kifirkin  路  3Comments

thehowl picture thehowl  路  3Comments

tuxfanou picture tuxfanou  路  3Comments