Showing posts with label Apache2. Show all posts
Showing posts with label Apache2. Show all posts

Thursday, February 9, 2012

Better than a DVR round 2

I don’t know where I went wrong but I did, it happened somewhere around the time I changed ISP’s but things just started not working right. Maybe it was because I was in essence running this server from the same machine I used just to cruise around the internet and do school work on. Maybe my tendency to  typo commands finally caught up with me, or maybe some system update just broke everything, either way I’m left with some very distinct problems, so let’s break those down.

1)      Ushare, the service I use to serve video to my Xbox 360 will simply not stay running. If the system restarts the service has to be manually started, if the service crashes it has to be manually restarted, f an update is installed it has to be manually restarted. I spend far too much time using SSH just  to restart this service these days, it isn’t fun anymore.
2)      Apache is having similar issues, and has stopped redirecting to Subsonic all together to the point now that it shows is an /index page, which as I don’t actually have a /index page is really just a list of things I’ve installed on the system
3)      Subsonic will only open if I enter the IP address, the friendly address generates a page cannot be found error.
In case you were wondering those are the three major software parts of the system, which means it is really just not working at the moment. So I am left with three choices really 1) I can try to troubleshoot all the issues that are causing this and repair the damage 2) I can wipe and start from scratch 3) I can set fire to the whole thing and give up.

I’m going with the second choice, mostly because troubleshooting sounds like a lot of work ( and hasn’t worked yet) and while setting fire to the whole mess might be fun, isn’t really an actual option.

Part of the reason I chose to start over is that the machine I am using is no longer my primary machine, which means I don’t need a lot of the features that are currently installed and could potentially be causing problems in the first place, starting over will allow me to install a proper server operating system, rather than a desktop OS with some server bits stitched after the fact. Another reason is that I’ve purchased an HTPC (which I will discuss in more detail in another post after it arrives) to act as a front end, which means all the pretty shiny things that I like to add to the part I use will not be on the server (a good thing).

So the server hardware is not changing (which sadly means its build on an old laptop still, that’s another project) but there is going to be some changes so far as software is concerned. I’m using Ubuntu server 10.04 LTS because I don’t really need all the fancy features of the latest version, and I’m comfortable with 10.04. once I’m sure everything is backed up I will install and configure the server OS, from there I will download, install, and configure Subsonic, LAMP, and Ushare more or less the way I had them back when all was right in my little digital universe, taking care to test things on each step to be sure all is right before getting too far ahead of myself.

I still think part of my problem is the residential gateway my ISP forced on me, I had requested over and over to get a simple DSL modem, however my ISP felt the need to provide me with a device that both does more than I wanted, and not enough.  Getting port forwarding and all the other various services set up on this Actiontech Q1000 has been more work than it really should,  and is extra frustrating knowing that I have a home router sitting in its box configured to do what I am fighting with my ISP’s devices to get done.
At any rate, this is the plan for now, should keep me out of trouble.

Sunday, September 25, 2011

LAMP and other fun and games

Installing Lamp was actually a great deal easier than I had planned on it being. In the past I've only really worked with WAMP, which required downloading and installing each component individually these were not problems I had this time around, in fact getting everything installed and running was the easy part.


The reason for this was Tasksel, which is a tool that allows you to install multiple related packages as a single task. This is not installed by default in current builds of Debian or Ubuntu so it does have to be installed first though that was pretty easy.


In the terminal
sudo apt-get install tasksel


after a fairly quick install the next step is to launch tasksel
sudo tasksel


Tasksel will launch in the terminal window, select what you wish to install, in this case LAMP and then hit enter. During the installation you will be asked to set the MY SQL password. After that it was a matter of making sure that PHP worked


The first step was to do this
sudo vim /var/www/info.php


then restart apache
sudo /etc/init.d/apache2 restart


I also installed PHP my admin to help with all the features ( and because the instructions said too)
sudo apt-get install phpmyadmin


the tool provides a good web interface for managing LAMP on the server


And there you have it, the easy part is done!


And now we come to the reason for this whole exercise in the first place. The reason I like subsonic is that it allows me to access my media from any where with an Internet connection. They even provide a services that lets me use a friendly easy to remember address rather than having to remember my external IP address, and with a bit of port forwarding on the router it works great. I can even add other users to the server and let my friends have access to my media.


There is however a problem with this, when you go to me.subsonic.org what you end up seeing is myipaddress:4040. This is something of a security concern, first in that my address is up there for any one to see, and secondly because it broadcasts open ports on my firewall, this is where apache comes in. what I am going to be setting up is whats called a reverse proxy. What will be happening is this Apache listens on port 80 for requests, when it gets a request for mydomain.org/subsonic it will forward to the subsonic interface without showing the information I would rather not hang out up in the address bar of the browser.


The first step was to turn these features on with this command
sudo a2enmod proxy_http

from there I used vim to create a subsonic.conf file
sudo vim /etc/apache2/conf.d/subsonic.conf
I added the following

ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass /subsonic/ http://localhost:8180/subsonic/
ProxyPassReverse /subsonic/ http://localhost:8180/subsonic/


changing localhost:8180 to the IP and port numbers used by subsonic

this configuration will allow me to make subsonic available to any sites running on the server, if I were to be running multiple sites I could have placed the change into /etc/apache2/sites-available/ instead.



The last change that needed to be made was to the subsonic configuration file its self, a context needed to be added for the redirect so that subsonic knew to respond


and so


sudo vim /var/subsonic/subsonic.properties


and change the entry for the URL redirect to this


UrlRedirectContextPath=/subsonic


And thats it, I've got things up and running with only a few snags, the first of which is that it doesn't actually work right form the local machine, if I use any other computer, even from inside my network everything appears to work great!