You need a database to use Gitea. Gitea supports PostgreSQL, MySQL, SQLite, and MSSQL. This page will guide into preparing database. Only PostgreSQL and MySQL will be covered here since those database engines are widely-used in production.
You need a database to use Gitea. Gitea supports PostgreSQL, MySQL, SQLite, and MSSQL. This page will guide into preparing database. Only PostgreSQL and MySQL will be covered here since those database engines are widely-used in production.
Database instance can be on same machine as Gitea (local database setup), or on different machine (remote database).
Database instance can be on same machine as Gitea (local database setup), or on different machine (remote database).
Note: All steps below requires that the database engine of your choice is installed on your system. For remote database setup, install the server part on database instance and client part on your Gitea server. In addition, make sure you use same engine version for both server and client for some engine features to work. For security reason, protect `root` (MySQL) or `postgres` (PostgreSQL) database superuser with secure password. The steps assumes that you run Linux for both database and Gitea servers.
Note: All steps below requires that the database engine of your choice is installed on your system. For remote database setup, install the server part on database instance and client part on your Gitea server. In addition, make sure you use same engine version for both server and client for some engine features to work. For security reason, protect `root` (MySQL) or `postgres` (PostgreSQL) database superuser with secure password. The steps assumes that you run Linux for both database and Gitea servers.
{{<toc>}}
## MySQL
## MySQL
1. For remote database setup, you will need to make MySQL listen to your IP address. Edit `bind-address` option on `/etc/mysql/my.cnf` on database instance to:
1. For remote database setup, you will need to make MySQL listen to your IP address. Edit `bind-address` option on `/etc/mysql/my.cnf` on database instance to:
All downloads come with SQLite, MySQL and PostgreSQL support, and are built with
All downloads come with SQLite, MySQL and PostgreSQL support, and are built with
embedded assets. This can be different for older releases. Choose the file matching
embedded assets. This can be different for older releases.
the destination platform from the [downloads page](https://dl.gitea.io/gitea/), copy
the URL and replace the URL within the commands below:
{{<toc>}}
## Download
Choose the file matching the destination platform from the [downloads page](https://dl.gitea.io/gitea/), copy the URL and replace the URL within the commands below:
Alpine Linux has [Gitea](https://pkgs.alpinelinux.org/packages?name=gitea&branch=edge) in its community repository which follows the latest stable version.
Alpine Linux has [Gitea](https://pkgs.alpinelinux.org/packages?name=gitea&branch=edge) in its community repository which follows the latest stable version.
Nous fournissons des images Docker mises à jour automatiquement via le Docker Hub de notre organisation. C'est à vous, lors devotre déploiement, de vous assurez d'utiliser toujours la dernière version stable ou d'utiliser un autre service qui met à jour l'image Docker pour vous.
Nous fournissons des images Docker mises à jour automatiquement via le Docker Hub de notre organisation. C'est à vous, lors devotre déploiement, de vous assurez d'utiliser toujours la dernière version stable ou d'utiliser un autre service qui met à jour l'image Docker pour vous.
{{<toc>}}
## Données stockées sur l'hôte
## Données stockées sur l'hôte
Tout d'abord, vous devez simplement récupérer l'image Docker avec la commande suivante :
Tout d'abord, vous devez simplement récupérer l'image Docker avec la commande suivante :
If you want Nginx to serve your Gitea instance, add the following `server` section to the `http` section of `nginx.conf`:
If you want Nginx to serve your Gitea instance, add the following `server` section to the `http` section of `nginx.conf`:
```
```
@ -27,7 +31,7 @@ server {
}
}
```
```
## Using Nginx with a sub-path as a reverse proxy
## Nginx with a sub-path
In case you already have a site, and you want Gitea to share the domain name, you can setup Nginx to serve Gitea under a sub-path by adding the following `server` section inside the `http` section of `nginx.conf`:
In case you already have a site, and you want Gitea to share the domain name, you can setup Nginx to serve Gitea under a sub-path by adding the following `server` section inside the `http` section of `nginx.conf`:
@ -44,7 +48,7 @@ server {
Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration.
Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration.
## Using Nginx as a reverse proxy and serve static resources directly
## Nginx and serve static resources directly
We can tune the performance in splitting requests into categories static and dynamic.
We can tune the performance in splitting requests into categories static and dynamic.
CSS files, JavaScript files, images and web fonts are static content.
CSS files, JavaScript files, images and web fonts are static content.
@ -61,7 +65,7 @@ After this, run `make frontend` in the repository directory to generate the stat
Depending on the scale of your user base, you might want to split the traffic to two distinct servers,
Depending on the scale of your user base, you might want to split the traffic to two distinct servers,
or use a cdn for the static files.
or use a cdn for the static files.
### using a single node and a single domain
### Single node and single domain
Set `[server] STATIC_URL_PREFIX = /_/static` in your configuration.
Set `[server] STATIC_URL_PREFIX = /_/static` in your configuration.
@ -80,7 +84,7 @@ server {
}
}
```
```
### using two nodes and two domains
### Two nodes and two domains
Set `[server] STATIC_URL_PREFIX = http://cdn.example.com/gitea` in your configuration.
Set `[server] STATIC_URL_PREFIX = http://cdn.example.com/gitea` in your configuration.
@ -112,7 +116,7 @@ server {
}
}
```
```
## Using Apache HTTPD as a reverse proxy
## Apache HTTPD
If you want Apache HTTPD to serve your Gitea instance, you can add the following to your Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
If you want Apache HTTPD to serve your Gitea instance, you can add the following to your Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
@ -131,7 +135,7 @@ Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`
If you wish to use Let's Encrypt with webroot validation, add the line `ProxyPass /.well-known !` before `ProxyPass` to disable proxying these requests to Gitea.
If you wish to use Let's Encrypt with webroot validation, add the line `ProxyPass /.well-known !` before `ProxyPass` to disable proxying these requests to Gitea.
## Using Apache HTTPD with a sub-path as a reverse proxy
## Apache HTTPD with a sub-path
In case you already have a site, and you want Gitea to share the domain name, you can setup Apache HTTPD to serve Gitea under a sub-path by adding the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
In case you already have a site, and you want Gitea to share the domain name, you can setup Apache HTTPD to serve Gitea under a sub-path by adding the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
@ -153,7 +157,7 @@ Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration
Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`
Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`
## Using Caddy as a reverse proxy
## Caddy
If you want Caddy to serve your Gitea instance, you can add the following server block to your Caddyfile:
If you want Caddy to serve your Gitea instance, you can add the following server block to your Caddyfile:
@ -171,7 +175,7 @@ git.example.com {
}
}
```
```
## Using Caddy with a sub-path as a reverse proxy
## Caddy with a sub-path
In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to your server block in your Caddyfile:
In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to your server block in your Caddyfile:
@ -194,7 +198,7 @@ git.example.com {
Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration.
Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration.
## Using IIS as a reverse proxy
## IIS
If you wish to run Gitea with IIS. You will need to setup IIS with URL Rewrite as reverse proxy.
If you wish to run Gitea with IIS. You will need to setup IIS with URL Rewrite as reverse proxy.