SA-MP Forums Archive
Configuring Nginx to reverse-proxy SA-MP server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Configuring Nginx to reverse-proxy SA-MP server (/showthread.php?tid=671981)



Configuring Nginx to reverse-proxy SA-MP server - Sasinosoft - 21.01.2020

Hello,
I would like to know how can I configure Nginx to reverse-proxy SA-MP servers in Ubuntu 18.04.
Let's suppose I have 3 SA-MP Server instances running in the same computer; I would like them to be accessible all at the same port but with different names.

Example:
Code:
s1.name.com:7777 -> 100.90.80.70 -> Nginx cfg "s1.name.com" -> localhost:7777
s2.name.com:7777 -> 100.90.80.70 -> Nginx cfg "s2.name.com" -> localhost:7778
s3.name.com:7777 -> 100.90.80.70 -> Nginx cfg "s3.name.com" -> localhost:7779
Is it possible to do this? Thank you.


Re: Configuring Nginx to reverse-proxy SA-MP server - Markski - 24.01.2020

This one I used previously for HTTP requests, not sure if it'd work for SA-MP but might be worth a try, tweaked it a bit for your case...

HTML Code:
server {
    listen 7777;
    server_name s2.name.com;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:7778;
    }
}



Re: Configuring Nginx to reverse-proxy SA-MP server - Sasinosoft - 26.01.2020

Quote:
Originally Posted by Markski
View Post
This one I used previously for HTTP requests, not sure if it'd work for SA-MP but might be worth a try, tweaked it a bit for your case...

HTML Code:
server {
    listen 7777;
    server_name s2.name.com;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:7778;
    }
}
Thanks, I will give it a try. Should I create a conf file in sites-available containing only this?