# Apache ProxyPass not work

**URL:** <https://forum.gitea.com/t/apache-proxypass-not-work/9578>\
**Category:** Install/Maintain/Configure\
**Created:** [August 9, 2024, 12:41pm UTC](https://forum.gitea.com/t/apache-proxypass-not-work/9578 "2024-08-09T12:41:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BadFsaadKl](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BadFsaadKl](https://forum.gitea.com/u/BadFsaadKl)\
**Post date:** [August 9, 2024, 12:41pm UTC](https://forum.gitea.com/t/apache-proxypass-not-work/9578/1 "2024-08-09T12:41:05Z")

</div>

Hi together,

i try to install my gitea installation behind the apache vhost.  
but it dont work with the proxy and i dont find my error ☹

the local usage with [http://git.domain.de:3000](http://git.domain.de:3000) works fine, but when i use the url in my vhost config [http://git.domain.de/](http://git.domain.de/) i will get only an “404 page not found”.  
maybe i have some settings in the app.ini or vhost config wrong and hope you could help me.

app.ini:

```auto
[server]
SSH_DOMAIN = git.domain.de
DOMAIN = git.domain.de
HTTP_PORT = 3000
ROOT_URL = http://git.domain.de/
LOCAL_ROOT_URL = http://localhost:3000/
APP_DATA_PATH = /var/lib/gitea/data

```

vhost.conf

```auto
<VirtualHost git.domain.de>
    ProxyRequests on
    ProxyRequests off
    AllowEncodedSlashes NoDecode
    ProxyPass * http://git.domain.de:3000 nocanon
    RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}

</VirtualHost>

```

the proxy and proxy\_http modules in the apache2 are enabled.

iam using the Apache/2.4.52 (Ubuntu) and gitea 1.22.1

there i see no messages in the error or access logs of the apache.

have anyone an idea where i have an wrong config ?

thanks and regards  
Michél

---

<div class="post-metadata">

**Author:** ![reetp](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@reetp](https://forum.gitea.com/u/reetp)\
**Post date:** [August 9, 2024, 2:52pm UTC](https://forum.gitea.com/t/apache-proxypass-not-work/9578/2 "2024-08-09T14:52:48Z")

</div>

I think your proxy pass is wrong.

```auto
ProxyPass * http://git.domain.de:3000 nocanon

```

Should be like:

```auto
    ProxyPass / http://localhost:3000/ nocanon
    ProxyPassReverse / http://localhost:3000/

```

Form my working box:

app.ini

```auto
[server]
PROTOCOL = http
HTTP_PORT = 3000
START_SSH_SERVER = false
SSH_ROOT_PATH = /home/git/.ssh
SSH_CREATE_AUTHORIZED_PRINCIPALS_FILE = false
CERT_FILE = /etc/dehydrated/certs/gitea.mydomain.org/fullchain.pem
KEY_FILE = /etc/dehydrated/certs/gitea.mydomain.org/privkey.pem
SSH_DOMAIN = gitea.mydomain.org
DOMAIN = gitea.mydomain.org
ROOT_URL = https://gitea.mydomain.org
; LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/
APP_DATA_PATH = /var/lib/gitea/data

```

And apache - ignore the Letsencrypt stuff 🙂

```auto
<VirtualHost *:443>

    ServerAdmin server@localhost
    ServerName gitea.mydomain.org
    # ServerAlias mysite.wherever.org

    ErrorLog ${APACHE_LOG_DIR}/error-https.log
    CustomLog ${APACHE_LOG_DIR}/access-https.log combined

    SSLEngine on
    SSLProxyEngine on
    SSLCertificateChainFile /etc/dehydrated/certs/gitea.mydomain.org/fullchain.pem
    SSLCertificateFile /etc/dehydrated/certs/gitea.mydomain.org/cert.pem
    SSLCertificateKeyFile /etc/dehydrated/certs/gitea.mydomain.org/privkey.pem

    DocumentRoot "/var/www/html"

    # Desperate Letsencrypt passthrough attemtps start here

    Alias /.well-known/acme-challenge/ /var/www/html/.well-known/acme-challenge/

    <Location /.well-known/acme-challenge/>
        RewriteEngine off
        ProxyPass !
    </Location>

    <Directory /var/www/html/.well-known/acme-challenge>
        AllowOverride None
        Require all granted
    </Directory>

    # Getting worse
    RewriteCond %{REQUEST_URI} ^/\.well\-known
    RewriteRule . - [L]

    ProxyPreserveHost On
    ProxyRequests off
    AllowEncodedSlashes NoDecode

    # Last gasp
    ProxyPass /.well-known/acme-challenge/ !

    ProxyPass / http://localhost:3000/ nocanon
    ProxyPassReverse / http://localhost:3000/

    <IfModule mod_headers.c>
        Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>

</VirtualHost>

```

HTH.

---

<div class="post-metadata">

**Author:** ![BadFsaadKl](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BadFsaadKl](https://forum.gitea.com/u/BadFsaadKl)\
**Post date:** [August 13, 2024, 1:22pm UTC](https://forum.gitea.com/t/apache-proxypass-not-work/9578/3 "2024-08-13T13:22:36Z")

</div>

Hi,

i have try some settings seems like your setup, but i get still an error.  
at the moment i try de letsencrypt settings in the app.ini, but wenn ich start the server i get the following error:

```auto
2024/08/13 15:06:28 cmd/web.go:311:listen() [I] LFS server enabled
2024/08/13 15:06:28 cmd/web.go:353:listen() [E] Failed to start server: git.domain.de: obtaining certificate: failed storage check: mkdir https: permission denied - storage is probably misconfigured
2024/08/13 15:06:28 cmd/web.go:355:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed

```

i have no idea where there try to make an directory which i could check the permissions.

do you have an idea ?

regards

---

<div class="post-metadata">

**Author:** ![reetp](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@reetp](https://forum.gitea.com/u/reetp)\
**Post date:** [August 13, 2024, 2:33pm UTC](https://forum.gitea.com/t/apache-proxypass-not-work/9578/4 "2024-08-13T14:33:47Z")

</div>

> [@BadFsaadKl](#):
>
> ` git.domain.de: obtaining certificate: failed storage check: mkdir https: permission denied - storage is probably misconfigured`

So at a guess you haven’t got your DNS or https certificates properly configured for external access.

You need to make sure that your Apache is working correctly with https certificates for your domain. If that doesn’t work correctly from OUTSIDE your LAN then nothing will work.

If you don’t understand any of this then there are multitudes of pages on the interwebs about setting up https with Apache and letsencrypt certificates.

Personally I use the dehydrated script to get Letsencrypt https/ssl certificates on all my boxes. Light and simple.

Apache enabled with ssl certificates will then proxy (passthrough) information to gitea and back again.
