Gitea setup using HTTPS #1845

Closed
opened 2025-11-02 04:14:56 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @Mauladen on GitHub (Jun 1, 2018).

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

Originally created by @Mauladen on GitHub (Jun 1, 2018). 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
GiteaMirror added the type/questiontype/docs labels 2025-11-02 04:14:56 -06:00
Author
Owner

@techknowlogick commented on GitHub (Jun 1, 2018):

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

@techknowlogick commented on GitHub (Jun 1, 2018): 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
Author
Owner

@Mauladen commented on GitHub (Jun 1, 2018):

@techknowlogick

https://github.com/go-gitea/gitea/issues/968
https://github.com/gogs/gogs/issues/235

I made as here

@Mauladen commented on GitHub (Jun 1, 2018): @techknowlogick https://github.com/go-gitea/gitea/issues/968 https://github.com/gogs/gogs/issues/235 I made as here
Author
Owner

@techknowlogick commented on GitHub (Jun 2, 2018):

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
@techknowlogick commented on GitHub (Jun 2, 2018): 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 ```
Author
Owner

@Mauladen commented on GitHub (Jun 2, 2018):

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

@Mauladen commented on GitHub (Jun 2, 2018): Yes, I did, but that's not the point, you need to add it to the documentation
Author
Owner

@lafriks commented on GitHub (Jun 2, 2018):

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

@lafriks commented on GitHub (Jun 2, 2018): @Mauladen feel free to submit PR for docs, we really need help on that
Author
Owner

@ghost commented on GitHub (Jun 2, 2018):

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 ?

@ghost commented on GitHub (Jun 2, 2018): I had [the same question](https://github.com/go-gitea/gitea/issues/3752), 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 ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1845