Jump to content


Photo

Joomla site issues - migrating from IIS to Apache


  • Please log in to reply
9 replies to this topic

#1 Neal

Neal

    Newbie

  • Member
  • Pip
  • 6 posts
  • Main OS: Windows 7

Posted 08 September 2011 - 12:06 PM

Hi -

I've migrated a number of Joomla sites from IIS6 to Apache and now am trying to test them using a subdomain -

e.g. http://newsite1.mydomain.com, http://newsite2.mydomain.com

I've updated .htaccess, configuration.php and httpd.conf - I believe correctly.

The problem is, when I try to browse to the new sites, it comes back with:
"Sorry, the website www.newsite1.mydomain.com cannot be found"

So, it's adding a "www." to the beginning.

Note that http://newsite1.mydomain.com/test.html works fine, as does http://newsite1.mydo...m/administrator.

What am I missing?

Thanks,
Neal

#2 BobS

BobS

    Project Helper

  • Super Moderator
  • PipPipPip
  • 334 posts
  • Location:Santiago Chile
  • Interests:Retiring, computer systems, system design, model railroads....
  • Wiki ID: BobS
  • Main OS: Windows 7

Posted 08 September 2011 - 01:49 PM

Well, it's your browser that's adding the www. to the URL. The reason it does it is that it can't find the names in DNS. Specifically, it needs to find either *.mydomain.com or newsite1.mydomain.com.

The alternative to updating the DNS server is to update your Hosts file with the names and point them to 127.0.0.1.

Regards,
BobS

#3 Neal

Neal

    Newbie

  • Member
  • Pip
  • 6 posts
  • Main OS: Windows 7

Posted 08 September 2011 - 01:59 PM

Well, it's your browser that's adding the www. to the URL. The reason it does it is that it can't find the names in DNS. Specifically, it needs to find either *.mydomain.com or newsite1.mydomain.com.

The alternative to updating the DNS server is to update your Hosts file with the names and point them to 127.0.0.1.

Regards,
BobS


Bob -

Thanks for the reply. I'm not sure why it can't find the names in DNS. I believe I have setup the sub-domains properly in DNS and pointed them to the server's IP. And, as I mentioned, http://newsite1.mydomain.com/test.html is working fine, just not the default http://newsite1.mydomain.com/index.php.

So, other than pointing the A record to the server's IP, what other change would I need to make in DNS?

Thanks,
Neal

#4 Neal

Neal

    Newbie

  • Member
  • Pip
  • 6 posts
  • Main OS: Windows 7

Posted 13 September 2011 - 05:31 PM

Well, I tried updating my HOSTS file and that didn't change anything.

Again, http://newsite1.mydomain.com/test.html and http://newsite1.mydo...m/administrator both work, but http://newsite1.mydomain.com/ and http://newsite1.mydomain.com/index.php both report an error from the browser:

Server not found
Firefox can't find the server at www.newsite1.mydomain.com

Does anyone else have any suggestions?

#5 BobS

BobS

    Project Helper

  • Super Moderator
  • PipPipPip
  • 334 posts
  • Location:Santiago Chile
  • Interests:Retiring, computer systems, system design, model railroads....
  • Wiki ID: BobS
  • Main OS: Windows 7

Posted 14 September 2011 - 09:15 AM

Sorry, Neal, I must have been sleeping to miss your comment. :)
What's significant is that you get a
response from some of your URLs. That means that DNS at least has a mapping from newsite1.mydomain.com to the IP of your server. So we can rule out DNS as (part of) the problem. Also, put your HOSTS file back to the way it was.

So the problem must be in the vhosts config. But I just double-checked my setup and I get the same results as you do! We'll have to do more analysis on this problem....

Regards,
BobS

#6 Neal

Neal

    Newbie

  • Member
  • Pip
  • 6 posts
  • Main OS: Windows 7

Posted 14 September 2011 - 10:42 AM

So the problem must be in the vhosts config. But I just double-checked my setup and I get the same results as you do! We'll have to do more analysis on this problem....


Bob -
Well, I'm glad you were able to reproduce this.
But, I don't think the problem is in the Vhosts config, since I'm able to create a new Joomla site and it works fine, with the same vhost setup as the others. The only difference is that the new Joomla site is 1.7 and the ones I've copied over from IIS6 are 1.5.22.
It seems that somewhere in the Joomla front-end code (not back-end, since that works fine), it's re-directing the URL.
Look forward to seeing what you find out...
Thanks,
Neal

#7 BobS

BobS

    Project Helper

  • Super Moderator
  • PipPipPip
  • 334 posts
  • Location:Santiago Chile
  • Interests:Retiring, computer systems, system design, model railroads....
  • Wiki ID: BobS
  • Main OS: Windows 7

Posted 14 September 2011 - 11:47 AM

Okay, Round 2!

Let's go back to the beginning. We'll start with adding a vhost for newsite.mydomain.lan to a clean UniServer instance.

In \usr\local\apache2\conf\httpd.conf, near the end is the vhosts section.
We'll add the following lines:
<VirtualHost *:80>
  ServerAdmin webmaster@localhost.org
  DocumentRoot C:/UniServer/vhosts/newsite1
  ServerName newsite1.mydomain.lan
  ServerAlias www.mydomain.lan  *.mydomain.lan
  ErrorLog logs/newsite1.mydomain.lan-error.log
  CustomLog logs/newsite1.mydomain.lan-access.log common
</VirtualHost>
Next, we need to put a simple index.html file into the document root: C:/UniServer/vhosts/newsite1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>VHOST TEST</title>
  </head>
	<body>
<h2>This is NEWSITE1</h2>
  </body>
</html>
Finally, since we're not using the IP for mydomain.lan (if it existed), I'll set up a "shorcircuit" in the hosts file:
127.0.0.1 newsite1.mydomain.lan
We'll can test this by opening a command prompt to ping newsite1.mydomain.lan .

Now we can (re)start Apache and point our browser to newsite.mydomain.lan. This will connect us to the page we just created above. Since I copied this code directly from my working site, I know it functions properly.

The key points of this exercise are to validate that the vhosts system works as expected, and to create a functional template that can be edited to create the desired site hosts.

Regards,
BobS

#8 BobS

BobS

    Project Helper

  • Super Moderator
  • PipPipPip
  • 334 posts
  • Location:Santiago Chile
  • Interests:Retiring, computer systems, system design, model railroads....
  • Wiki ID: BobS
  • Main OS: Windows 7

Posted 14 September 2011 - 12:23 PM

AHA!! You didn't mention that you were using older Joomla! code.
There might be a problem with the version of PHP. You should check with the Joomla! site for compatibility requirements. I don't really know if this is the problem, but in the past when I've attempted to port old code, I have run into PHP version-related errors.

Again, though, in all cases you should start with a simple test. See if you can just get a basic html page to respond properly for the new vhost, and then slap in the Joomla code.

Regards,
BobS

#9 Neal

Neal

    Newbie

  • Member
  • Pip
  • 6 posts
  • Main OS: Windows 7

Posted 14 September 2011 - 06:59 PM

There might be a problem with the version of PHP. You should check with the Joomla! site for compatibility requirements.

Again, though, in all cases you should start with a simple test. See if you can just get a basic html page to respond properly for the new vhost, and then slap in the Joomla code.


To confirm Joomla would run ok, I downloaded and installed Joomla 1.5.23 using a new subdomain (test.mydomain.com), added a new Vhost and it works fine with the new version of PHP.

I then upgraded one of my test sites to 1.5.23 (just to make sure there wasn't an issue fixed between 1.5.22 and 1.5.23) but I still have the problem with the front-end. When I go to http://newsite1.mydomain.com/, I get the same error:
Firefox can't find the server at www.newsite1.mydomain.com

but Administrator works fine.

To review, the things I did:
1. Copy a Joomla 1.5.22 site to a new server
2. On new server, used Uniform Server (Apache) instead of IIS6
3. Created a new sub-domain to access the site (since my current site is still Live on the IIS server)
4. Setup/updated configuration.php, httpd.conf and .htaccess

Any other ideas would be appreciated.

#10 Neal

Neal

    Newbie

  • Member
  • Pip
  • 6 posts
  • Main OS: Windows 7

Posted 16 September 2011 - 07:37 PM

To review, the things I did:
1. Copy a Joomla 1.5.22 site to a new server
2. On new server, used Uniform Server (Apache) instead of IIS6
3. Created a new sub-domain to access the site (since my current site is still Live on the IIS server)
4. Setup/updated configuration.php, httpd.conf and .htaccess

Any other ideas would be appreciated.


Ok, here's a clue that should crack this (I hope).

I went into the main Index.php file and after doing a series of traces, found that if I change the last line in the file from this:

echo JResponse::toString($mainframe->getCfg('gzip'));

to this:

echo JResponse::toString($mainframe->getCfg(''));

the site renders fine and doesn't redirect to add the "www.".

So, what's going on?

Thanks,
Neal




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users