Popular Post JoaoZanetti Posted May 23, 2017 Popular Post Share Posted May 23, 2017 (edited) Spoiler This tutorial works with CentOS 6, but you will need to install another version of EPEL and change ports using iptables. This tutorial will guide you to install MTA-Server 64 bits and NGINX as external web server. What is NGINX? Is a high performance web server, it can be used to make players download your server at full available link speed with a high compression rate. Droplet used: 512MB Ram 1vCore 100/100 Uplink Centos 7.3.1611 x64 Requirements: Root permissions. Here is the resources used in IDLE (6 hours graph). Spoiler 1 - Lets prepare our system! Change to root user. $ sudo su We need to update our distro, we want the latest packages. $ yum -y update Now we will install some packages that we will use along this tutorial (screen to manage screens, unzip to .zip and EPEL for extra RHEL packages). $ yum -y install screen $ yum -y install unzip $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ rpm --install --nosignature epel-release-latest-7.noarch.rpm Start your firewall (You can check firewall status with service firewalld status). $ service firewalld start Lets open just ports that we use on MTA and NGINX. 22126 for MTA Query list, 22003 for MTA Server, 22005 for HTTP files and 20080 for NGINX server. $ firewall-cmd --permanent --zone=public --add-port=22126/udp $ firewall-cmd --permanent --zone=public --add-port=22003/udp $ firewall-cmd --permanent --zone=public --add-port=22005/tcp $ firewall-cmd --permanent --zone=public --add-port=20080/tcp You should see "success" at the end of each command from firewall Now we will reload firewall to make active our new rules. $ firewall-cmd --reload 2 - Setting up MTA Server. Now we will download all necessaries files to start our MTA Server. Navigate to /home and create a directory called MTA. $ cd /home $ mkdir MTA $ cd MTA Download all files (Server, base config and resources). $ wget https://linux.multitheftauto.com/dl/multitheftauto_linux_x64.tar.gz $ wget https://linux.multitheftauto.com/dl/baseconfig.tar.gz $ wget https://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip Extract everything. $ tar -xvf multitheftauto_linux_x64.tar.gz $ tar -xvf baseconfig.tar.gz $ unzip mtasa-resources-latest.zip Rename multitheftauto_linux_x64 to server. $ mv multitheftauto_linux_x64 server Now we will move our baseconfig files to server folder and remove old files. $ cd baseconfig $ mv * ../server/mods/deathmatch $ cd .. $ rm baseconfig -f -r $ rm baseconfig.tar.gz -f Now we will do the same thing as we did above, but with our resources files, just create folder, and move everything. $ mkdir server/mods/deathmatch/resources $ mv -t server/mods/deathmatch/resources [admin] [editor] [gameplay] [gamemodes] [managers] [web] Ok, now that we finished with server files, we will move our server folder to / and remove MTA folder (MTA folder is inside /home directory). $ mv server / $ cd .. $ rm * -f -r We need to set 777 permission to mta-server64 bin file. $ cd /server $ chmod -R 777 mta-server64 Now we will create a screen called "server-screen" and start our server (Just for test). $ screen -S server-screen $ ./mta-server64 We expect to see a message like this: Server started and is ready to accept connections! Now that everything is working we will stop MTA server and minimize our screen. CTRL + c $ clear CTRL a + CTRL d 3 - The fun part. Lets install NGINX and create a server file. (NGINX uses modular server files). $ yum -y install nginx $ service nginx stop $ cd /etc/nginx/conf.d $ vi mta-server.conf Lets insert some lines of code inside our .conf file. Don't break the indentation of the file. (Use INSERT in your keyboard to insert files and not replace) server { listen 20080; root /server/mods/deathmatch/resource-cache/http-client-files; server_name localhost; access_log off; } Save and exit. Press ESC Press : Type wq and hit enter Now we will change our global NGINX server configs. $ vi /etc/nginx/nginx.conf On the top of the file put this: worker_rlimit_nofile 5000; Increase worker_connections 1024 to 5000 worker_connections 5000; Below access_log /var/log/nginx/access.log main; insert this lines: gzip on; gzip_types *; We don't want to use NGINX as public web server, so lets change the default port. Change: listen 80 default_server; and listen [::]:80 default_server; to listen 8081 default_server; listen [::]:8081 default_server; The top of your config file need to look like this: Spoiler Start your NGINX server. $ service nginx start Test NGINX config. If you open this address and download a file, MTA Server block is ok. http://YOUR_SERVER_IP:20080/admin/client/admin_ACL.lua To test compression, navigate to: http://www.whatsmyip.org/http-compression-test/ And use this URL: http://YOUR_SERVER_IP:20080/admin/client/admin_ACL.lua 4 - Change MTA config file. Now we will point our download URL to NGINX URL. $ cd / $ vi /server/mods/deathmatch/mtaserver.conf Change <httpdownloadurl></httpdownloadurl> to: <httpdownloadurl>http://YOUR_SERVER_IP:20080</httpdownloadurl> 5 - Starting MTA Server. Resume screen. $ screen -r server-screen Start MTA Server. $ ./mta-server64 Minimize screen. CTRL a + CTRL d Its done, now your server is ready to accept connections and download all mods with fast speed. Useful links: Spoiler Using Vi : https://www.cs.colostate.edu/helpdocs/vi.html Test server ports: https://nightly.multitheftauto.com/ports/ EPEL: https://fedoraproject.org/wiki/EPEL CentOS 7 commands: https://www.techbrown.com/linux-basics-commands-sheet-with-examples-for-centos-7-rhel-7.shtml NGINX documentation: https://nginx.org/en/docs/ Server files: https://linux.multitheftauto.com/ Edited May 23, 2017 by JoaoZanetti 4 Link to comment
Other Languages Moderators Disinterpreter Posted May 24, 2017 Other Languages Moderators Share Posted May 24, 2017 (edited) vi /etc/nginx/nginx.conf i think it too difficult for newbie. i suggest install and use nano. Edited May 24, 2017 by Disinterpreter Link to comment
JoaoZanetti Posted May 24, 2017 Author Share Posted May 24, 2017 5 hours ago, Disinterpreter said: vi /etc/nginx/nginx.conf i think it too difficult for newbie. i suggest install and use nano. It's a good alternative. Another option: connect to SFTP and edit with File Zilla. Link to comment
Psychotic_OZ Posted August 5, 2018 Share Posted August 5, 2018 Correct me if i'm wrong but isn't it bad practice to start a gaming server as root? I've always started a game server as a user because if there is an exploit or something they not only can destroy your game server but your entire server itself. Link to comment
JoaoZanetti Posted August 5, 2018 Author Share Posted August 5, 2018 17 hours ago, Psychotic_OZ said: Correct me if i'm wrong but isn't it bad practice to start a gaming server as root? I've always started a game server as a user because if there is an exploit or something they not only can destroy your game server but your entire server itself. To install some packages and edit firewall you need to have root permissions. But yeah, you can run your server without root privileges, its better if you keep minimum needed permissions. Link to comment
Tony.Van Posted November 18, 2019 Share Posted November 18, 2019 I'm having this error in step $ service nginx start Help Link to comment
JoaoZanetti Posted November 18, 2019 Author Share Posted November 18, 2019 1 hour ago, Tony.Van said: I'm having this error in step $ service nginx start Help Post your nginx.conf file (/etc/nginx/nginx.conf Link to comment
JoaoZanetti Posted November 18, 2019 Author Share Posted November 18, 2019 Replace "workler" to "worker" in first line. Link to comment
deivid2020 Posted January 29, 2020 Share Posted January 29, 2020 (edited) Como configurar o nginx com mta no windows ? Edited January 29, 2020 by deivid2020 Link to comment
JoaoZanetti Posted January 30, 2020 Author Share Posted January 30, 2020 19 hours ago, deivid2020 said: Como configurar o nginx com mta no windows ? I don't think its a good idea to use Nginx on Windows, but you just need to download Nginx for Windows and use the same configs i provided. Link to comment
Storm-Hanma Posted February 22, 2020 Share Posted February 22, 2020 What about opening ports problem in ogp panel ,Linux vps centos? Link to comment
JoaoZanetti Posted February 24, 2020 Author Share Posted February 24, 2020 (edited) On 22/02/2020 at 06:46, KINGKHAN said: What about opening ports problem in ogp panel ,Linux vps centos? I don't think OGP has a built-in feature to open ports. I never used OGP but i think you just need to open ports using native CentOS firewall. Nginx port to download files firewall-cmd --zone=public --add-port=20080/tcp --permanent Download files firewall-cmd --zone=public --add-port=22005/tcp --permanent Join port firewall-cmd --zone=public --add-port=22003/udp --permanent Browse port firewall-cmd --zone=public --add-port=22126/udp --permanent Save configs firewall-cmd --reload Edited February 24, 2020 by JoaoZanetti Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now