Remove /web from PLEX URL - apache

How do I remove the need to type /web on the end of my PLEX media server to access from outside my network? I have a no-ip.com account and set up a static domain name to point to a static ip. But that doesn't help much, because I still need to type in the /web to access my media server. I am using windows 7. I have set up a owncloud server before and removed the need to type /owncloud in the httpd.conf file. But I can't find it for the plex server. I read somewhere to set up a page that will redirect to /web, but I don't know how to do that. Thanks for help!

You can remove both the port (in case you are already not forwarding it from port 80 to Plex's port) and the need for the /web at end using redirection rules.
Here is a good example of how to do just that (this solution uses Apache):
http://matt.coneybeare.me/how-to-map-plex-media-server-to-your-home-domain/
EDIT: Small correction, that site I linked is not using redirection rules, it is using a reverse proxy.
With a redirection rule if you type: myPlexServer.com, you'll be redirected to myPlexServer.com:32400/web (as in, the address on your browser will actually be re-written to that, same as clicking on a link that takes you to another page).
With a reverse proxy, you effectively have a man in the middle, the reverse proxy server itself. You send requests to myPlexServer.com (Apache server in this case), it receives those requests and the proxy forwards them to myPlexServer.com:32400/web (PMS Server). The PMS server sends the reply to the Apache server and the Apache server sends the reply back to you. As far as PMS is concerned, the client requesting info is the Apache server, in fact it doesn't even know about you talking to the Apache server.

Related

Redirect from a URL to a other server

I have the following question that I do not know how to solve it in the most efficient way.
I have two servers, one with Apache where I have a Wordpress instance responding for port 80, and on another server I have a Wildfly with another application listening on port 8080. The Wordpress that I have configured on the Apache server, responds to the URL http://www.somedomain.com What I'm not so clear about is how to do when a request arrives at http://www.somedomain.com/yyyy and redirects me to the Wildfly server where an application is responding to the URL : 8080 / app
How could I do it in the most effective way? Using the rewrite module in the .htaccess file or using the Apache proxy module and configuring it in the Apache virtual host? How would I have to do it?
Thank you very much in advance.
You're mixing a few things that are not related to each other. First of all, a redirect is something different than a proxy. Redirecting means asking the client (browser) to look at another URL. A proxy, on the other hand, retrieves the content of the other URL itself and passes it to the client. Using a proxy, the other URL remains invisible to the client.
Second, mod_rewrite is not limited to htaccess configuration. In fact it's better to configure mod_rewrite in the virtual host configuration, just as you suggested with the proxy configuration.
The htaccess is simply for users who are not allowed to mess with the server configuration itself. Configuration in the htaccess can be limited by the admin for security purposes at the cost of slowing down the server.
That said, if you are looking to map your wildfly server paths into your main server's paths, you might want to use something like this inside your main server's virtual host block:
<Location "/yyyy">
ProxyPass "http://wildfly:8080/app"
</Location>
See http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass for detailed explanations.

Connection Partially Encrypted in Firefox :SSL

I have uploaded my SSL certificates to IAM purchased from Comodo and evrything looks fine in chrome and opera. But mozilla is giving an error: "Connection Partially encrypted". I am not able gauge why this is happening.
Link : https://www.advisorcircuit.com/
Please tell me what is the possible culprit for this?
and also i want to know , how can i redirect my users to HTTPS ebven if they type http as even if i type http the website loads and opens.
I am using AWS t2.medium instance. So is there any configuration i need to do in my console??
Redirection:
You have a few options:
Block HTTP traffic, only allow HTTPS on the Security Group level ( Not the nicest solution.
Use an Elastic Load balancer, Listening only on HTTPS port. ( Same as above)
The webserver ( most of them like Tomcat, IIS, etc) supports a redirection, so it sends back "HTTP/1.1 301 Moved Permanently", then the client browser does the call again on HTTPS.
If you use Elastic Load Balancer with SSL termination ( which is a good practice, less load on your server, easier setup of the SSL Certificate). Then all your traffic inside your VPC goes on port 80. In this case you need to setup your webserver to redirect differently. Instead of the incoming port, the trigger for the redirection should be the based on the "X-Forwarded-Proto" header value, which is the original protocol what the client is using.
For production environment the last setup is an AWS Best practice. ( Of course there are also other solutions)
Your site is running Apache/2.2.29. You can redirect your virtual host traffic from 80->443 in Apache itself. That way if someone goes to http://www.yourdomain.com then get redirected to https://www.yourdomain.com
ServerFault has an post explaining how to use Apache mod_rewrite to accomplish this
https://serverfault.com/a/554183/280448
Also you need to adjust the SSL cipher suites that your site accepts. Your ELB has an option to change cipher suites and you can deselect some there. The two you definitely want deselected are RC4 and SSL3.
Here's the full report if you want to make more changes
https://www.ssllabs.com/ssltest/analyze.html?d=www.advisorcircuit.com&s=52.7.154.196&latest

Apache not able to access document root when outside the network

I have a wordpress site on my debian server. I have done the port forwarding successfully (verified this) to access outside the network. However I get the below error when i try to access outside the network. Am i missing something? Sites-available is set to documentroot at /var/www, which is where my wordpress folder is.
The requested URL /XXXXXX was not found on this server.
Apache/2.2.22 (Debian) Server at 10.1.1.4 Port 80
I really hope someone can help me on this as i have spent almost a week over this.
Thanks!
I do this kind of stuff on daily basis. Lets go through the basics.
Firstly, confirm that you can access your server within your private network http://yourserverLANip:80
If possible, do not use server itself to test it (eg localhost:80), use other device as laptop or any other device within the same LAN.
With that test you can confirm that:
apache listens on port 80
apache accepts requests from other clients within your private network
wordpress is set up correctly
If wordpress site pops up we can assume that apache and private network configuration is correct and you'd need to move your debugging to WAN/public network configuration.
It would be wise to recheck apache security settings at this point.
From here, things get a little more complicated.
I believe you mean public WWW when you say "outside-the-network". You want to make your site public to every internet user on the planet.
I assume that you have a registered domain name (eg yourwebsitename.com) and a static public IP address at the location where the server is located (if you host it at home, static IP is fixed to your modem).
These two are "must", if you want to host anything that public can consume.
If you host your apache for yourself, you dont need your domain name, but you'd need to access your server through your public IP yourpublicIP:80 and it's not easy to use for other people.
Now lets go on with WAN debugging.
Validate that:
your domain DNS WWW settings are pointing to your public IP address
at your server location. you can do it through the control panel of
your domain registrant company.
you have a static public IP address where your server is hosted
your modem accepts incoming ports (80). this is done through modem
firewall settings.
that the port 80 is redirected to your server private IP address (LAN
ip).
The flow for redirecting clients to your server is something like that:
Client->WWW->internet service provider->yourpublicIP->modem->yourserver at LAN
Good hunting!

Multiple sites per Apache server with SSL showing wrong site with HTTPS

I have a Debian server which is running a number of client sites. Most of these are not running SSL so accessing by HTTP is fine.
I have one customer with an SSL certificate and accessing their site via HTTPS is fine too.
The problem comes if you try to access one of the other sites with HTTPS you get directed to the other site that has the SSL certificate.
For instance, lets say we have the following sites on the server:
alpha.net
bravo.net
charlie.net (SSL)
delta.net
So as you can see, charlie is the only one with SSL, and irrespective of if you go to http charlie.net or https charlie.net, it works fine.
http to all the other sites is fine, but if you were to go to https alpha.net, it will initially come up with an Invalid Certificate error and let you continue but whilst it has alpha.net in the address bar, its actually showing the charlie.net site in the browser.
I have researched SNI and how if any other sites have SSL I'll need to put them all on specific IP addresses (something else I need to try to work out how to do as I have no idea) but I am not sure why this is happening or how I resolve it.
Has anyone else encountered this before and how did you get around it?
Many thanks,
Rob
This does not have anything to do with SNI, as you currently only have one HTTPS server. What happens, as you've stated in your comment, is that the alpha.net domain resolves to your server's IP. Your Apache server is set up to listen for requests on port 443 on this IP, and to serve the contents of charlie.net to these requests. (And the certificate error means that the browser noticed the discrepancy between the certificate's alleged domain name and the domain name used for the request.)
Redirecting from HTTPS to HTTP is probably more trouble that it's worth, since you would need valid certificates for each domain, lest you present your users with another security warning. This would entail creating virtual hosts for alpha.net:443 and so on, on an SNI capable server (i.e., later versions of Apache 2.2+ with openssl), and adding a redirection like so:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
Probably the easiest course for your problem is to use a different IP for charlie.net. With this setup, there would be no way for alpha.net (and so on) to display the contents of another site.
If you have multiple IPs on your server, use a unique one for the SSL site, all non-SSL sites share another IP.
Since SSL doesn't care what is the domain you are visiting, it only cares if the current domain is approved from the list of domains(Common Name) it gets from the Ip address.

URL not redirected using Apache rewrite

I have been using apache server. I want to redirect some URL to another, eg. www.abc.com to localhost:8080/Home
I uncommented rewrite module in httpd.conf in conf folder of apache installation. Then I wrote rewrite rule like show below in httpd.conf file.
RewriteEngine On # Turn on the rewriting engine
RewriteRule http://www.abc.com http://localhost:8080/Home/
But nothing happened. It is simply opening abc.com as normal. There is no error message not even in log.
Can anyone suggest where the problem is?
You can only rewrite URLs that have the server as a host. Since you do not host www.abc.com, you cannot rewrite any of its URLs.
It's not the 'best' solution, but I use it at home.
Edit the 'hosts' file on your own PC to redirect. For example, mine redirects 'attic' to ip 10.0.0.5, my server in the attic. So when I type attic/myfolder, I get what I would normally get at 10.0.0.5/myfolder.
Your hosts default location can be found with a very quick google.
Not the best, as I say, but it works.
EDIT:
Okay, something.something, we'll call it xyz.com.
We need 2 things here;
a) your server must expect traffic from xyz.com
(this is just a config on the server, easy to achieve).
b) your browser must be pointed to your server when you type xyz.com.
Normally, when you type xyz.com into any browser, your PC will connect to a DNS server to find out where in the world xyz.com actually is (the DNS server returns an IP address). To inform the DNS servers that xyz.com should point to YOUR server, you need to pay to register the domain name with a registrar (unassigned domains aren't expensive). This is the best way, as every computer will now know how to get to your server by typing xyz.com. When you move your website to a hosted server, you go to your registrar's website and change the settings, saying "stop pointing to the IP of my home server and start poionting to the IP of my hosted server".
Or, if you don't want to do that, you need to tell YOUR PC to skip the DNS check, and you do that by modifying your hosts file as above. This will only work for you, but is enough for home testing purposes.
The third option is running your own DNS server, and manually telling it to override the world-wide settings for xyz.com. That way your browser would get your custom result when it checks the DNS server, and forward straight to your server. However, running your own DNS server is a complex undertaking, and is overkill for your current task.
In summary, from best option to worst:
1) Register your domain and point it home
2) Modify your hosts file to bypass DNS checking
3) Run your own DNS server, and override the settings for xyz.com
Hope I've been more clear this time :O)