Proxy Pass exclusion - proxy

<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

Related

why my http redirect don't work with nagios?

I have a webserver with nagios, nagios is the only service working in this vm, so I want when I go to the root https://mymachine to redirect directly to https://mymachine/nagios.
I have made a configuration like this
<VirtualHost *:443>
ServerName mymachine.mydomain
ServerAdmin root#mymachine.mydomain
Redirect / https://mymachine.mydomain/nagios
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/nagios1.mymachine.mydomain.crt
SSLCertificateKeyFile /etc/pki/tls/private/nagios1mymachine.mydomain.key
SSLCACertificateFile /etc/pki/tls/certs/mymachine.mydomain.crt
</VirtualHost>
Restart http and..disaster! Firefox open the page
https://nagios1.mymachine.mydomain/nagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagiosnagios
and give the "redirect loop" error.
Consider I have also a redirect from http to https
active
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
If I remove it is the same thing.
Any solution?
Thanks
Solution found.
<VirtualHost *:80>
ServerName nagios1.mymachine.mydomain
ServerAdmin root#mymachine.mydomain
Redirect "/" "https://nagios1.mymachine.mydomain/nagios"
</VirtualHost>
<VirtualHost *:443>
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/nagios1.mymachine.mydomain.crt
SSLCertificateKeyFile /etc/pki/tls/private/nagios1mymachine.mydomain.key
SSLCACertificateFile /etc/pki/tls/certs/mymachine.mydomain.crt
</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>

Virtual Hosts with Laravel and Apache, cannot set ip to website name

I want to set the ip for my website to an alphabetized name (i.e. http://54.183.131.205 to http://www.rblog.com). Although I have configured my rblog.com.conf in /etc/apache2/sites-available, enabled it and reloaded my apache server, and then adding to my /etc/hosts file 54.183.131.205 www.rblog.com (a tab between the ip and website name), typing in www.rblog.com into my browser doesn't redirect me to my index.php file. However, note that when I type in the ip address in the browser it takes me to my index.php file (I believe this means my rblog.com.conf file is correct?).
<VirtualHost *:80>
ServerAdmin webmaster#rblog.com
ServerName www.rblog.com
ServerAlias www.rblog.com
DocumentRoot /var/www/html/rblog/public
<Directory /var/www/html/rblog/public>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
<FilesMatch \.php$>
</FilesMatch>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#rblog.com
ServerName rblog.com
ServerAlias www.rblog.com
DocumentRoot /var/www/html/rblog/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
We can use the a2ensite tool to enable each of our sites like this:
sudo a2ensite example.com.conf
sudo a2ensite test.com.conf
When you are finished, you need to restart Apache to make these changes take effect:
sudo service apache2 restart
/etc/hosts file
54.183.131.205 rblog.com

Laravel Block Https Request

I'm developing laravel project, let's say www.domain.net
but when i try to enter https://www.domain.net
it's show the directory list with my server info (like Apache)
how to block access to https?
your httpd.conf should look something like this.
<VirtualHost *:443>
ServerAdmin john#email.com
#DirectoryIndex index.php
DocumentRoot "/var/www/html/project"
ServerName www.abc.com
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /path/certificate.crt
SSLCertificateKeyFile /path/certificate.key
SSLCertificateChainFile /path/keychain.crt
ServerAlias abc.in
ErrorLog logs/abc.in-error_log
CustomLog logs/abc.in-access_log common
<Directory "/var/www/html/project">
Options Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Two Copies of Magento Installation on Localhost

My goal is two have two versions of Magento installed in my Sites/ folder. One is the current version we are using (1.12), and the other is the upgraded version (1.14). There are several reasons why I need to do this.
Another developer upgraded Magento and sent over the site files, which I put in Sites/magento2.dev, and I also have the working original in Sites/magento1.dev.
I created a separate database, imported the dump from the upgraded version, and put this in the local.xml file for magento2:
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[mypassword]]></password>
<dbname><![CDATA[mydatabase]]></dbname>
<active>1</active>
Then I went into the database and changed the core_config_data base urls for our three websites to mimic what I had set on the older version:
http://www.magento2.dev/
http://www.magento2-b.dev/
http://www.magento2-c.dev/
I updated my /etc/apache2/extra/httpd-vhosts.conf file:
# Virtual Hosts
# Note: You also need to edit the hosts file /private/etc/hosts
NameVirtualHost *:80
#magento1.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
<Directory "/Users/myuser/Sites/magento1.dev">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName magento1.dev
ErrorLog "/private/var/log/apache2/magento1.dev-error_log"
CustomLog "/private/var/log/apache2/magento1.dev-access_log" common
</VirtualHost>
#magento-b.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName magento1-b.dev
ErrorLog "/private/var/log/apache2/magento1-b.dev-error_log"
CustomLog "/private/var/log/apache2/magento1-b.dev-access_log" common
</VirtualHost>
#magento-c.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName magento1-c.dev
ErrorLog "/private/var/log/apache2/magento1-c.dev-error_log"
CustomLog "/private/var/log/apache2/magento1-c.dev-access_log" common
</VirtualHost>
#magento2.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2.dev
ErrorLog "/private/var/log/apache2/magento2.dev-error_log"
CustomLog "/private/var/log/apache2/magento2.dev-access_log" common
</VirtualHost>
#magento2-b.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2-b.dev
ErrorLog "/private/var/log/apache2/magento2-b.dev-error_log"
CustomLog "/private/var/log/apache2/magento2-b.dev-access_log" common
</VirtualHost>
#magento2-c.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2-c.dev
ErrorLog "/private/var/log/apache2/magento2-c.dev-error_log"
CustomLog "/private/var/log/apache2/magento2-c.dev-access_log" common
</VirtualHost>
I updated my /private/etc/hosts file:
127.0.0.1 localhost
127.0.0.1 www.magento1.dev
127.0.0.1 www.magento1-b.dev
127.0.0.1 www.magento1-c.dev
127.0.0.1 www.magento2.dev
127.0.0.1 www.magento2-b.dev
127.0.0.1 www.magento2-c.dev
I have tried a few other iterations of this (adding trailing slashes, http, www, etc), always with the same result. When I go to www.magento2.dev, www.magento2-b.dev, or www.magento2-c.dev, I get a slightly different version (fonts broken) of my old version of the site (www.magento1.dev), but with the new URL. Logging into the backend, I can see that it is 1.12, and the URL changes to the older version. Basically it seems like I just made three new local domains for the old version of the primary store website.
I've restarted apache and mysql about a million times.
I should also note that if I got to http://localhost/~myuser/magento2.dev, I get a 403 notice.
What am I missing here?
First, match the ServerName in your httpd.conf with the corresponding domains you added in your local hosts file. Also try viewing the logs i realtime when you visit any of the urls in your browser.
$ cd /private/var/log/apache2/
$ tail -f magento1-b.dev-error_log
You can also tail all the log files at once to see which vhost gets a hit when visiting any of the localhost host file domains in your browser.
$ cd /private/var/log/apache2/
$ tail -f *.log
Also, test if the vhost's are working by creating a simple .php file in Magento root and visit it with your browser. For example, create /Users/myuser/Sites/magento1.dev/info.php with the following content:
<?php
echo gethostname() . "\n";
echo getcwd() . "\n";
?>
Visit http://www.magento1.dev/info.php
Visit http://www.magento2.dev/info.php
Verify local hosts file (Mac)
127.0.0.1 www.magento1.dev
127.0.0.1 www.magento1-b.dev
127.0.0.1 www.magento1-c.dev
127.0.0.1 www.magento2.dev
127.0.0.1 www.magento2-b.dev
127.0.0.1 www.magento2-c.dev
Otherwise, use this as a minimum httpd.conf (with matching ServerName. This currently works in my local MAMP environment.)
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1.dev
ErrorLog "/Users/myuser/Sites/magento1.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1-b.dev
ErrorLog "/Users/myuser/Sites/magento1-b.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1-b.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1-c.dev
ErrorLog "/Users/myuser/Sites/magento1-c.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1-c.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2.dev
ErrorLog "/Users/myuser/Sites/magento2.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2-b.dev
ErrorLog "/Users/myuser/Sites/magento2-b.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2-b.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2-c.dev
ErrorLog "/Users/myuser/Sites/magento2-c.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2-c.dev-access_log" common
</VirtualHost>
If you have working vhost's, then check the index.php & .htaccess files within each copy of Magento for any hard-coded domain or store code occurrences.

Resources