Redirection to /Install not /gitea/install #576

Closed
opened 2025-11-02 03:28:39 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @hughesjs on GitHub (Mar 26, 2017).

  • Gitea version (or commit ref): 1.1.0
  • Operating system: Rasbian
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

I'm using nginx as a reverse proxy for Gitea and am attempting to migrate from Gogs (ended up doing a fresh install anyway) and am having issues with the redirect.

I want to host Gitea on pyrosoftsolutions.co.uk/gitea. However, when I access this address for the first time it redirects to pyrosoftsolutions.co.uk/install rather than pyrosoftsolutions.co.uk/gitea/install. Any ideas on what's going on?

Here's the relevant segment of the nginx.conf:

server {
listen 80 default_server;
# listen [::]:80;
return 301 https://$http_host$request_uri;
server_name pyrosoftsolutions.co.uk;
rewrite ^/gitea/(.*)/$1 break;
rewrite ^/gitea$/$1 break;
}

server {
listen 443 ssl default_server;
# listen [::]:443;
root /var/www/pyrosoftsolutions.co.uk;
server_name pyrosoftsolutions.co.uk;
ssl_certificate myCertLocation;
ssl_certificate_key myKeyLocation;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
server_tokens off;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security max-age=15768000;
access_log /var/log/nginx/gitea.log;
error_log /var/log/nginx/gitea.error.log;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;

location /gitea/ {
    proxy_pass      http://localhost:3000/;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        Host $http_host;
    proxy_read_timeout      90;
    proxy_redirect  http://localhost:3000/ https://$http_host$request_uri/;
}
location / {
    index index.html index.php;
    }
location ~ [^/].php(/|$) {
    fastcgi_split_path_info ^(.+?.php)(/.*)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

}

Originally created by @hughesjs on GitHub (Mar 26, 2017). - Gitea version (or commit ref): 1.1.0 - Operating system: Rasbian - Database (use `[x]`): - [ ] PostgreSQL - [X] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant I'm using nginx as a reverse proxy for Gitea and am attempting to migrate from Gogs (ended up doing a fresh install anyway) and am having issues with the redirect. I want to host Gitea on pyrosoftsolutions.co.uk/gitea. However, when I access this address for the first time it redirects to pyrosoftsolutions.co.uk/install rather than pyrosoftsolutions.co.uk/gitea/install. Any ideas on what's going on? Here's the relevant segment of the nginx.conf: > server { > listen 80 default_server; > \# listen [::]:80; > return 301 https://$http_host$request_uri; > server_name pyrosoftsolutions.co.uk; > rewrite ^/gitea/(.*)/$1 break; > rewrite ^/gitea$/$1 break; > } > > server { > listen 443 ssl default_server; > \# listen [::]:443; > root /var/www/pyrosoftsolutions.co.uk; > server_name pyrosoftsolutions.co.uk; > ssl_certificate myCertLocation; > ssl_certificate_key myKeyLocation; > ssl_dhparam /etc/ssl/certs/dhparam.pem; > server_tokens off; > ssl_protocols TLSv1 TLSv1.1 TLSv1.2; > ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5; > ssl_prefer_server_ciphers on; > add_header Strict-Transport-Security max-age=15768000; > access_log /var/log/nginx/gitea.log; > error_log /var/log/nginx/gitea.error.log; > ssl_session_cache shared:SSL:20m; > ssl_session_timeout 180m; > > location /gitea/ { > proxy_pass http://localhost:3000/; > proxy_set_header X-Real-IP $remote_addr; > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; > proxy_set_header Host $http_host; > proxy_read_timeout 90; > proxy_redirect http://localhost:3000/ https://$http_host$request_uri/; > } > location / { > index index.html index.php; > } > location ~ [^/].php(/|$) { > fastcgi_split_path_info ^(.+?.php)(/.*)$; > fastcgi_pass unix:/var/run/php5-fpm.sock; > fastcgi_index index.php; > include fastcgi_params; > } > }
GiteaMirror added the issue/not-a-bug label 2025-11-02 03:28:39 -06:00
Author
Owner

@hughesjs commented on GitHub (Mar 26, 2017):

I've fixed the issue, I'd just forgotten to set ROOT_URL in the Custom Conf.

@hughesjs commented on GitHub (Mar 26, 2017): I've fixed the issue, I'd just forgotten to set `ROOT_URL` in the Custom Conf.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#576