Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
reverse_proxy_server [2018/06/23 11:40]
warmachine
reverse_proxy_server [2018/06/23 15:27] (current)
warmachine
Line 9: Line 9:
 {{:proxy.jpg?600|}} {{:proxy.jpg?600|}}
  
-You'll need a linux machine of some sort for this. Reverse proxies are fairly lightweight so I would suggest spinning up a debian virt or utilizing a raspberry pi with raspbian if you want a physical proxy. This guide will assume your linux server is already setup, so if it isn't head over to my 'building a debian virtual machine' guide and start there first.+You'll need a linux machine of some sort for this. Reverse proxies are fairly lightweight so I would suggest spinning up a debian virt or utilizing a raspberry pi with raspbian if you want a physical proxy. This guide will assume your linux server is already setup, so if it isn'thead over to my 'building a debian virtual machine' guide and start there first.\\
  
-ssh to your linux server using your program of choice (secure CRT, MTputty, etc)+ssh to your linux server using your program of choice (secure CRT, MTputty, etc)\\
  
-use sudo for the commands if you are not logged in as root+use sudo for the commands if you are not logged in as root\\
  
-update linux and install nginx:+update linux and install nginx:\\
  
-apt-get update +<color #22b14c>apt-get update\\ 
-apt-get install nginx+apt-get install nginx</color>\\
  
 +disable the default host:\\
  
-disable the default host:+<color #22b14c>unlink /etc/nginx/sites-enabled/default</color>\\
  
-unlink /etc/nginx/sites-enabled/default+create your first host in the sites-available directory:\\
  
-create your first host in the sites-available directory:+<color #22b14c>nano /etc/nginx/sites-available/myfirsthost</color>\\
  
-nano /etc/nginx/sites-available/myfirsthost+this will open the file editor, which you can paste this into:\\
  
-this will open the file editorwhich you can paste this into:+<color #22b14c>server { \\ 
 +    listen 80; \\ 
 +    location / { \\ 
 +    proxy_pass http://internal-IP-of-your-first-host; \\ 
 +    } \\ 
 +} \\ 
 +</color>\\ 
 +control xy (this exits nano and saves)\\
  
-server { +We now create a symbolic link from the 'myfirsthost' config  file in your 'site-available' directory to the same file name in your 'sites-enabled' directory:\\
-    listen 80; +
-    location / { +
-    proxy_pass http://internal-IP-of-your-first-host; +
-    } +
-}+
  
-control x, y (this exits nano and saves) 
  
-we know create a symbolic link from the 'myfirsthost' config  file in your site-available directory to the same file name in your sites-enabled directory:+<color #22b14c>ln -s /etc/nginx/sites-available/myfirsthost /etc/nginx/sites-enabled/myfirsthost</color>\\
  
 +test and restart nginx:\\
  
-ln -s /etc/nginx/sites-available/myfirsthost /etc/nginx/sites-enabled/myfirsthost+<color #22b14c>service nginx configtest\\ 
 +service nginx restart</color>\\
  
-test and restart nginx:+If all goes well, visiting the IP of your proxy server should result in being forwarded to your first host. If configtest returns errors, you will need to troubleshoot them, check your IPs, file names, and syntax of the commands you've run. \\
  
-service nginx configtest +If you add a dns entry (see dns section of wiki) and modify 'yourfirsthost' config a bit further (you will only need to edit the one in the sites-available directory, thanks to the sim link), you can make your proxy a bit more powerful: \\
-service nginx restart+
  
-If all goes well visiting the IP of your proxy server should result in being forwarded to your first host. If configtest returns errors, you will need to troubleshoot them, check your IPs, file names, and syntax of the commands you've run. +<color #22b14c>server { \\ 
 +listen 80; \\ 
 +server_name your-first-hostname; \\ 
 +location / { \\ 
 +proxy_pass http://internal-IP-of-your-first-host; \\ 
 +} \\ 
 +} \\ 
 +</color>
  
-If you add dns entry (see dns section of wiki) and modify 'yourfirsthost' config a bit further (you will only need to edit the one in the sites-available directory, thanks to the sim link), you can make your proxy a bit more powerful:+Now, visiting your-first-hostname (ie: iviolet.net) should hit your reverse proxy server, then forward to your-first-host. Note that this will only work internally, until you actually purchase and setup domain name (see the domain name section of the wiki) and utilize either static IPs from your ISP, or more commonly --and cheaper, utilize dynamic DNS (also covered in the DNS section of the wiki). \\
  
-server { +Once you've added a few different entries into your 'sites-availabledirectory, configured them to point to different servers or virtual machines, and sim linked them to the sites-enabled directory, you're ready to really put nginx to work with SSL, sub-domains, and other features. More on that in Helder's reverse proxy guide. \\
-listen 80; +
-server_name your-first-hostname; +
-location / { +
-proxy_pass http://internal-IP-of-your-first-host; +
-+
-+
- +
-Now, visiting your-first-hostname (ie: iviolet.net) should hit your reverse proxy server, then forward to your-first-host. Note that this will only work internally, until you actually purchase and setup a domain name (see the domain name section of the wiki) and utilize either static IPs from your ISP, or more commonly --and cheaper, utilize dynamic DNS (also covered in the DNS section of the wiki). +
- +
-Once you've added a few different entries into your sites-available directory, configured them to point to different servers or virtual machines, and sim linked them to the sites-enabled directory, you're ready to really put nginx to work with SSL, sub-domains, and other features. More on that in Helder's reverse proxy guide.+
Last modified: le 2018/06/23 11:40