Apache reverse proxy for RDS Oracle - oracle

I have 4 Oracle RDS instaces, and they have their onw url, but they do not have a fixed IP address. And that's a problem to me, because I need a fixed IP to add to the VPN tunnel.
Example db connection url:
oracle1.us-east-1.rds.amazonaws.com
oracle2.us-east-1.rds.amazonaws.com
oracle3.us-east-1.rds.amazonaws.com
oracle4.us-east-1.rds.amazonaws.com
my conf.d/http.conf file:
<VirtualHost *:1521>
ServerName oracle1.mydomain.com
ProxyPass / tcp://oracle1.us-east-1.rds.amazonaws.com/
ProxyPassReverse / tcp://oracle1.us-east-1.rds.amazonaws.com/
</VirtualHost>
<VirtualHost *:1521>
ServerName oracle2.mydomain.com
ProxyPass / tcp://oracle2.us-east-1.rds.amazonaws.com/
ProxyPassReverse / tcp://oracle2.us-east-1.rds.amazonaws.com/
</VirtualHost>
<VirtualHost *:1521>
ServerName oracle3.mydomain.com
ProxyPass / tcp://oracle3.us-east-1.rds.amazonaws.com/
ProxyPassReverse / tcp://oracle3.us-east-1.rds.amazonaws.com/
</VirtualHost>
<VirtualHost *:1521>
ServerName oracle4.mydomain.com
ProxyPass / tcp://oracle4.us-east-1.rds.amazonaws.com/
ProxyPassReverse / tcp://oracle4.us-east-1.rds.amazonaws.com/
</VirtualHost>
I tryed to use jdbc, http, https protocols in the URLs, apache do no accept url without the protocol.

Related

why show me ':8000' in my vircualhost in laragon?

in host file :
#
127.0.0.1 localhost
::1 localhost
127.0.0.1 daily_tasks.local #laragon magic!
D:\laragon\etc\apache2\sites-enabled\auto.daily_tasks.local.conf :
<VirtualHost *:80>
DocumentRoot "D:/laragon/www/daily_tasks/public"
ServerName daily_tasks.local
ServerAlias *.daily_tasks.local
<Directory "D:/laragon/www/daily_tasks/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# If you want to use SSL, enable it by going to Menu > Apache > SSL > Enabled
but whene run php artisan serv for run laravel. in browser this url http://daily_tasks.local:8000/ is working!
I don't want it to be displayed :8000 !
Laragon provides friendly url when the server is up. Only put your folder into www folder and restart Apache in Laragon, it'll detect a new project and that is all. You won't need php artisan serve.
DOCS: https://laragon.org/docs/pretty-urls.html
how about proxy pass?
<VirtualHost *:80>
...
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/
...
</VirtualHost>

Laravel route getting ruined when trying to reach HTTP request

Currently I have successfully setup my Laravel Passport API
Using Laravel 5.8.
I have this httpd-vhosts.conf config for my api
PORT: 80
<VirtualHost *:80>
ServerName <sub-domain>.<domain>.com
ServerAlias <sub-domain>.<domain>.com
Redirect permanent / https://<sub-domain>.<domain>.com
</VirtualHost>
PORT: 443
<VirtualHost *:443>
DocumentRoot "/opt/lampp/htdocs/api_tk/public"
<Directory "/opt/lampp/htdocs/api_tk/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName <sub-domain>.<domain>.com
ServerAlias <sub-domain>.<domain>.com
ErrorLog "logs/API-error_log"
CustomLog "logs/API-access_log" common
ProxyPreserveHost On
ProxyRequests Off
ProxyPassMatch /fingerprint http://localhost:5000
ProxyPassReverse /fingerprint http://localhost:5000
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-FOrwarded-Port 443
SSLEngine on
SSLCertificateFile "/opt/lampp/htdocs/ssl_key/svs-file.crt"
SSLCertificateKeyFile "/opt/lampp/htdocs/ssl_key/private_new.key"
SSLCACertificateFile "/opt/lampp/htdocs/ssl_key/svs-bundle-file.crt"
</VirtualHost>
443 is working fine I can see my HTTPS SSL Lock sign on my browser
But
When I try to do HTTP request
Laravel API always getting ruined.
I have route like this
https://..com/api/login
and this is working fine
But when I tried to do HTTP request like this
http://<sub-domain>.<domain>.com/api/login
it always end up to
https://<sub-domain>.<domain>.comapi/login
Where the slash is missing. This is because of the redirect permanent on my PORT 80 config.
I have this route for my api. (api.php)
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::post('/timekeeping','Auth\Api\AuthController#timekeeping');
Route::post('/login','Auth\Api\AuthController#login');
Route::middleware('auth:api')->group(function () {
Route::post('/timekeeping_app','Auth\Api\AuthController#timekeeping_app');
Route::post('/logout','Auth\Api\AuthController#logout');
Route::post('/register','Auth\Api\AuthController#register');
Route::post('/show_dtr_list','Auth\Api\AuthController#show_dtr_list');
Route::post('/update','Auth\Api\AuthController#update');
Route::post('/delete','Auth\Api\AuthController#delete');
Route::post('/search_user','Auth\Api\AuthController#search_user');
Route::get('/current_time','Auth\Api\AuthController#current_time');
});
How can I prevent this?
UPDATE
Tried to do edit my vhosts config like this
Redirect permanent "/" "https://<sub-domain>.<domain>.com/"
And
Redirect permanent / https://<sub-domain>.<domain>.com\/
But this gives me an output like this
try do add slash under your apache virtual host settings:
<VirtualHost *:80>
ServerName <sub-domain>.<domain>.com
ServerAlias <sub-domain>.<domain>.com
# fix below
Redirect permanent / https://<sub-domain>.<domain>.com/
</VirtualHost>

Host 2 application under one domain Apache HTTPD

I'm trying to configure Apache HTTPD 2.4 to front two different applications being hosted on the same server.
App1 is reachable on port 8080 (Tomcat)
mysingledomain.com:8080
App2 is reachable on port 3030 (Ruby [Dashing])
mysingledomain.com:3030
What I want to do is reach them respectively as mysingledomain.com/App1 and mysingledomain.com/App2
My situation is a lot like how this question start:
Host 2 Sites in HTTPD
These are both SPA applications but I'm getting quite confused on how to set this up when I do not have a DocumentRoot to separate the configuration.
How would I setup HTTPD to front the HTTP requests in this manner?
I was able to configure the ruby application to adhere to a subpath with the following configuration, but this affects the other:
<VirtualHost *:80>
ProxyRequests On # <---- WARNING DO NOT DO THIS
ProxyVia On
ProxyPreserveHost On
RewriteEngine On
ProxyPass "/app2" "http://192.168.0.62:3030/" retry=0
ProxyPassReverse "/app2/" "http://192.168.0.62/"
RewriteRule "^/assets/(.*)" "/app2/assets/$1" [R]
RewriteRule "^/views/(.*)" "/app2/views/$1" [R]
</VirtualHost>
It should be as simple as this:
<VirtualHost *:80>
ServerName mysingledomain.com
ProxyPreserveHost On
ProxyPass /App1/ http://127.0.0.1:8080/
ProxyPassReverse /App1/ http://127.0.0.1:8080/
ProxyPass /App2/ http://127.0.0.1:3030/
ProxyPassReverse /App2/ http://127.0.0.1:3030/
</VirtualHost>

How to point Godaddy Domain to Amazon EC2?

I am running a Node.JS HTTP server on an Amazon EC2 instance.
My IP address and port are 54.169.62.98:7001. How do I point my Godaddy domain to this IP and port?
Is it possible to use a port other than 80?
Yes, simple.
Go to godady DNS manager and add a type A record pointing to your ip address like bellow.
Then go to your aws-ec2 console and add a custom inbound TCP rule under your AWS security group like bellow.
Open firewall for 7001/tcp on your server sudo ufw allow 7001/tcp
Run the node.js app on your server and then type 54.169.62.98:7001 on your browser
Good luck!
Some protocols such as XMPP can use SRV records, which does allow you to publish the port used. However, in the general case, especially web traffic, you can't point an A record to a TCP port.
It sounds like you would want to either get Node to listen on port 80, or install a reverse proxy (such as Nginx) on your EC2 instance to forward traffic on port 80 to 127.0.0.1:7001. There's a simple guide here.
Yes, you can point any instance of AWS via GoDaddy domain. You have to save A record for hit your instance via host # and point to your IP(54.169.62.98), after this you can hit you IP but not port 7001, for port distribution you will have to some config some file.
for Virtual host
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.example.org
ServerAlias example.org
Redirect permanent / https://example.org/
</VirtualHost>
For ssl config
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster#localhost
ServerName example.org
DocumentRoot /var/www/html
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:7001/
ProxyPassReverse / http://localhost:7001/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCertificateFile /home/ubuntu/today.crt
SSLCertificateKeyFile /home/ubuntu/today.key
SSLCertificateChainFile /home/ubuntu/intermediate.crt
SSLCACertificateFile /home/ubuntu/intermediate.crt
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>

Proxy Pass exclusion

<VirtualHost 172.16.0.21:80>
ServerName test.com
DocumentRoot /usr/local/liferay/tomcat7/webapps
ErrorLog logs/error_log
CustomLog logs/default-access_log common
ProxyRequests Off
ProxyPass /owa !
ProxyPass / ajp://127.0.0.1:8009/
SSLCertificateFile /etc/pki/tls/certs/star_weconnor.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/weconnor.com.key
SSLCACertificateFile /etc/pki/CA/certs/EntrustSecureServerCA.crt
Now I want to add a open webanalytics in /var/www/html/owa. So it will be : http://test.com/owa but when I access this site it looks like its being forwarded to Tomcat http 404 not found) .how to make this working

Resources