ASP.NET application not accessible through Apache proxy on Linux - asp.net

I need to clarify the process of pointing a web domain to a running ASP.NET application on a raspberry pi. The application is developed and ready, and the website is up and running. I have researched multiple posts and can't find anything wrong with my proxy redirect.
Is dotnet blocking the recieved redirect in someway by locking out any external visitors from the application?
Since there are multiple ways of setting up such an environment. Do I need to configure both an XForwarding in my application as well as a ProxyPass in Apache?
I have an SSL via Letsencrypt, protecting the traffic on my website. This worked fine when running a simple HTML/CSS layout. Do I need to acquire a certificate for my application aswell?
Overall the setup is not working, and I'm itching to understand why. Most threads seem to imply its as simple as running the app on port x -> pointing to port x -> success. For me this isn't working...
Through wget I successfully reach my website via both ports (since I redirect HTTP to HTTPS). By entering the localhost:port into browser I can find the application. Why is my proxy not working?
Accessing my website
https://localhost:7199
Apache2 Virtual host
<VirtualHost *:80>
ServerName www.website.com
RedirectPermanent / https://www.website.com
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster#localhost
ServerName www.website.com
ServerAlias www.website.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:7199/
ProxyPassReverse / http://localhost:7199/
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/www.website.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.website.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/www.website.com/chain.pem
</VirtualHost>
</IfModule>
All and any thoughts are very appreciated. Thanks for reading!

Related

Issue with Apache2 Reverse proxy

I need to create a reverse proxy in apache2 for an icecast server, but with another virtualhost as a simple website
I managed to create the reverse proxy, using this configuration in apache Virtualhost
<VirtualHost 100.100.100.100:80>
ServerName icecast.xxx.com
ProxyPass / http://localhost:8000/
</VirtualHost>
100.100.100.100 is the ip of the server, and xxx.com is the domain
So when i type in my browser icecast.xxx.com the icecast admin panel (on 8000 port) show up
Then i have added another virtualhost
<VirtualHost *:80>
ServerName xxx.com
ServerAlias www.xxx.com
ServerAdmin MY_EMAIL
DocumentRoot /var/www/site/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have enabled him with sudo a2ensite NAME_OF_THE_CONFIG_FILE
But when I go to the ip of the VPS or to xxx.com/www.xxx.com the icecast2 admin panel show up!
I don't know how to solve this, I maybe think that the error is in the line
I finally managed to solve the issue,
simply in the reverse proxy virtualhost, instead of <VirtualHost 100.100.100.100:80>
I need to put
<VirtualHost *:80>

Apache2 redirect to https

For one of my customer projects, I have a domain name abc.my-app.com. My server public IP is x.y.z.a .
I have developed a Spring boot based application. In the application, I have configured automatic redirect from http port 8088 to https 8443.
The application is accessible as https://x.y.z.a:8443/ without issues.
The application is also redirected to https when accessed as http://x.y.z.a:8088
in the browser.
Refer https://drissamri.be/blog/java/enable-https-in-spring-boot/ on how I have configured this.
I also have setup apache 2.4.18 version on my server. I have configured virtual hosts to be able to redirect to https when my application is accessed from browser as https://abc.my-app.com to https://abc.my-app.com:8443.
But, if user accesses http://abc.my-app.com (without https), the apache does not redirect to my application on https.
How do I enable Apache to redirect from http://abc.my-app.com to https://abc.my-app.com?
My Virtual host configuration is below:
<VirtualHost *:80 *:8080 *:443>
ServerAdmin webmaster#xyzc
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/apache2/ssl/ca.crt
SSLCertificateKeyFile /etc/apache2/ssl/ca.key
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName Off
ProxyPreserveHost On
# Servers to proxy the connection, or
# List of application servers Usage
ProxyPass / https://x.y.z.a:8443/
ProxyPassReverse / https://x.y.z.a:8443/
ServerName ip-x-y-z-a
</VirtualHost>`
I finally got it working. Not sure though this is the right way.
In Spring boot application, I configured redirect from port 80 to port 443.
Apache2 redirects from 443 to my application running on port 8443.

How to configure apache to serve directory for custom domain

Currently, I have configured a domain I bought through GoDaddy to point to the elastic ip address of my personal ec2 instance. I'm having issues finding the correct solution to configure my httpd.conf such that my custom domain, example.com points to a specific subdirectory var/www/Example. Further, I want to be able to still access my other projects and sites by simply typing in the elastic ip and subdirectory.
I have tried the using a virtual host with the following configuration..
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress"
ServerName fitnessfifteen.com
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>
When I do this, I can access the correct content by going to www.example.com however, I'm unable to access my other files and projects via 11.11.111.111/OtherProjectDirectory (I get that default internal server error page). I'm completely new to this sort of stuff so many this isn't possible and I have a fundamental misunderstanding.
Add another virtual host to http.conf as below and restart apache.
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress/OtherProjectDirectory"
ServerName 11.11.111.111
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>

Can't find deployed app

I deployed my first meteor app on a digital-ocean droplet using mup. So it's there but I can't figure out what I still have to setup to actually view my app. So when I go to www.example.com I should see it but all I see is an apache page.
When you start a Meteor app, you can specify the port for it to listen on using the --port argument. For it to be available from at you domain name specify port 80. Though if you have Apache listening on that port already it will fail to bind to it. Uninstall or stop Apache, and restart your Meteor app.
If you are using Apache to serve other content and can not stop it, you'll need to have your Meteor run on a different port with an Apache ProxyPass. First enable mod_proxy and mod_proxy_http
sudo a2enmod proxy proxy_http
Then create a new VirtualHost for the Meteor app that proxies request to the port you have decided to have it listen on. It will look something like:
<VirtualHost *:80>
ServerName www.example.com
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
See this article for all the details.

Issu with varnish-ban-manager installation, using vhost in AWS

I've installed varnish-ban-manager (https://github.com/dot2code/varnish-bans-manager) and I'm currently configuring it's DNS name.
The thing is that I've set in Route53 (DNS service in AWS) to use name http:// purge.domain.com / pointing to http:// varnish_server_name.com/. The thing is, if I test with http :// purge.domain .com:9000/ it works normally, but using http: //purge.domain.com/ will send me a "your request cannot be processed" (in a varnish error screen).
Any ideas why this could be happening? I've test this with the ip address of this vm and works perfectly too..
Here's the vhost config file:
<VirtualHost *:80>
ServerName purge.domain.com
ServerAlias purge.domain.com
ProxyPass / http://varnish_server.domain:9200/
ProxyPassReverse / http://purge.domain.com/
# Logging
ErrorLog logs/server-error_log
CustomLog logs/server-access_log combined
</VirtualHost>
Note: i've replaced my real domain for "domain" just in case.
Thanks guys!!
Solved. I've added some lines to vhost:
ServerName http:// purge.comain.com
ProxyPass / http:// varnish_server:9000/
ProxyPassReverse / http:// varnish_server:9000/
ErrorLog logs/purge. cloud-turner.com.ar-error_log
CustomLog logs/purge. cloud-turner.com.ar-access_log combined
And added proxy.conf (/etc/httpd/conf.d/) with this line
ProxyPreserveHost on
And that's it!

Resources