I am attempting to setup a web server and I'm not sure where to proceed troubleshooting. Here's where I am at:
I installed apache
I pointed my domain to afraid.org (Dynamic DNS service) and installed their software on the server
Enabled port forwarding on my router for HTTP (80) VNC (5500), SSH (22). As well as enabled DMZ host for the server. My router is a Westell 7500.
The server hosts on the local network appropriately using both the the server's IP or my domain -- which I believe indicates the Dynamic DNS is working. However I cannot access the website on another network.
Here are the contents for my ports.conf file:
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>`
Check configuration of iptables. And also check if virtual server is properly configured to accept connections from outside.
Related
**I have seen a similiar question here, with no proper answer
I want both Apache and Node.js to run on port 80, so that it won't be necessary to type port number at the address bar.
But my Node.js app won't work when I listen on port 80 instead of 3000, I guess that's because Apache is already on 80.
Or, the solution requires to actually use other port than 80 and somehow hide it?
In TCP, you can only run 1 service per port. As soon the port is assigned to a service, it becomes unavailable to anybody else.
However there is a way to share port betwen NODE and APACHE, proxying the connections using an Apache 2 Module (mod_proxy and mod_proxy_http). You can get more details here:
how to put nodejs and apache in the same port 80
Apache configuration example to use Apache in requests to http://example.com/
and Node.js for requests to http://example.com/node/:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example/
<Location /node>
ProxyPass http://127.0.0.1:8124/
ProxyPassReverse http://127.0.0.1:8124/
</Location>
</VirtualHost>
I'm trying to access an internally hosted application on my QNAP at my externally hosted domain, http://mydomiain.com, instead of http://mydomiain.com:12345
I can get the reverse proxy to work when I enter a local IP address of my network, for example the IP address of my QNAP, however, I can't seem to figure out why it wont work from an external domain name. As far as I can tell, the traffic flow is there, I just don't understand why it wont connect.
Is this whole thing even possible or is this not how reverse proxies work?
Current setup:
[External] - Domain DNS:
A Record: Points to home IP address.
[Internal] - Home Router:
Port forwards port 12345 to the IP address of the local server.
[Internal] - Home Server:
Has a revserse proxy setup on the QNAP that is configured as such:
<VirtualHost *:80>
ServerName http://mydomiain.com/
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
Order allow,deny
Allow from all
</Location>
ProxyPreserveHost On
ProxyPass / http://localhost:12345/
ProxyPassReverse / http://localhost:12345/
ProxyStatus On
</VirtualHost>
Ok, so it seems that my issue was on my home router. I was port forwarding the application port, where I needed to port forward port 80 to allow the web traffic.
i have a problem with setting up an apache reverse proxy server and hope you can help.
I have 3 ubuntu web servers, available on https://service1.domain.com, https://service2.domain.com:4433 and so on...
Now, i will access these servers without typing the port in the addressbar.
So my idea is to use an reverse proxy server, that i can type in service2.domain.com and it redirects to service2 (https).
I installed an ubuntu server with apache and enabled the modules:
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
Then i set up the 000-default.conf on the proxy with the following content:
<VirtualHost service1.domain.com:80>
ProxyPreserveHost On
ProxyPass / https://service1.domain.com/
ProxyPassReverse / https://service1.domain.com/
</VirtualHost>
<VirtualHost service2.domain.com:80>
ProxyPreserveHost On
ProxyPass / https://service2.domain.com/
ProxyPassReverse / https://service2.domain.com/
</VirtualHost>
The ports 80 and 443 on the router are forwarded to the proxy server.
On the service(1-3) servers, SSL is enabled with certificates from Lets Encrypt.
Now, if i try to open site service1.domain.com, i get an error (cert_name).
The sites now should not be accessible directly, because there is no port forwarding anymore.
My question is now, how is the right config for reverse proxies? Do i need to enable a certificate for each service also on the proxy server?
Thank you for your help!
Not exactly sure what your end goal is. The certificate is for the client facing server. If you want people to hit the site without having to set the port, you can use the Redirect statement in the virtual host config.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect permanent / https://www.example.com
</VirtualHost>
Which would forward any non ssl traffic to use the ssl virtual host.
I am running a java web application on tomcat 7.0, which is setup on media temple Ubuntu 16.04 server. The application is running on port 8080, and I have a domain which is binded to the port.
e.g. public-ip-of-server:8080 xyz.com
Now, I want to run a node js application (rocket-chat) on the same Linux server using port 3000. I have configured the whole application, and the application is running on localhost:3000/ but when I am trying to access the application using public IP of the server (e.g. public-ip:3000/), I am not able to access it.
I have allowed the traffic on port 3000 using command,
ufw allow 3000
I also edited apache2.conf,
ProxyPass /rocketchat http://public-ip-of-server:3000/
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module
modules/mod_proxy_http.so
but after changing this parameter I am not able to restart the apache2 service.
so I revert back the changes.
what should I do to run both the application (java and node js) on the same Linux server ? can anyone please help me out.
Just bind nodejs app to interface 0.0.0.0 instead of 127.0.0.1.
In your Apache configuration, you should use the localhost instead of public ip. So instead of:
ProxyPass /rocketchat http://public-ip-of-server:3000/
use:
ProxyPass /rocketchat http://localhost:3000/
I am using Ubuntu server so httpd.conf is not present there, so I have created another file, in sites-available folder of apache2.(e.g xyz.conf).
I have two domain which pointing to the same media temple name server,
I used one domain for pointing tomcat application on port 8080 and another domain for node js application on port 3000, by making virtual host in xyz.conf
<VirtualHost *:80>
ServerName xyz.com
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
<VirtualHost *:80>
ServerName abc.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
After this I enabled proxy mode using command :
sudo a2enmod proxy
And also make this xyz.conf file as site configuration file, using command,
sudo a2ensite xyz.conf
It will ask you to reload the apache2 service,
just reload it and restart,
e.g sudo systemctl restart apache2.service
The problem resolved by forwarding the request, which is received on port 80 of apache2, to tomcat:8080 and nodejs:3000, by creating virtual host.
I want to install multiple apache servers on ec2 linux servers operating at different ports and having different file structures in one ec2 linux machine.
Please guide me on how can i install multiple apache servers in one machine.
You can just run a single apache server using the VirtualHost directive.
For example:
<VirtualHost *:80>
ServerName www.example.org
DocumentRoot /www/otherdomain-80
</VirtualHost>
<VirtualHost *:8080>
ServerName www.example2.org
DocumentRoot /www/otherdomain-8080
</VirtualHost>
Will listen to both port 80 and 8080 running the same apache server. Running two apache instances on the same server is possible but it's kinda messy. Keep in mind that any port > 1024 is protected by Linux, you will only be able to bind ports 443 and 80 with Apache, otherwise it has to be ports 1025 and above.
More information here:
http://httpd.apache.org/docs/2.2/vhosts/examples.html