I am trying to publish, behind a proxy, a Spring app (also with Spring Security) which has /x/services as entry point. It is running in Tomcat in 8080 in Google Engine (Debian). I configure Apache 2 as a reverse proxy with next configuration
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ProxyRequests off
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
# Servers to proxy the connection, or
# List of application servers Usage
ProxyPass / http://127.0.0.1:8080/x/services/
ProxyPassReverse / http://127.0.0.1:8080/x/services
ServerName localizator.org
ServerAlias *.localizator.org
</VirtualHost>
I checked it against a lot of examples and seems it is OK, but the only response I am getting is the "Index of /" page. And Apache logs are not helping at all.
Any help will be very appreciated.
For those with a similar problem don't forget to do :
sudo a2ensite proxy-host
(lets suppose your .conf file name is proxy-host)
Related
I have build a SPA and deployed it to my server. It is running on http://my-server:3000.
I then installed Apache2 and created a static page. This website is on the same server http://my-server:80 and is open to the Internet via a My-domain.
What I'm trying to accomplish now is to add a link on this static page (http://my-server/foo) which is redirected to http://my-server:3000 in such a way that the here deployed SPA can be run from this sub-folder.
I configured a new Virtual host in Apache2 with the following configuration:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName My-domain
ProxyRequests Off
ProxyHTMLEnable On
ProxyHTMLExtended Off
ProxyPreserveHost On
ProxyPass /foo/ http://my-server:3000/
<Location /foo/>
ProxyHTMLURLMap / /foo/
ProxyPassReverse http://my-server:3000/
SetOutputFilter INFLATE;DEFLATE
</Location>
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Although the SPA is accessed and all the files are loaded the application will not start due to the error No match for URL in routes. I think it is due to the fact that the SPA is build to run in the root of a website and I'm now trying to run it in a sub-folder.
Does anyone know if this is possible? A solution would be appreciated much :-)
I found a solution which works for me :-)
Since I can use any prefix before My-domain like foo.My-domain, just found out recently, I changed the configuration for my Virtual host to this:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName foo.My-domain
ProxyRequests Off
ProxyHTMLEnable On
ProxyHTMLExtended Off
ProxyPreserveHost On
ProxyPass / http://my-server:3000/
<Location />
ProxyPassReverse http://my-server:3000/
SetOutputFilter INFLATE;DEFLATE
</Location>
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And because my SPA now is allowed to run in the root of a website it is working. :-)
I have a problem with apache2 proxy in TLS using port forwarding.
I manage to make it work correctly in HTTP, but as soon as I try to make it work in HTTPS, Apache shows the message
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Here is my .conf file:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName service-test.mydomain.com
ServerAlias service-test.mydomain.com
ServerAdmin localhost#localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / https://192.168.1.34:1010/
ProxyPassReverse / https://192.168.1.34:1010/
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/service-test.mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/service-test.mydomain.com/privkey.pem
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
My NAT is well configured, and it's only with HTTPS that the issue occur.
I use Debian 11 on Proxmox.
Did the server behind the proxy have to get an SSL certificate too?
I've tried but it's seem doesn't work too...
How can I fixe this?
I have this problem where my apache forward http request to tomcat using proxy (see my apache virtual host config below).It works fine, but the web http request http://subdomain.example.com/xyz/images/background2.jpg arrive at tomcat as /xyz/xyz/images/background2.jpg. context name "xyz" appear twice which cause missing resource at tomcat end.
How do you resolve this problem ?
Apache Virtual Host config file
<VirtualHost *:80>
ServerName subdomain.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.example.com:8080/xyz/
ProxyPassReverse / http://www.example.com:8080/xyz/
</VirtualHost>
Tomcat project setup: ../tomcat7/webapps/xyz/...
You need to update ProxyPass settings as below.
ProxyPass /xyz/ http://www.example.com:8080/xyz/
ProxyPassReverse /xyz/ http://www.example.com:8080/xyz/
I want to host my blog on it's own server, but have the URL be at mysite.com/blog
Should I do this using mod_proxy or an apache redirect, and how would I set this up on apache?
My first pass attempt looks like so in the vhost file, but failed:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /blog http://blog.server's.ip.address/
ProxyPassReverse /blog http://blog.server's.ip.address/
ServerAdmin me#myemail.com
ServerName mysite.com
DocumentRoot /var/www
<Directory /var/www>
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
With this is place I get the following error when restarting apache:
Restarting web server apache2 /sbin/start-stop-daemon: warning: failed to kill 11306: Operation not permitted
[fail]
The apache2 configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
mod_proxy needs to be enabled before working >_<
Once I enabled it my config worked as expected.
a2enmod proxy_http
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /blog http://server4.hostinger.co.uk.ip.31.170.164.19/
ProxyPassReverse /blog http://server4.hostinger.co.uk.ip.31.170.164.19/
ServerAdmin http://webmail.hostinger.co.uk
ServerName armukul.com.ip address 31.170.164.123 domain ip ("A" DNS record) to this IP: 31.170.164.123
DocumentRoot /var/www.armukul.com/home/u311366417
<Directory /var/www>armukul.com
Order allow,deny
allow from all
</Directory>www>armukul.net
</Directory>www>facebook.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>[][1]
[1]: http://armukul.com/home
Upon setting up my test reverse proxy I have encountered this issue:
http://i.imgur.com/Dk7UiOI.png - Sorry can't post images yet...
Below is the apache configuartion.
<virtualhost *:80>
ServerAdmin webmaster#localhost
ServerName localhost
ProxyRequests off
<proxy *>
Order deny,allow
Allow from all
</proxy >
ProxyPass / http://192.168.16.103/
ProxyPassReverse / http://192.168.16.103/
</VirtualHost >
Any have any idea's whats causing this, the redirect comes from a web application on an internal IIS server.
Turns out a reboot of the system solved the issue!