How to Marry Local apache web domain? - javascript

I bought a domain on internet, i want on that domain put my application. My application was developed on Sails.js, and i made a virtual host with apache2 using the module mod_proxy.
How do I do to on the domain i bought on internet, put my application?
My virtual host is:
NameVirtualHost 111.11.11.111
<VirtualHost *:80>
ServerName app.domain.com.ve
ServerAlias www.app.domain.com.ve
ServerAdmin 111.11.11.111:1337
RewriteEngine on
ProxyPass / http://111.11.11.111:1337/
ProxyPassReverse / http://111.11.11.111:1337/
CustomLog /home/user/app/apache2log/accessApp.log combined
ErrorLog /home/user/app/apache2log/errorApp.log
</VirtualHost>
And my /etc/hosts:
111.11.11.111 www.app.domain.com.ve

You isp will provide a administration panel to update the A Record. You need to update your DNS records to point to your server where your application is hosted.
You need to host in a datacenter. Try AWS/Azure/Google Cloud/linode that provides a small server and provides an external network interface on the internet. Publish your application on that host. You should be able to access your application by your public IP. You can then go your domain control panel and modify your A Record.

Related

Assign Remote MongoDB ip to a Domain Name

I have installed mongoDB in GCP virtual machine. I am using apache reverse proxy to forward my domain 'example.com' to mongoDB port http://localhost:27017.
When I try to connect my remote db using:
mongo -u admin -p admin example.com it does not work. But when I try connect my remote db using:
mongo -u admin -p admin remote_ip:27017 it works. How can I make the domain part working. Here is my Apache .conf file:
<VirtualHost *:80>
ServerName example.com
<Proxy balancer://mycluster>
BalancerMember http://127.0.0.1:27017
</Proxy>
ProxyPreserveHost On
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/
</VirtualHost>
You made an HTTP proxy. Mongo shell attempts to create a persistent TCP connection, which your proxy doesn't know how to deal with.
I'm not sure if Apache even can do this. It's really just meant to pass on http requests. I do know nginx can do it. Here is more info on how:
https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/

Keycloak Admin Console showing a blank page

I have configured a Keycloak server with Apache at the front acting as a reverse proxy. Keycloak is running on http mode only, all the SSL is being handled by Apache. I've configured the whole system according to the official Keycloak docs.
The problem I'm facing is, on accessing the Keycloak admin console from a machine other than localhost, the page is blank (except the navbar). On accessing from the machine on which it is hosted (localhost), it works fine, but on accessing from any other machine it just shows a blank page. The server also does not throw any error. I'm attaching an image of the blank admin page below.
(source: firefoxusercontent.com)
Another thing to note would be, other pages, like my account page, are working fine. The problem is only with the main admin page. Also, I've noticed that the admin page is an Angular app, so that may be relevant.
Relevant configs and settings I'm using.
Keycloak settings (CLI commands).
embed-server --server-config=standalone.xml
/subsystem=undertow/server=default-server/http-listener=default/:write-attribute(name=proxy-address-forwarding,value=true)
/socket-binding-group=standard-sockets/socket-binding=proxy-https/:add(port=443)
/subsystem=undertow/server=default-server/http-listener=default/:write-attribute(name=redirect-socket,value=proxy-https)
Apache config.
<VirtualHost *:80>
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Redirect permanent '/' https://%{HTTP_HOST}
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/html
ProxyPreserveHost On
ProxyRequests Off
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
ProxyPass /auth http://127.0.0.1:8080/auth
ProxyPassReverse /auth http://127.0.0.1:8080/auth
SSLEngine on
SSLCertificateFile /etc/ssl/certs/oauth-server.crt
SSLCertificateKeyFile /etc/ssl/private/oauth-server.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>

How do I get nodejs to run without a port number on a Apache server

I have a nodejs api application running inside a codeigniter environment. Im trying to access the nodejs api's without using a port number in the url
currently you can only hit the node api at
http://wrl.xx.com:8010/api
And I would like to have it accessible through a url like :
http://wrl.xx.com/api/
I tried to run a reverse proxy with no success
<VirtualHost *:80>
ServerName wrl.xx.com
ProxyRequests off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://localhost:8010/
ProxyPassReverse / http://localhost:8010/
ProxyPreserveHost on
</VirtualHost>
Assuming you intend to differentiate requests looking for the nodejs app from requests seeking the codigniter app by seeing /api as the root path, try:
ProxyPass /api http://localhost:8010/api
ProxyPassReverse /api http://localhost:8010/api
See ProxyPass and ProxyPassReverse for more magic.
Disclaimer: I have no experience with codeigniter, so this may be non relevant, or false.
Your node.js server listen to port 8010, which is non standard, that is why you need to indicate it in the URL.
You seems to imply codeigniter is already listening to the standard port (80).
The way I see, with no knowledge of codeigniter, to go around the issue would be to either host all the node.js url in codeigniter, and redirect them to port 8010:
Client call /node on port 80
CodeIgniter call /node on himself at port 8010
Node get the request and answer
Code igniter gove the answer to the client
Or the reverse, which would be to host any codeigniter URL in node.js, and redirect them to whatever port codeigniter will listen.
Or you will need to configure Apache to redirect the request to port whatever codeigniter on or 8010 depending of the url.

hiding port number through .htaccess node.js express

I am running two node servers on my website. 1 is a socket.io server for live streaming data on the main site and the other is streaming JSON data to a sub-domain api.site.com.
my main node is running on port 8001 and the second is running on 8080. I have been able to hide the port number for the first one in .htaccess using
RewriteCond %{SERVER_PORT} 8001
but am struggling to hide the 8080 port.
If I add in RewriteCond %{SERVER_PORT} 8080 and go to my api location api.site.com/prices/all I get 404 not found error and if I go to api.site.com:8080/prices/all everything still works.
How can I hide the port so api.site.com/prices/all works?
This is also slightly linked to my other question: here where I want to deny other .get attempts so api.site.com/price wont work.
You can put your config directly in the domain.conf folder the following works for me every time. Port here is 8888 change customise that and the domain to your settings.
<VirtualHost *:80>
ServerName mydomain.foobar
ServerAlias mydomain.foobar
ServerAdmin info#lakes.world
DocumentRoot /path/to/mydomain.foobar/httpdocs
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://mydomain.foobar:8888/
ProxyPassReverse / http://mydomain.foobar:8888/
</VirtualHost>

importing certificates into firefox trusted root CAs programmaticaly by javascript

I'm developing a webrtc application with sipml5 in firefox.
firefox does not allow unsecure connection from secure origin.
I have created a self signed certificate for my Communication server Asterisk (Secure websocket serving sipml5). But every time i want to login to to asterisk from my sipml5 page i should open a tab, write "wss://myAsteriskURL:8088" to add a security exception for my asterisk websocket connection.
Can any body show me a way to programaticaly add my my "ca.cert" to Firefox's "TRUSTED ROOT Certificate Authorities" with javaxcript code?? if actually a way exists!
Thank you
No, it's not possible to inject your ca.cert inside browsers trusted root certificate authorities with js.
But I can tell you that I had exactly the same problem: users can't be asked to accept two times the same certificate to use a web page, and I solved in another way: using mod_proxy_wstunnel in Apache/2.4.20.
Now showing a single https server to provide web pages and sip signaling the user is required to accept just a single certificate.
Here is the relevant part of the config:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
<VirtualHost *:443>
DocumentRoot ...
ServerName clic2call.demo.sociale.it:443
ErrorLog ...
TransferLog ...
SSLEngine on
...
SSLProxyCheckPeerName off
SSLProxyEngine On
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
SSLProxyVerify none
ProxyPass /ws wss://127.0.0.1:8088/ws retry=0
</VirtualHost>
I hope it can be useful to solve your problem.

Categories