Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:guides:installation:reverse-proxy:nginx [2018/08/31 13:22]
mxschmitt
en:guides:installation:reverse-proxy:nginx [2018/11/10 00:11] (current)
irgendwr minor improvements
Line 2: Line 2:
 ## NGINX ## NGINX
  
-First you need to add a DNS record (A) which is pointing ​from your subdomain (e.g. bot) to the IP of your server. After that, create a file at `/​etc/​nginx/​sites-available/​sinusbot.conf` with the following content.+First you need to add a DNS record (for example an A-recordthat points ​from your subdomain (e.g. sinusbot) to the IP of your server.
  
-In the config files in the buttom you need to adjust the value of the following ​variables:+After that, create a file at `/​etc/​nginx/​sites-available/​sinusbot.conf` with the following ​content.
  
-- `server_name` +In the config files below you need to adjust the value of the following variables:​ 
-- `proxy_pass` (port of your sinusbot) + 
-- `ssl_certificate` (SSL only!+- `server_name` ​(domain/​subdomain) 
-- `ssl_certificate_key` (SSL only!)+- `proxy_pass` (local address ​of your sinusbot) 
 +- `ssl_certificate` (SSL only) 
 +- `ssl_certificate_key` (SSL only)
  
 If you are using no SSL (http): If you are using no SSL (http):
 +
 ``` ```
 server { server {
     listen 80;     listen 80;
     listen [::]:80;     listen [::]:80;
-    server_name ​bot.example.tld;+    ​ 
 +    # Set your domain here: 
 +    ​server_name ​sinusbot.example.com; 
 +    client_max_body_size 200M; 
 +    ​
     access_log ​ /​var/​log/​nginx/​sinusbot.access.log;​     access_log ​ /​var/​log/​nginx/​sinusbot.access.log;​
     error_log ​  /​var/​log/​nginx/​sinusbot.error.log;​     error_log ​  /​var/​log/​nginx/​sinusbot.error.log;​
-    ​client_max_body_size 100M;+    ​
     location / {     location / {
         proxy_set_header X-Forwarded-For $remote_addr;​         proxy_set_header X-Forwarded-For $remote_addr;​
Line 31: Line 38:
     listen 80;     listen 80;
     listen [::]:80;     listen [::]:80;
-    server_name ​bot.example.tld;+    ​ 
 +    # Set your domain here: 
 +    ​server_name ​sinusbot.example.com; 
 +    ​
     access_log ​ /​var/​log/​nginx/​sinusbot.access.log;​     access_log ​ /​var/​log/​nginx/​sinusbot.access.log;​
     error_log ​  /​var/​log/​nginx/​sinusbot.error.log;​     error_log ​  /​var/​log/​nginx/​sinusbot.error.log;​
 +    ​
     return 301 https://​$host$request_uri;​     return 301 https://​$host$request_uri;​
 } }
Line 39: Line 50:
     listen 443 ssl http2;     listen 443 ssl http2;
     listen [::]:443 ssl http2;     listen [::]:443 ssl http2;
 +    ​
 +    # Set your domain here:
 +    server_name sinusbot.example.com;​
 +    client_max_body_size 200M;
 +    ​
     access_log ​ /​var/​log/​nginx/​sinusbot.access.log;​     access_log ​ /​var/​log/​nginx/​sinusbot.access.log;​
     error_log ​  /​var/​log/​nginx/​sinusbot.error.log;​     error_log ​  /​var/​log/​nginx/​sinusbot.error.log;​
-    ​server_name bot.example.tld;​+    ​ 
 +    # Set the path to your ssl cert here:
     ssl on;     ssl on;
     ssl_certificate /​opt/​ssl/​fullchain.pem;​     ssl_certificate /​opt/​ssl/​fullchain.pem;​
     ssl_certificate_key /​opt/​ssl/​privkey.pem;​     ssl_certificate_key /​opt/​ssl/​privkey.pem;​
-    ​client_max_body_size 100M; +    ​
     location / {     location / {
         proxy_set_header X-Forwarded-For $remote_addr;​         proxy_set_header X-Forwarded-For $remote_addr;​
Line 64: Line 80:
 Reload nginx: Reload nginx:
  
-`systemctl reload ​nginx`+`nginx ​-s reload`
  
 Now just follow [[en:​guides:​installation:​reverse-proxy:​common-adaptations|this]]. Now just follow [[en:​guides:​installation:​reverse-proxy:​common-adaptations|this]].