Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update update-configuration_and_run.md add nginx and apache configura… #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions de-DE/installation/configuration_and_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,69 @@ Natürlich kann man auch die Datenbankeinstellungen ändern
PASSWORD = root
```

### Eine Reverse-Proxy-Konfiguration einrichten

#### Nginx

```nginx
server {
listen 80;
server_name your-domain.com;
return 301 https://$host$request_uri;
}

server {
listen 443 ssl;
server_name your-domain.com;

ssl_certificate full_chain.pem;
ssl_certificate_key private.key;

location / {
client_max_body_size 1024M;
proxy_pass http://127.0.0.1:3000;
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;
add_header X-Cache $upstream_cache_status;
proxy_set_header Upgrade $http_upgrade;
}
}
```

#### Apache

```apache
<VirtualHost *:80>
ServerName your-domain.com
Redirect permanent / https://your-domain.com/
</VirtualHost>

<VirtualHost *:443>
ServerName your-domain.com

SSLEngine on
SSLCertificateFile /path/to/full_chain.pem
SSLCertificateKeyFile /path/to/private.key

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/

RequestHeader set X-Real-IP %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-Proto "https"

LimitRequestBody 1073741824 # 1024M

RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:3000/$1" [P,L]
</VirtualHost>
```

### Warum tun wir das?

Ja, warum nicht einfach `conf/app.ini` verändern? Der Grund ist, die eigene Konfiguration sicher zu speichern:
Expand Down
63 changes: 63 additions & 0 deletions en-US/installation/configuration_and_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,69 @@ PASSWORD = `root`

Note: please quote passwords using `` ` ``

### Set up a reverse proxy configuration

#### Nginx

```nginx
server {
listen 80;
server_name your-domain.com;
return 301 https://$host$request_uri;
}

server {
listen 443 ssl;
server_name your-domain.com;

ssl_certificate full_chain.pem;
ssl_certificate_key private.key;

location / {
client_max_body_size 1024M;
proxy_pass http://127.0.0.1:3000;
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;
add_header X-Cache $upstream_cache_status;
proxy_set_header Upgrade $http_upgrade;
}
}
```

#### Apache

```apache
<VirtualHost *:80>
ServerName your-domain.com
Redirect permanent / https://your-domain.com/
</VirtualHost>

<VirtualHost *:443>
ServerName your-domain.com

SSLEngine on
SSLCertificateFile /path/to/full_chain.pem
SSLCertificateKeyFile /path/to/private.key

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/

RequestHeader set X-Real-IP %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-Proto "https"

LimitRequestBody 1073741824 # 1024M

RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:3000/$1" [P,L]
</VirtualHost>
```

### Why are we doing this?

Yes, why don't you just edit `conf/app.ini`? The reason is to keep your custom configuration safe:
Expand Down
63 changes: 63 additions & 0 deletions fr-FR/installation/configuration_and_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,69 @@ Vous pouvez également changer le mot de passe de la base de données comme ceci
PASSWORD = root
```

### Mettre en place une configuration de proxy inverse

#### Nginx

```nginx
server {
listen 80;
server_name your-domain.com;
return 301 https://$host$request_uri;
}

server {
listen 443 ssl;
server_name your-domain.com;

ssl_certificate full_chain.pem;
ssl_certificate_key private.key;

location / {
client_max_body_size 1024M;
proxy_pass http://127.0.0.1:3000;
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;
add_header X-Cache $upstream_cache_status;
proxy_set_header Upgrade $http_upgrade;
}
}
```

#### Apache

```apache
<VirtualHost *:80>
ServerName your-domain.com
Redirect permanent / https://your-domain.com/
</VirtualHost>

<VirtualHost *:443>
ServerName your-domain.com

SSLEngine on
SSLCertificateFile /path/to/full_chain.pem
SSLCertificateKeyFile /path/to/private.key

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/

RequestHeader set X-Real-IP %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-Proto "https"

LimitRequestBody 1073741824 # 1024M

RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:3000/$1" [P,L]
</VirtualHost>
```

### Pourquoi faisons-nous ça ?

Oui, pourquoi ne pas simplement éditer `conf/app.ini` ? C'est pour vous permettre de garder votre configuration personnalisée en sécurité :
Expand Down
63 changes: 63 additions & 0 deletions zh-CN/installation/configuration_and_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,69 @@ PASSWORD = root
- 从二进制安装的用户,可以直接替换二进制及其它文件而不至于重新编写自定义配置。
- 从源码安装的用户,可以避免由于版本管理系统导致的文件修改冲突。

### 配置反向代理

#### Nginx

```nginx
server {
listen 80;
server_name your-domain.com;
return 301 https://$host$request_uri;
}

server {
listen 443 ssl;
server_name your-domain.com;

ssl_certificate full_chain.pem;
ssl_certificate_key private.key;

location / {
client_max_body_size 1024M;
proxy_pass http://127.0.0.1:3000;
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;
add_header X-Cache $upstream_cache_status;
proxy_set_header Upgrade $http_upgrade;
}
}
```

#### Apache

```apache
<VirtualHost *:80>
ServerName your-domain.com
Redirect permanent / https://your-domain.com/
</VirtualHost>

<VirtualHost *:443>
ServerName your-domain.com

SSLEngine on
SSLCertificateFile /path/to/full_chain.pem
SSLCertificateKeyFile /path/to/private.key

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/

RequestHeader set X-Real-IP %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-Proto "https"

LimitRequestBody 1073741824 # 1024M

RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:3000/$1" [P,L]
</VirtualHost>
```

## 运行 Gogs 服务

### 开发者模式
Expand Down