Provision headers are shown error in google chrome when using apache virtual host - linux

I have to tomcat servers running in my server. And I wanted to do a virtual host routing. So initially I tried it with one tomcat which is running in 8081 port and ajp port enabled to 8011 in the tomcat server.xml file
My conf file in the /etc/apache2/sites-available/mydomain_name.com.conf looks likes this
<VirtualHost *:80>
ProxyRequests off
ProxyPreserveHost On
ServerName mydomain_name.com
ServerAdmin ubuntu#mydomain_name.com
ProxyPass / ajp://localhost:8011/
ProxyPassReverse / ajp://localhost:8011/
</VirtualHost>
Then I did
sudo a2ensite mydomain_name.com.conf
sudo service apache reload
Every thing went find, no issues. And I also ensured the port 8011 is listening.
But when I try to access the server from my personal laptop, the request is blocked by Google chrome.
I have enabled these configurations in the server too.
sudo a2enmod proxy
sudo a2enmod proxy_ajp
sudo a2enmod proxy_http
sudo service apache2 restar
Have anyone has came across this issue ? Shedding some light would be really helpful. Because I have done some thing similar 1 year back, then this issue did not occur, and I'm only trying to direct it to the tomcat home page. Which is a bare minimal page.

After several frustrating hours found the issue. Hope this might help if any one came across this same issue.
Although the port 80 was opened via the aws management console security groups, internally the ports were firewall protected by the ip tables. So by removing the ip-tables entry for the port 80 I was able to make the virtual host work.

Related

Running Node.Js and Apache on the same server and different domain

I have a web server which contains the files for both domains
1-exemple.id and 2-exemple.info.
I want to run Wordpress on "1" and NodeJs for "2".
1" points to the directory /home/xxxxx/public_html and 2" points to the directory /home/xxxxx/public_html/xxxxx.info.
The issue here is that I have tried a couple of times to get this working. I used iptables for forwarding traffic from port 3000(NodeJs) to 80. This made it worse as the NodeJs server is now showing on both domains 1" and 2".
Looking forward to hear your suggestions.
Please note: I am using CentOs7
If you want to forward traffic to a different port you need to configure Apache as a proxy in your virtual hosts file:
ProxyPass "/" "http://127.0.0.1:3000"
ProxyPassReverse "/" "http://127.0.0.1:3000"
Make sure you activate the proxy modules for Apache:
sudo a2enmod proxy
sudo a2enmod proxy_http

apache virtual host subdomains is accessable only by localhost

i am try to make my pic.localhost virtual host accessible to public network(all of the internet)
now the problem is that it works only on the same machine in address pic.localhost but its not accessible even by lan network, only by the machine who runs it. what should i do?
i add and edited this files to make my pictures sub domain site:
1 - i included the httpd-vhosts file in my httpd.conf file.
2 - i added to httpd-vhosts file this lines:
<VirtualHost *:80>
ServerAdmin admin#domain
DocumentRoot "/opt/lampp/htdocs/"
ServerName pic.localhost
# ServerAlias www.pic.localhost
ErrorLog "logs/picture-error_log"
CustomLog "logs/picture-access_log" common
</VirtualHost>
3 - i added this line to /etc/hosts
127.0.0.1 pic.localhost
4 - i restarted the xampp server
i am running xampp 5.6.8 on Centos 7 machine.
Centos 7 has a firewall that by default blocks some ports (including port 80).
in the comand line, with sudo privileges try..
service firewalld stop
then in the terminal see you CENTOS LAN IP (ifconfig) and try to access that ip (ex 192.168.1.100).
if you are able to access the web-server. then try from another machine and in the browser tipe http://centos-lan-ip where centos-lan-ip is your centos machine IP.
Hope this works

How to run sails.js application on port 80 with example?

I have to put sails.js in port 80, but apache is already using it. How can I put both (sails.js and apache) on the same port 80? I need it because in my company all the ports are blocked except for PORT 80. (This is a realtime application with nodejs and socket.io (websockets) and in the other side a php application). Thanks a lot
You have to run Sails on any free port (1337, for example) and use Apache with mod_proxy. Make sure it's loaded in Apache config, then your virtual host will be something like this:
<VirtualHost *:80>
ServerName www.youserver.com
ProxyPass / http://localhost:1337/
ProxyPassReverse / http://localhost:1337/
</VirtualHost>
See mod_proxy documentation for more details.
Put nginx in front of sailsjs, and dump apache, or make apache run on a different port.
DigitalOcean has a great tutorial on doing this with two nodejs apps.. You can find it here.
I also wrote a blog post about it here
I do this on my server so i can run ghost blog, and sailsjs on the same server. This is how i have it setup.
NGINX Proxies blog.gorelative.com -> localhost:2368
NGINX Proxies gorelative.com -> localhost:1337
Just adapt the tutorial to proxy one domain to localhost:1337 for sailsjs, and add in the other hosts to host them normally.. or proxy the others to apache2, which probably is a waste of resources and not ideal.
AFAIK: With a bit more work your hosts don't even need to be on the same server. nginx can proxy to another server, and also do load balancing tasks.

pump.io port in URL

I just installed pump.io on my server (CentOS 6.5, x64), and I also have a Ghost blog (blog.mydomain.example) hosted on my server, which is behind Apache. The home page of my site is a static html page.
Now the problem is: when I visit social.mydomain.example, I'll be redirected to my blog (the URL is still social.mydomain.example). I can only visit pump.io by entering social.mydomain.example:31337 and the user link would be something like social.mydomain.example:31337/test. How can I make the port number disappear in the URL and visit pump.io via social.mydomain.example? Thanks!
Here are some configurations on my server:
Apache host settings:
<VirtualHost *:80>
ServerName blog.mydomain.example
ProxyPreserveHost on
ProxyPass / http://127.0.0.1:2368/
</VirtualHost>
<VirtualHost *:80>
ServerName mydomain.example
ServerAlias www.mydomain.example
ProxyRequests off
DocumentRoot /var/www/html
</VirtualHost>
How I installed pump.io
cd /usr/bin/nodejs/
git clone https://github.com/e14n/pump.io.git
cd pump.io
npm install
cd pump.io/node_modules/databank
npm install databank-mongodb
cd /usr/bin/nodejs/pump.io/bin
forever start pump
My pump.io configuration
cat /etc/pump.io.json
{
"driver": "mongodb",
"params": {"host": "localhost"},
"secret": "pumpiol",
"noweb": false,
"port": 31337,
"site": "social.mydomain.example",
"owner": "NetAdmin",
"ownerURL": "http://mydomain.example",
"hostname": "social.mydomain.example",
"nologger": false,
"serverUser": "pumpio",
"uploaddir": "/var/local/pump.io/uploads",
"debugClient": false,
"firehose": "ofirehose.example"
}
My iptables configuration
-A INPUT -m state --state NEW -m tcp -p tcp --dport 31337 -j ACCEPT
My DNS zone file:
A (Host)
Host Points To
# M.Y.I.P
CName (Alias)
Host Points To
blog #
social #
www #
OK since I got the badge of Tumbleweed, I'm encouraged to provide an answer.
For those like me who want a self-own microblogging service along with a blog, a home page (multiple sub-domains with one host server), while don't want the port number shown in the url, I recommend storytlr. It meet all my needs and it has been easily installed on a CentOS server (mine is 6.5, x64). The latest stable release is 1.20. Simple and direct.
What you're doing is running pump.io behind a web server. The simplest and recommended installation is to run pump.io standalone, if you have the extra IP address for it.
The other common way of running pump.io is to put it behind nginx. Apache is not as well suited to this kind of reverse proxying/websockets work. Many of us have started out trying pump.io behind Apache and switched to nginx because it's easier to configure and troubleshoot.
See http://jrobb.org/moving-my-pump-home.html or http://sjoberg.fi/blog/pumpio.html for examples.

How to load my app from client's domain name

I am building a SAAS product which is hosted on abc.com and i will have few clients with domains client1.com, client2.org, client3.in etc.
Now i want to serve my application to each client on their domains like client1.com/app, client2.com/app, client3/com/app
I dont want to host my code on their server..There will only be 1 base code & 1 DB which will be on my site abc.com. So my entire app should run on their domain
The question is, how do I configure this ? I mean client.com will point to their server but client.com/app will execute my application from my server with base url of their own domain ?
Thanks..
So i acheived this by using mod_proxy in virtual host config file of client's server by adding the following line
ProxyRequests off
ProxyPreserveHost off
ProxyPass /app http://mydomian.com
ProxyPassReverse /app http://mydomian.com
ProxyHTMLURLMap http://mydomian.com http://client.com/app
SetOutputFilter INFLATE;proxy-html;DEFLATE
It should be noted that proxy, proxy_http & proxy_html modules must be enabled which can be done by following commands
sudo a2enmod proxy
sudo a2enmod proxy_http
proxy_html might not generally be available so it can be downloaded using this command
sudo apt-get install libapache2-mod-proxy-html
Link - http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Resources