# gitea behind the Apache2

**URL:** <https://forum.gitea.com/t/gitea-behind-the-apache2/8216>\
**Category:** Install/Maintain/Configure\
**Created:** [November 30, 2023, 11:02am UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216 "2023-11-30T11:02:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![git](https://avatars.discourse-cdn.com/v4/letter/g/f1d935/32.png) [@git](https://forum.gitea.com/u/git)\
**Post date:** [November 30, 2023, 11:02am UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216/1 "2023-11-30T11:02:16Z")

</div>

Hi Community,

I am desperately trying to put Apache in front of gitea.

My Apache2 .conf:

```auto
<VirtualHost *80:>
        ServerName sub.domain.tdl
        ServerAlias ddns.providor.tdl
        ServerAdmin webmaster@domain.tdl

        <Proxy *>
                 Order allow,deny
                 Allow from all
        </Proxy>
        AllowEncodedSlashes NoDecode
        ProxyPass /git http://localhost:3000 nocanon

        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
        ServerSignature On
</VirtualHost>

```

In the app.ini I have set ROOT\_URL as follows:

```auto
[server]
ROOT_URL = http://sub.domain.tdl/

```

What have I done wrong?

---

<div class="post-metadata">

**Author:** ![p7k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/p7k/32/4234_2.png) [@p7k](https://forum.gitea.com/u/p7k)\
**Post date:** [November 30, 2023, 9:22pm UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216/2 "2023-11-30T21:22:08Z")

</div>

Did you check your log files? The first thing I miss is this

```auto
ProxyPreserveHost On
ProxyPass "/git" "http://localhost:3000"
ProxyPassReverse "/git" "http://localhost:3000"

```

Does the access work without Apache? How does your LOCAL\_ROOT\_URL variable look like?

---

<div class="post-metadata">

**Author:** ![git](https://avatars.discourse-cdn.com/v4/letter/g/f1d935/32.png) [@git](https://forum.gitea.com/u/git)\
**Post date:** [December 2, 2023, 9:20pm UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216/3 "2023-12-02T21:20:56Z")

</div>

Hi @p7k,

the logs look good, no warnings or errors with Apche or gitea.

Without Apache I can call everything with [https://IP:3000](https://IP:3000) without any problems.  
There is no `LOCAL_ROOT_URL` in the app.ini.

---

<div class="post-metadata">

**Author:** ![p7k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/p7k/32/4234_2.png) [@p7k](https://forum.gitea.com/u/p7k)\
**Post date:** [December 3, 2023, 12:23am UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216/4 "2023-12-03T00:23:32Z")

</div>

Maybe you can configure it. I use nginx as a reverse proxy and I have always set

```auto
LOCAL_ROOT_URL = http://localhost:3000/ 

```

in the `[server]` section. That works perfectly here. You wrote **https** in your last answer. But that’s probably just a typo, isn’t it?

---

<div class="post-metadata">

**Author:** ![git](https://avatars.discourse-cdn.com/v4/letter/g/f1d935/32.png) [@git](https://forum.gitea.com/u/git)\
**Post date:** [December 3, 2023, 9:43am UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216/5 "2023-12-03T09:43:47Z")

</div>

I have added the LOCAL\_ROOT\_URL.  
But without any change.

No, I have already configured TLS in gitea.

This is my mistake?

---

<div class="post-metadata">

**Author:** ![p7k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/p7k/32/4234_2.png) [@p7k](https://forum.gitea.com/u/p7k)\
**Post date:** [December 6, 2023, 6:45am UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216/6 "2023-12-06T06:45:57Z")

</div>

Yes, i think this is your mistake. If you want to use a reverse proxy like Apache you have to move your TLS configuration to Apache too. Gitea should listen on plain http because it is running on the same server. So there is no need for Gitea to use TLS too. You can use TLS in Gitea too but then you have to add `SSLProxyEngine on` in your Apache vHost configuration and change the backend url to `https://localhost:3000`.

But in any case, you should also configure TLS in the Apache vhost.

---

<div class="post-metadata">

**Author:** ![git](https://avatars.discourse-cdn.com/v4/letter/g/f1d935/32.png) [@git](https://forum.gitea.com/u/git)\
**Post date:** [January 7, 2024, 5:52pm UTC](https://forum.gitea.com/t/gitea-behind-the-apache2/8216/7 "2024-01-07T17:52:19Z")

</div>

Sorry for the late response.

Many thanks for the information. I will try it and because I have no error message, I am now thinking of a network problem.

Thanks again.
