Author Topic: going crazy please help!  (Read 806 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
going crazy please help!
« on: May 23, 2022, 10:11:45 AM »
So, this situation has me totally stumped, while im sure it can happen, i just cannot for the life of me work it out.

Situation:
I have a server that is running a series of VM's
#1 VM is a centos server running CWP, confirmed to be working fine so far. (im also a premium member if that makes any difference)
#2 VM is a game server hosting some specific ports etc.

I have the CWP server setup as a Name Server and it hosts DNS etc. and I have a domain that is pointed to it and hosted on the CWP server.

The problem is, I actually have the website for this particular domain hosted on the game server (for reasons to do with the server needing the website hosted locally to talk to the game server etc)

How do I route all traffic to said domain on 80 and 443 through to the local IP for delivery?
I'm positive it can be done and easily, but i just can't work it out

Any help would be greatly apprecaited.

Offline
*
Re: going crazy please help!
« Reply #1 on: May 24, 2022, 10:50:37 AM »
Router Port Forwarding will help u

Offline
*
Re: going crazy please help!
« Reply #2 on: May 24, 2022, 11:23:52 AM »
Hey

Thanks for the reply, port forwarding is already setup from the router to the VM#1 which has CWP installed.
all requests for port 80 and 443 go there naturally, so i can't setup something to go direct to VM#2

I need to be able to direct VM#1's DNS or maybe a virtual host? to go to the internal VM#2 for a particular domain?

hope that helps explain it better

Offline
****
Re: going crazy please help!
« Reply #3 on: May 25, 2022, 01:58:23 AM »
Use Nginx as a reverse proxy, that connects to VM#2 on the lan IP
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: going crazy please help!
« Reply #4 on: May 25, 2022, 03:21:01 AM »
Use Nginx as a reverse proxy, that connects to VM#2 on the lan IP

Thankyou for the reply and I presumed it would be something like this, is there any chance you give give me a bit more of a step by step?
Thanks in advance!!

Offline
****
Re: going crazy please help!
« Reply #5 on: May 25, 2022, 09:41:03 PM »
Create a new nginx config file in /etc/nginx/conf.d/vhosts/(domainname).conf

the following should work.  Of course you can add the appropriate lines to add SSL options

Code: [Select]
server {
        listen (LAN IP of this computer):80;

        server_name (domainname) www.(domainname)

        location / {
                add_header X-Cache "HIT from Backend";
                add_header Strict-Transport-Security "max-age=31536000";
                add_header X-XSS-Protection "1; mode=block" always;
                add_header X-Content-Type-Options "nosniff" always;
                proxy_pass http://(Private IP of other server):80;

                include proxy.inc;
        }
        location ~ /\.ht    {deny all;}
        location ~ /\.svn/  {deny all;}
        location ~ /\.git/  {deny all;}
        location ~ /\.hg/   {deny all;}
        location ~ /\.bzr/  {deny all;}

        location /.well-known/acme-challenge {
                default_type "text/plain";
                alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
        }

        location /.well-known/pki-validation {
                default_type "text/plain";
                alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
        }
}
Google Hangouts:  rcschaff82@gmail.com

Offline
**
Re: going crazy please help!
« Reply #6 on: June 02, 2022, 09:19:18 AM »
Be careful to double check that nothing on the server itself (not the VMs) uses port 80, 443, DNS and any other port you are using on the VMs.
Double check that the firewall of the server does not block these as well. I've seen some conflict going on with someone else that has a server running multiple VMs since he only have one public IP for everything.
« Last Edit: June 02, 2022, 09:21:07 AM by iraqiboy90 »