Differences

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

Link to this comparison view

Next revision
Previous revision
blocks:server:nginx [2022-12-13 12:58]
admin created
blocks:server:nginx [2023-03-16 17:46] (current)
admin Moved "redirect all HTTP" to the bottom
Line 1: Line 1:
 ====== NGINX Reverse Proxy ====== ====== NGINX Reverse Proxy ======
  
-Our linux server image version 221214 or later includes an [[http://nginx.org|nginx]]nginx web server, acting as a [[https://en.wikipedia.org/wiki/Reverse_proxy|reverse proxy]] in front of Blocks. Out of the box, it provides the following functionality:+Our linux server image version 221214 or later includes an [[http://nginx.org|nginx]] web server, acting as a [[https://en.wikipedia.org/wiki/Reverse_proxy|reverse proxy]] in front of Blocks. Out of the box, it provides the following functionality:
  
 ===Port Remapping=== ===Port Remapping===
Line 50: Line 50:
  
 Make sure to keep the space  after //server_name// as well as the semicolon after the domain name. Save the result by pressing ctrl-O followed by the Enter key, then exit the //nano// editor by ctrl-X.  Make sure to keep the space  after //server_name// as well as the semicolon after the domain name. Save the result by pressing ctrl-O followed by the Enter key, then exit the //nano// editor by ctrl-X. 
- 
-If you want to use HTTPS for all traffic, edit the file at **/etc/nginx/conf.d/pixilab.conf** by uncommenting (removing the #-signs) the last section under "Redirect ALL http request to https", so the last section in that file looks like this: 
- 
-<code> 
-# Redirect ALL http request to https 
-server { 
-    listen 80 default_server; 
-    server_name _; 
-    return 301 https://$host$request_uri; 
-} 
-</code> 
- 
-Save and exit //nano// again. 
  
 Make sure you've set good, strong passwords on all your Blocks users. Finally, while still as the //root// user, run the following commands, pressing enter after each. The first of these commands checks your new nginx configuration for errors. Pay close attention to any error messages that may appear.  Make sure you've set good, strong passwords on all your Blocks users. Finally, while still as the //root// user, run the following commands, pressing enter after each. The first of these commands checks your new nginx configuration for errors. Pay close attention to any error messages that may appear. 
Line 81: Line 68:
  
 <code> <code>
-certbot renew --dry-run+sudo certbot renew --dry-run
 </code> </code>
  
 If you get stuck, and need more details, follow the official //certbot// guide found [[https://certbot.eff.org/instructions?ws=nginx&os=debianbuster|here]], keeping in mind that all installations have already been done, so you can skip the first couple of steps. If you get stuck, and need more details, follow the official //certbot// guide found [[https://certbot.eff.org/instructions?ws=nginx&os=debianbuster|here]], keeping in mind that all installations have already been done, so you can skip the first couple of steps.
 +
 +If you want to use HTTPS for all traffic, edit the file at **/etc/nginx/conf.d/pixilab.conf** by uncommenting (removing the #-signs) the last section under "Redirect ALL http request to https", so the last section in that file looks like this:
 +
 +<code>
 +# Redirect ALL http request to https
 +server {
 +    listen 80 default_server;
 +    server_name _;
 +    return 301 https://$host$request_uri;
 +}
 +</code>
 +
 +Save and exit //nano// again, then test your configuration and restart nginx:
 +
 +<code>
 +sudo /sbin/nginx -t
 +sudo systemctl restart nginx
 +</code>
  
 ===Using Local Wifi=== ===Using Local Wifi===