[SOLVED] Internal web site VM:80 Not working from outside

Sikjairi

Active Member
Jan 7, 2020
32
26
28
35
Africa
Hi Guys ,
i would like to get acces to local vm from outside exemple sub.domaine.com ==> proxmox-VM LOCAL-IP-3:80 ,

I made some config on my external apache proxy as you can see :



Code:
EXTERNAL  APACHE PROXY (Public IP -178.xx.xx.xx)  : /etc/apache2/sites-available/   
<VirtualHost *:80>
        ServerName sub.domaine.com
        ProxyPass / http://PROXMOX-PUBLIC-IP:80/
        ProxyPassReverse / http://PROXMOX-PUBLIC-IP:80/
        ProxyPreserveHost On
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =sub.domaine.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]           
</VirtualHost>


& also i made a modification on Proxmox network file as you can see :
Proxmox (Public IP -198.xx.xx.xx) : /ETC/NETWORK/INTERFACES ########## Routing VM Odoo Instances ########## post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 8085 -j DNAT --to LOCAL-IP-1:8085 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 8085 -j DNAT --to LOCAL-IP-1:8085 post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 8086 -j DNAT --to LOCAL-IP-2:8086 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 8086 -j DNAT --to LOCAL-IP-2:8086 ########## Routing VM Moodle Instance ########## post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to LOCAL-IP-3:80 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to LOCAL-IP-3:80

the problem i have that the Odoo instances work fine but for the moodle instance doesn't work , do you have any idea about the issue ?Thank you in advance .

NB :
VM Odoo work fine from outside :)
VM Moodle doesn't work from outside ( it's work from local network http://local-ip/moodle/login/index.php ) :confused:
 
On your router, on your firewall, at your provider?
Ultimately, you should know your network and where something could be blocked. I don't know your network and you haven't communicated many details about it here.
 
On your router, on your firewall, at your provider?
Ultimately, you should know your network and where something could be blocked. I don't know your network and you haven't communicated many details about it here.
Hi again @sb-jw ,

I Have a simple network as described in this diagram , you can take a look , i need to access to the vm122 via the sub.domain.com ,
The config files for apache2 & PVE: /Etc/network/interfaces are :

#Appache Proxy : /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80> ServerName sub.domain.com ProxyPass / http://149.xx.xx.xx:80/ ProxyPassReverse / http://149.xx.xx.xx:80/ ProxyPreserveHost On #RewriteEngine on #RewriteCond %{SERVER_NAME} =sub.domain.com #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost>

#PVE server : /ETC/NETWORK/INTERFACES
Code:
########## Routing VM  Moodle Instance  ##########     
      post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.21.21.122:80
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.21.21.122:80

NB: I have others VMs i can access to them via the port exemple 8069 8075 ..etc

PVE Network .png
 
Let's keep in mind that you have a problem with access from the Internet. It works from your internal network. So what is the problem? But obviously access from the Internet, so surely there is something between your private network and the Internet? Something like a router, a firewall or whatever, but something will probably establish the Internet connection in front of your PVE server.

Just because ports 8069 or 8075 can be accessed from the Internet doesn't necessarily mean anything; it could be that these ports are open and access is therefore working as it should.
Then just use one of these ports as a test and see if it works. If so, your configuration is correct and you have confirmation that port 80 is probably not usable.
 
This is not a network problem - try change sub.domain.com A 149.xx.xx.xx for testing, if site worked then trouble with your proxy or if not worked - trouble with you apache and moodle
 
Let's keep in mind that you have a problem with access from the Internet. It works from your internal network. So what is the problem? But obviously access from the Internet, so surely there is something between your private network and the Internet? Something like a router, a firewall or whatever, but something will probably establish the Internet connection in front of your PVE server.

Just because ports 8069 or 8075 can be accessed from the Internet doesn't necessarily mean anything; it could be that these ports are open and access is therefore working as it should.
Then just use one of these ports as a test and see if it works. If so, your configuration is correct and you have confirmation that port 80 is probably not usable.
Hi @sb-jw @basil ,

Sure i just changed the port from 80 to 8087 on apache proxy & PVE interfaces , now i got Local @ip from outside maybe i miss some config on the Moodle local VM


#1 the public ip with port 8087 goes to apache
1704574057881.png

2# the domain name goes to apache

1704573930869.png

3# the full web link goes to local ip adress of the moodle VM

1704574107963.png

#4 the local IP

1704574140972.png
 
This is not a network problem - try change sub.domain.com A 149.xx.xx.xx for testing, if site worked then trouble with your proxy or if not worked - trouble with you apache and moodle
You are right , the the public ip & doamin work fine , i still have one more problem that i got a local ip when i try to access to the web site
 
You are right , the the public ip & doamin work fine , i still have one more problem that i got a local ip when i try to access to the web site

Code:
config.php
<?php  /// Moodle Configuration File

unset($CFG);

$CFG->dbtype    = 'mysql';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'moodleuser';
$CFG->dbpass    = 'XXXXXXXX';
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';

$CFG->wwwroot   = 'http://trainer.moodle.org';
$CFG->dirroot   = '/var/www/moodle';
$CFG->dataroot  = '/opt/moodle_data';
$CFG->admin     = 'admin';
$CFG->reverseproxy = true;
$CFG->sslproxy  = 1;

i think you have in config like this
$CFG->wwwroot = 'http://10.21.21.122';
 
Last edited:
  • Like
Reactions: Sikjairi

Code:
config.php
<?php  /// Moodle Configuration File

unset($CFG);

$CFG->dbtype    = 'mysql';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'moodleuser';
$CFG->dbpass    = 'XXXXXXXX';
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';

$CFG->wwwroot   = 'http://trainer.moodle.org';
$CFG->dirroot   = '/var/www/moodle';
$CFG->dataroot  = '/opt/moodle_data';
$CFG->admin     = 'admin';
$CFG->reverseproxy = true;
$CFG->sslproxy  = 1;

i think you have in config like this
$CFG->wwwroot = 'http://10.21.21.122';
Exactly that was my fault , now the problem resolved Thank you all guys for your support , have a nice day to you all .
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!