SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Server Support (https://forum.sa-mp.com/forumdisplay.php?f=19)
-   -   Configuring Nginx to reverse-proxy SA-MP server (https://forum.sa-mp.com/showthread.php?t=671981)

Sasinosoft 21/01/2020 05:32 PM

Configuring Nginx to reverse-proxy SA-MP server
 
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.

Markski 24/01/2020 08:42 PM

Re: Configuring Nginx to reverse-proxy SA-MP server
 
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;
    }
}


Sasinosoft 26/01/2020 12:48 PM

Re: Configuring Nginx to reverse-proxy SA-MP server
 
Quote:

Originally Posted by Markski (Post 4129242)
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?


All times are GMT. The time now is 11:18 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.