Configuring Nginx to reverse-proxy SA-MP server
#1

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.
Reply
#2

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;
    }
}
Reply
#3

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?
Reply


Forum Jump:


Users browsing this thread: