VSIDO Community

VSIDO Support => General Support => Topic started by: VastOne on April 21, 2014, 07:52:56 PM

Title: (Solved) LaMP stack and local www services issues
Post by: VastOne on April 21, 2014, 07:52:56 PM
You know you have it good when google searches turn up shat for what you need so you come here for the solution... (soon I will just say the hell to google)

I have a LaMP stack that runs a local version of this web site for backup and restore purposes... it also runs the V-Ger bot for the IRC channel ... everything was fine until recently I had a change to my outward (wan) IP ... it is not static, but it has not changed in 5 years.  The reason for the change now was an upgrade to a new router and faster services and a new IP

The issue is this...

The old external IP is what localhost sees on the server instead of the new IP... I use https://www.noip.com/ (https://www.noip.com/) for web redirects and if you tried going to http://vsido.no-ip.biz (http://vsido.no-ip.biz) you would correctly see the new IP (http://24.50.134.254:9669/ (http://24.50.134.254:9669/)) as trying to load

The issue is back to localhost on the server ... http://localhost (http://localhost) shows the old 24.50.131.104 ip and no one can access it, including me internally

I know I am missing something very very obvious, but am drawing a complete blank and after several days I need an assist

I appreciate any input and help to resolve

Thanks
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 21, 2014, 10:42:08 PM
I would suspect this would be an issue with the port forwarding in your actual modem/router.  That is if I am understanding your issue.  I am guessing that your issue is that you can still contact the modem/router locally (like at 192.168.0.1 or something) but that externally you can't see anything that is under the local umbrella?  If I am off base sorry.  If that isn't it can you give me an idea of the actual issue?
Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 21, 2014, 10:48:01 PM
Sure... this is the localhost of the machine on this side of the router... the only thing external that that router cares about is that 9669 is forwarded correctly to that machines internal IP

9669 is what is required for port forwarding for anyone to use my side... and is what is needed for you to see my local machine.  That is working correctly, sending http://vsido.no-ip.biz (http://vsido.no-ip.biz) correctly to the new IP (http://24.50.134.254:9669/ (http://24.50.134.254:9669/))

I am seeing it on this side as well... I cannot even access that http://localhost (http://localhost) from that machine.. somewhere is a setting on that server that states the localhost is the old IP of 24.50.131.104 and not the new one
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 21, 2014, 11:26:24 PM
If I am understanding you have a machine that is port forwarding and you can't access it locally but you can see it from the cloud?  Sorry long day and I may be thick headed.

Have you checked the hosts/etc files on that machine to see if they are set correctly. 

In my router/modem (running tomato) there is a setting for the local host IP.  If I change that local host IP I will no longer be able to access it at the old address locally but my noip still works as does my vpn OOPS no it doesn't and I can still see the stuff on the server that is exposed at the correct port and I can only use the new local address I set up.  If I ifconfig I still get my local address and that is the  address that I contact the machine locally with.   EDIT:Confusing

I am sorry I think I am still not understanding the problem clearly.  Probably not too valuable to be guessing solutions when I am guessing the problem.  FWIW there really isn't much to this chain of events.  You have a local address. You set up hostnames on it.  You set up your no ip account. You download the noip updater.  You run the updater.  You are done.

Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 21, 2014, 11:32:35 PM
I cannot access it anywhere... there never has been a setting (to my knowledge) that I have done that pointed to any external IP.  This is just a complete backup of this forum setup under apache2 in /var/www

I have never had any issues accessing it from anywhere prior to this IP change

Thanks
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 21, 2014, 11:39:11 PM
Are you running this?

http://www.noip.com/download?page=linux (http://www.noip.com/download?page=linux)
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 21, 2014, 11:44:28 PM
I cannot access it anywhere... there never has been a setting (to my knowledge) that I have done that pointed to any external IP.  This is just a complete backup of this forum setup under apache2 in /var/www

I have never had any issues accessing it from anywhere prior to this IP change

Thanks

That should not affect this (whether it changed locations on the box or is a backup).  The only thing I can think of is the config file in the no-ip updater.
Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 21, 2014, 11:45:57 PM
right... that is what I am investigating now.. thanks for reminding me of that little tidbit... I think it is the issue and will post back the results
Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 21, 2014, 11:54:26 PM
All that app does is setup the no-ip daemon to be run monthly to keep you in contact with no-ip and up to date

I reran it again and it makes no difference at all

Still at a loss as to what it is
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 22, 2014, 12:05:05 AM
That's right but it does need tied to the local.

Hmmm.

I am going to grab a bite and then tear my setup down and essentially do what you have done and see if I can recreate it.  Makes no sense.  I have found noip to be a pretty flawless solution. In other words I am also at a loss.
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 22, 2014, 03:00:51 AM
V. I can't replicate the problem.  I used my vpn to change my ip and all worked great.  So I removed everything and started from scratch following this : https://www.noip.com/support/knowledgebase/getting-started-with-no-ip-com/ (https://www.noip.com/support/knowledgebase/getting-started-with-no-ip-com/) using my existing no-ip hostname and followed the steps.  So I then wiped it all and did the same using a new hostname that I have lying around. Again, worked like a charm.

Not to be a mensch but did you walk through this? https://www.noip.com/support/knowledgebase/basic-troubleshooting-guide/#3 (https://www.noip.com/support/knowledgebase/basic-troubleshooting-guide/#3)

Also did you test your ports with open port or http://www.portchecktool.com/ (http://www.portchecktool.com/)

I just can't think what could be wrong.  It really is a 1-2-3 type thing.  The only thing I can think is that it is resolving to some address other than where you think it is.  If that is the case the question would be why?
Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 22, 2014, 03:10:05 AM
I really appreciate your diligence on this statmonkey and I think you are seeing why I never found anything on google that comes close to this

This is an internal issue and not on the wan side at all ... as a matter of fact, I know that the no-ip setup and router is working simply by trying to go to  http://vsido.no-ip.biz (http://vsido.no-ip.biz) and see that it is trying to access the correct port and the correct new IP address

I should also tell you that on the local server when trying to access its own localhost, it clearly states in the browser that it is trying to access old IP address... it is clearly a localhost issue on that machine, but or the sakes of my fathers guns, I cannot figure it out
Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 22, 2014, 03:13:33 AM
I also did a system wide grep of the old IP looking for it in every file and cannot trace it to anything that I can edit and change
Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 22, 2014, 03:22:35 AM
I also did confirm via no-ip2 -S that the correct new IP is what is being used in the config file created and used by no-ip2
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 22, 2014, 04:51:11 AM
Really at a loss, this will keep me from sleeping I hate when I can't draw something out like this.  About the only thing I can think of is something in the hostnames or maybe apache is using hostname lookup which is tied to the old ip?  I just can't think that it is buried in /etc somewhere.  I mean something is telling it to use A and not B right?  There are a limited number of items that do that (unfortunately which one Debian is choosing to be first priority is sometimes a shifting target).

  I always find the way apache2, php etc. fight over hostames confusing.  You didn't reinstall the lamp stack or anything did you?  Personally another problem I once had was I used tasksel to install the lampstack and next thing I knew dogs were sleeping with cats and all hell broke loose.  I started over and have always done it part by part since.  I wish I was more help -- throwing darts at the map at this point.

I think I am going to look at that end and see if I can find anything.  It's been so long since I had this type of issue I can't remember exactly what is where.
Title: Re: LaMP stack and local www services issues
Post by: hakerdefo on April 22, 2014, 11:23:15 AM
'httpd.conf' and/or 'hosts' files can be worth looking into.
Title: Re: LaMP stack and local www services issues
Post by: statmonkey on April 22, 2014, 03:54:33 PM
'httpd.conf' and/or 'hosts' files can be worth looking into.

Yep. Just coming to post that. Thanks hakerdefo!
Title: Re: LaMP stack and local www services issues
Post by: VastOne on April 22, 2014, 04:58:56 PM
Got this solved and it was a dandy one...

Here is why it happened... when downloading the database from my hosting site to restore to this server, the very first thing I must do is change the IP from the online server to the localhost so that the themes will work... it is a simple process and one I do every time I do a reinstall locally to bring this test site up to this forums levels

The way the changes are made uses the IP address and I knew this but did not recall it because every time I reset it all I have to do is click a reset button and it is done...   I had to go into the database and scrub the old IP away before I could access it at all.  These are the correct settings

Theme directory (templates):    /var/www/Themes/darkmodern2
URL to above directory:    http://24.50.134.254:9669/Themes/darkmodern2 (http://24.50.134.254:9669/Themes/darkmodern2)
URL to images directory:    http://24.50.134.254:9669/Themes/darkmodern2/images (http://24.50.134.254:9669/Themes/darkmodern2/images)

So in the end it was a theme setting that was holding onto the old IP address ... it has now been corrected

Thanks to statmonkey for all your help and diligence and thanks to aibo on the IRC who reminded me just how powerful curl is and in helping me trace down the issue

Closed and my migraine is now gone too

http://vsido.no-ip.biz (http://vsido.no-ip.biz)

:D


Title: Re: (Solved) LaMP stack and local www services issues
Post by: hakerdefo on April 22, 2014, 05:21:18 PM
That's a great detective work!
It was fascinating to watch VastOne and statmonkey go all gun blazings to solve this one! A great thread!
Cheers!!!
Title: Re: (Solved) LaMP stack and local www services issues
Post by: VastOne on April 22, 2014, 05:24:35 PM
^ It was fun... jedi on the IRC and then aibo had their guns hot and blazing as well... it was a good one to chase down

Thanks mate...

One query... is httpd.conf even still used by apache?  I searched for it on my local server and did not find it.. I thought that it might be how older versions of apache worked
Title: Re: (Solved) LaMP stack and local www services issues
Post by: statmonkey on April 22, 2014, 09:31:59 PM
Impressive work VastOne, I am embarrassed to say that I rarely use curl and probably rely on grep too much.  Once you said you had grepped for the offending IP my brain closed that avenue or my bias most likely.  Hat tip to aibo for the reminder and will now accept my 100 curl commands as a reminder/penance.  Glad you got it solved. 

Not sure about httpd.conf they have changed so many things and I need to brush up before my next disaster. :)
Title: Re: (Solved) LaMP stack and local www services issues
Post by: VastOne on April 22, 2014, 10:09:04 PM
^Thanks man! It was damn fun... though I lost some more hair I am sure...

I am adding the conversation that aibo and I had on the IRC so that anyone who may run into this in the future can learn from it

I love this line from aibo

"how can a machine even run without curl installed"

Quote
<aibo> just red about your home server issue
<VastOne> pain in the arse
<aibo> have you fixed it yet?
<VastOne> oe
<VastOne> no
<aibo> actually i can load the page
<aibo> but it takes a lot of time with firefox
<VastOne> well I just rebooted and have not tested the new change I just made
<VastOne> Yar
<VastOne> that is what I am seeing
<VastOne> a long long time and it loads
<aibo> curl shows the sources right away
<aibo> and there are some references to the old ip
<aibo> images and stuff
<VastOne> right
<aibo> that's why firefox takes long time
<aibo> and curl not
<VastOne> you are seeing exactly what I see
<VastOne> when I try to access it even from localhost
* V-Ger` is now known as V-Ger
<VastOne> http://localhost (http://localhost)
<VastOne> it seems an internal apache setting
<VastOne> but for the life of me I cannot locate it
<aibo> hm, so the ip is not in the html/php source code?
<aibo> seems strannge, baecause new and old ip is used in urls
<VastOne> right
<VastOne> the new IP is there from the webdirect coming from no-ip
<VastOne> and that configuration is confirmed and good
<aibo> it's in the html
<VastOne> but when it hits my side of the router, it is looking for the old IP
<aibo> well, since I am able to load the page it apparently reaches the right server and the webserver running on the new ip
<VastOne> there is a way to rerun the local web setup
<VastOne> I can see it's config but it does not show the old IP
<VastOne> I can rerun just to eliminate http as the issue
<aibo> http is fine
<aibo> forwarding is fine
<VastOne> right
<aibo> or is a webserver still running on the old ip?
<aibo> i guess the old ip isn't active at all right now, right?
<VastOne> no, it is completely gone from anything I have setup
<VastOne> afaik
<aibo> :D
<VastOne> :D
<aibo> so I have to conclude that forwarding is working and http as well, as i can fetch the page with curl
<aibo> curl http://24.50.134.254:9669/ (http://24.50.134.254:9669/) 2>/dev/null | grep 24.50.131.104
<V-Ger> Title: VSIDO Community - Index (at 24.50.134.254:9669)
<aibo> lol, thx V-Ger
<aibo> this shows me a lot of lines with reerences to the old ip
<aibo> so the issue has to be in the php/html sources of the page
<VastOne> I am not totally sure... after the long time out searching for 24.50.134.254 and the shell page does in fact show up, it continues to look for the old ip from the browser
<VastOne> ok
<VastOne> let me rerun the setup of the php/html
<aibo> yeah, since i don't know nothing about the structure of the sources I can't help with this, I'm afraid
<VastOne> It is smf and is quite good for resetting
<aibo> or are they viewable online somewhere?
<VastOne> and actual php that does all the work for me
<VastOne> I cannot access anything locally on this machine
<VastOne> localhost or 127.0.0.1
<aibo> do you have iptables rules configured on this machine?
<VastOne> not to my knowledge... meaning it has never been done by me
<VastOne> or...
<VastOne> I have and have forgotten tit
<VastOne> :D
<aibo> :D
<aibo> so what do you receive with curl -i localhost?
<aibo> does it timeout?
<VastOne> one sec
<aibo> or an instant error or something?
<aibo> or a 404
<VastOne> installing curl on that server... thats how vanilla it is
<aibo> :D
<aibo> whaaaat
<VastOne> hehe
<aibo> how can a machine even run without curl installed
<VastOne> surprisingly well
<VastOne> I got instant feedback from curl
<VastOne> like you the old ip is all through it
<VastOne> I need to access the repair tool to fix it
<VastOne> but anything I try to get to that tool (php file via a browser) does not let me access it
<aibo> i gues the configs are saved in the http document root somewhere
<aibo> just edit the textfiles
<VastOne> Thats just it... int he Settings.php, it is not there
<VastOne> that IP I mena
<VastOne> mean
<aibo> hm, is it saved in the database?
<aibo> just change it there
<VastOne> in the database now
<aibo> i guess you have grepped the whole machine for the the old ip address 1001 times by now? :D
<VastOne> Yes
<VastOne> and never found it in a config file
<aibo> have you found something in the db, VastOne?
<VastOne> not yet
<VastOne> still looking
<VastOne> using phpadmin and it is clunky
<aibo> hm, mysql has a usable cli
<VastOne> Yar
<aibo> not as nice as the postgresql cli tho
<aibo> VastOne: it seems the occurences of the old ip are related to the theme "darkmodern2"
<VastOne> right
<VastOne> curl shows that
<aibo> yeah
<VastOne> that is the default theme
<aibo> ok, it sometimes calls /Themes/default and sometimes Themes/darkmodern2
<aibo> seems it's in the javscript
<aibo> smf_theme_url and smf_images_url should be set somewhere
<aibo> I'd grep for these in the document root for the website VastOne
<VastOne> will do
<aibo> or whereever the smf configs are stored
<VastOne> try accessing now aibo
<VastOne> I found it in the database in the themes
<VastOne> and used php myadmin to eliminate it
<VastOne> the them is wrong but at least I can now access it
<VastOne> the theme
<VastOne> got it all corrected aibo ... and thanks to you and curl you got me on the correct path
<VastOne> I appreciate it!
<VastOne> I also see now why it happened
<djt> i've just been reading through (most of) that thread and chat regarding your ip lamp issue...   all fixed?  for a mo i thought it might be a nameserver issue just needing to wait to update.
<VastOne> Yes it is fixed and I am writing now what the issue was on the forum to close it out
<djt> :)
<aibo> great to hear you solved it VastOne :)
<VastOne> thanks to you and your insights... I really appreciate it aibo
<VastOne> that was a damned good one
<VastOne> damned easy button fix (from smf admin toolset) is there for a good reason... but when an ip changes, it made it nasty
Title: Re: (Solved) LaMP stack and local www services issues
Post by: statmonkey on April 23, 2014, 01:50:14 AM
Thanks for posting your work through very ... (quickly makes sure curl is installed) ... interesting :)
Title: Re: (Solved) LaMP stack and local www services issues
Post by: hakerdefo on April 23, 2014, 05:21:39 AM
One query... is httpd.conf even still used by apache?  I searched for it on my local server and did not find it.. I thought that it might be how older versions of apache worked
My mistake! Apache2 in Debian doesn't have 'httpd.conf' file. It is deprecated. On some  distros this file is there but it is empty. It can still be used (not advised) because Apache2's newer and now default main config file '/etc/apache2/apache2.conf' includes the magical line, 'Include httpd.conf'.
 It is advised to do any user configuration in the configuration file in '/etc/apache2/conf.d/ ' directory.
Cheers!!!