From 020153940970f80935a9fb0adba0a4fa2dea5c3f Mon Sep 17 00:00:00 2001 From: osmosBe <88088631+osmosBe@users.noreply.github.com> Date: Tue, 14 Sep 2021 14:34:41 +0200 Subject: [PATCH 01/14] Update SNAP Installation instructions Since I struggled a bit installing gitea with the snap package and finally managed to get it right I thought I would give something back to this project. So I created a little guide and thought I add it to your Documentation. I hope it can be useful for others and I hope it was the right way to get the snap working. --- .../doc/installation/from-package.en-us.md | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index e4081024bd0e7..6216f93876549 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -47,9 +47,52 @@ pacman -S gitea There is a [Gitea Snap](https://snapcraft.io/gitea) package which follows the latest stable version. -``sh -snap install gitea -`` +### This guide was tested with Ubuntu 20.04 and MySQL: + +* Install needed Packages and the snap: + +``` +sudo snap install gitea +sudo apt install nginx mariadb-server +``` +* Secure your mysql Installation + +``sudo mysql_secure_installation`` + +* Create your Database and Database User: + +``` +sudo mysql -u root -p + CREATE DATABASE gitea; + GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY "StrongPassword"; + FLUSH PRIVILEGES; + QUIT; +``` + +* Create nginx Config to pass traffic to port 3000: + + ``sudo nano /etc/nginx/conf.d/gitea.conf`` + +* This could look something like this for a secure Installation you should redirect all Traffic to port 443 and use a Certificate. +This can help: https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=intermediate&openssl=1.1.1d&guideline=5.6 + +``` +server { + listen 80; + server_name gitea.example.com; + + location / { + proxy_pass http://localhost:3000; + } +} +``` + +* Restart nginx +`` sudo systemctl restart nginx `` + +* Create correct DNS entry on your DNS Server if not done already +* Configure your gitea settings + The config file for the Snap can be found here if you want to make changes later: /var/snap/gitea/common/conf/app.ini ## SUSE and openSUSE From bdc18e1e5da8bd5f6ed87b9dfdd7729e28b82c98 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 08:53:44 +0200 Subject: [PATCH 02/14] Update docs/content/doc/installation/from-package.en-us.md Co-authored-by: 6543 <6543@obermui.de> --- docs/content/doc/installation/from-package.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index 6216f93876549..dc3262173a592 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -51,7 +51,7 @@ There is a [Gitea Snap](https://snapcraft.io/gitea) package which follows the la * Install needed Packages and the snap: -``` +```sh sudo snap install gitea sudo apt install nginx mariadb-server ``` From d35aef0618aeaf34cbf3be7f8cdb194ce455e5de Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 08:55:45 +0200 Subject: [PATCH 03/14] Update docs/content/doc/installation/from-package.en-us.md Suggestion is clearer Co-authored-by: delvh --- docs/content/doc/installation/from-package.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index dc3262173a592..6699a9d0cf9ad 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -64,7 +64,7 @@ sudo apt install nginx mariadb-server ``` sudo mysql -u root -p CREATE DATABASE gitea; - GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY "StrongPassword"; + GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY 'the same password for gitea config'; FLUSH PRIVILEGES; QUIT; ``` From cb6c7dd6d2498cfe74656b54552e5b2ff5f938f3 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:17:30 +0200 Subject: [PATCH 04/14] Update docs/content/doc/installation/from-package.en-us.md Co-authored-by: delvh --- docs/content/doc/installation/from-package.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index 6699a9d0cf9ad..a27be04978e70 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -49,7 +49,7 @@ There is a [Gitea Snap](https://snapcraft.io/gitea) package which follows the la ### This guide was tested with Ubuntu 20.04 and MySQL: -* Install needed Packages and the snap: +* Install needed packages: ```sh sudo snap install gitea From 5f3fdcae8c25abe94cf69645e4407e21070aa9de Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:33:26 +0200 Subject: [PATCH 05/14] Resolving the MariaDB and MySQL comments Correcting some unclear descriptions in regards to MariaDB, MySQL and Database preperation --- docs/content/doc/installation/from-package.en-us.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index a27be04978e70..ea9e5a9f6b67f 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -47,7 +47,7 @@ pacman -S gitea There is a [Gitea Snap](https://snapcraft.io/gitea) package which follows the latest stable version. -### This guide was tested with Ubuntu 20.04 and MySQL: +### This guide was tested with Ubuntu 20.04 and MariaDB: * Install needed packages: @@ -55,9 +55,11 @@ There is a [Gitea Snap](https://snapcraft.io/gitea) package which follows the la sudo snap install gitea sudo apt install nginx mariadb-server ``` -* Secure your mysql Installation +* Improve the security of your MariaDB Installation -``sudo mysql_secure_installation`` +``sh +sudo mysql_secure_installation`` +More information can be found on this website: https://mariadb.com/kb/en/mysql_secure_installation/ * Create your Database and Database User: @@ -68,10 +70,11 @@ sudo mysql -u root -p FLUSH PRIVILEGES; QUIT; ``` +Detailed information about Database preperation can be found by following this link: https://docs.gitea.io/en-us/database-prep/ * Create nginx Config to pass traffic to port 3000: - ``sudo nano /etc/nginx/conf.d/gitea.conf`` +``sudo nano /etc/nginx/conf.d/gitea.conf`` * This could look something like this for a secure Installation you should redirect all Traffic to port 443 and use a Certificate. This can help: https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=intermediate&openssl=1.1.1d&guideline=5.6 From 20c7c6c67ff799ddc4af8ee0433480fb1c673e80 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:40:41 +0200 Subject: [PATCH 06/14] Update docs/content/doc/installation/from-package.en-us.md thank you for correcting my spelling Co-authored-by: delvh --- docs/content/doc/installation/from-package.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index ea9e5a9f6b67f..49e6b657feb30 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -61,7 +61,7 @@ sudo apt install nginx mariadb-server sudo mysql_secure_installation`` More information can be found on this website: https://mariadb.com/kb/en/mysql_secure_installation/ -* Create your Database and Database User: +* Create your database and database user: ``` sudo mysql -u root -p From 525115d982bd991dd457242c49dd463c9136f800 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:40:50 +0200 Subject: [PATCH 07/14] Update docs/content/doc/installation/from-package.en-us.md Co-authored-by: delvh --- docs/content/doc/installation/from-package.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index 49e6b657feb30..60aeb3190f45d 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -63,7 +63,7 @@ More information can be found on this website: https://mariadb.com/kb/en/mysql_s * Create your database and database user: -``` +```sql sudo mysql -u root -p CREATE DATABASE gitea; GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY 'the same password for gitea config'; From 9b497a5fea8510b4a25859c676c22bd3665da224 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:41:55 +0200 Subject: [PATCH 08/14] Update docs/content/doc/installation/from-package.en-us.md Spelling corrected --- docs/content/doc/installation/from-package.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index 60aeb3190f45d..189ada4c3d116 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -72,7 +72,7 @@ sudo mysql -u root -p ``` Detailed information about Database preperation can be found by following this link: https://docs.gitea.io/en-us/database-prep/ -* Create nginx Config to pass traffic to port 3000: +* Create nginx config to pass traffic to port 3000: ``sudo nano /etc/nginx/conf.d/gitea.conf`` From 4aca652834629114a85bb78ddfad269cc0622cea Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:43:58 +0200 Subject: [PATCH 09/14] Update docs/content/doc/installation/from-package.en-us.md Clearing up the description Co-authored-by: delvh --- docs/content/doc/installation/from-package.en-us.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index 189ada4c3d116..4aa567952e426 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -76,7 +76,8 @@ Detailed information about Database preperation can be found by following this l ``sudo nano /etc/nginx/conf.d/gitea.conf`` -* This could look something like this for a secure Installation you should redirect all Traffic to port 443 and use a Certificate. +* The Nginx config should look something like the following code block. +To use `HTTPS`, you should additionally pass a certificate and redirect all traffic to port 443. This can help: https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=intermediate&openssl=1.1.1d&guideline=5.6 ``` From 8406f834460b33c7140f013b5931590791094dd2 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:44:38 +0200 Subject: [PATCH 10/14] Update docs/content/doc/installation/from-package.en-us.md Co-authored-by: delvh --- docs/content/doc/installation/from-package.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index 4aa567952e426..fc787f9e679da 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -80,7 +80,7 @@ Detailed information about Database preperation can be found by following this l To use `HTTPS`, you should additionally pass a certificate and redirect all traffic to port 443. This can help: https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=intermediate&openssl=1.1.1d&guideline=5.6 -``` +```nginx server { listen 80; server_name gitea.example.com; From 84619d77f35f56f839db200f985a37b0a4a99057 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:45:59 +0200 Subject: [PATCH 11/14] Update docs/content/doc/installation/from-package.en-us.md Co-authored-by: delvh --- docs/content/doc/installation/from-package.en-us.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index fc787f9e679da..b2183ac93f706 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -92,7 +92,9 @@ server { ``` * Restart nginx -`` sudo systemctl restart nginx `` +```bash +sudo systemctl restart nginx +``` * Create correct DNS entry on your DNS Server if not done already * Configure your gitea settings From 2b352e5d743ca17ea7857f43d18f3d5ac8ad964c Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:56:14 +0200 Subject: [PATCH 12/14] Update docs/content/doc/installation/from-package.en-us.md Added reverence to reverse proxy information --- docs/content/doc/installation/from-package.en-us.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index b2183ac93f706..6c5777db70732 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -90,7 +90,8 @@ server { } } ``` - +More information about reverse proxies can be found here: +https://docs.gitea.io/en-us/reverse-proxies/ * Restart nginx ```bash sudo systemctl restart nginx From db81610214fc9db0ccf0b6b38cf6b49dacc654b1 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Thu, 16 Sep 2021 08:17:26 +0200 Subject: [PATCH 13/14] Update docs/content/doc/installation/from-package.en-us.md Added a clearer description of how to secure gitea Co-authored-by: wxiaoguang --- docs/content/doc/installation/from-package.en-us.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index 6c5777db70732..a08ed9323009f 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -78,7 +78,14 @@ Detailed information about Database preperation can be found by following this l * The Nginx config should look something like the following code block. To use `HTTPS`, you should additionally pass a certificate and redirect all traffic to port 443. -This can help: https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=intermediate&openssl=1.1.1d&guideline=5.6 +The following link covers some information about a secure setup: +https://docs.gitea.io/en-us/https-setup/ + +This link may help to create a secure nginx configuration: https://ssl-config.mozilla.org/#server=nginx&version=2.4.41&config=intermediate&openssl=1.1.1d&guideline=5.6 + +For junior users this blogpost may help to get you started with securing your installation with nginx as reverse proxy and certbot for certificate issuing: +https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/ + ```nginx server { From 9b4dcca514cadd971862153694461abb37d5a8f2 Mon Sep 17 00:00:00 2001 From: Osmos <88088631+osmosBe@users.noreply.github.com> Date: Thu, 16 Sep 2021 08:21:09 +0200 Subject: [PATCH 14/14] Correting codeblock information Added Information to some codeblocks if it is sh, nginx, sql etc. --- docs/content/doc/installation/from-package.en-us.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/content/doc/installation/from-package.en-us.md b/docs/content/doc/installation/from-package.en-us.md index a08ed9323009f..52537c22659f2 100644 --- a/docs/content/doc/installation/from-package.en-us.md +++ b/docs/content/doc/installation/from-package.en-us.md @@ -74,7 +74,9 @@ Detailed information about Database preperation can be found by following this l * Create nginx config to pass traffic to port 3000: -``sudo nano /etc/nginx/conf.d/gitea.conf`` +```sh +sudo nano /etc/nginx/conf.d/gitea.conf +``` * The Nginx config should look something like the following code block. To use `HTTPS`, you should additionally pass a certificate and redirect all traffic to port 443. @@ -100,7 +102,7 @@ server { More information about reverse proxies can be found here: https://docs.gitea.io/en-us/reverse-proxies/ * Restart nginx -```bash +```sh sudo systemctl restart nginx ```