I'm using DigitalOcean droplet to host React app, which is just a personal website of mine. It works fine. I also used certbot to get a ssl certificate on my page.
Now I'm trying to run gitea server under a subdomain. So I did the setup, got to the initial install page (git.domain.com/install), and finished that. I logged into my running gitea server and everything seemed to be working fine.
Then I extended my ssl certification to include the subdomain. It sill seemed to be working fine from what I could tell.
However, now (5 hours later), when I try to go to "git.domain.com" it displays my personal web page, instead of the gitea page. But the url remains the same i.e. "git.domain.com". (So, maybe it was broke after I the added the ssl cert to the subdomain, but didn't realize the problem, because of the browser cache history)
I checked...
- gitea is still running under localhost:3000
- Nginx is running without error
- sites-available is linked with sites-enabled
- DNS records on DigitalOcean
I assume the issue is either with ...
- nginx config files
- ssl cert config with gitea (I used certbot to extend the existing ssl cert to include the subdomain)
- gitea app.ini config
It's driving me a little mad that I can't figure it out, so I decided to post this. Any help is appreciated. Let me know, if there is any other pertinent information I should provide.
Here are the files:
# nginx domain.com file
server {
root /var/www/domain.com/html;
index index.html index.htm index.nginx-debian.html;
server_name domain.com www.domain.com;
location / {
try_files $uri $uri/ =404;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name domain.com www.domain.com;
return 404; # managed by Certbot
}
# nginx git.domain.com file
server {
server_name git.domain.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:3000;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = git.domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name git.domain.com;
return 404; # managed by Certbot
}
# gitea app.ini file
APP_NAME = Gitea - Git with a cup of tea
RUN_USER = git
RUN_MODE = prod
[oauth2]
JWT_SECRET = FakePass
[security]
INTERNAL_TOKEN = FakeToken
INSTALL_LOCK = true
SECRET_KEY = FakeSecretKey
[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD = FakePassword
SSL_MODE = disable
CHARSET = utf8
PATH = /var/lib/gitea/data/gitea.db
ROOT = /home/git/gitea-repositories
[server]
SSH_DOMAIN = git.domain.com
DOMAIN = git.domain.com
ROOT_URL = http://localhost:3000/
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /var/lib/gitea/data/lfs
LFS_JWT_SECRET = FakeSecretJWTpassword
OFFLINE_MODE = false
HTTP_ADDR = /run/gitea/gitea.sock
PROTOCOL = unix
UNIX_SOCKET_PERMISSION = 666
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost
[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = false
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = info
ROOT_PATH = /var/lib/gitea/log