Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Apache setup


  • Please log in to reply

#1
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 31,672 posts
Hi everyone,

This is probably some simple detail I have overlooked, but I'm about to give up.

I have installed Windows 2003 and XAMPP on an old server for a friend of mine who wanted to have his own webserver.
Everything went reasonably well and the website I put up works on the server itself.

But ... when I connect to the server from another machine in my network (using the IP of the server) the index file loads, but all the images, stylesheet etc, which are in subfolders do not load.
I looked at the source and all the links look like this:
http://127.0.0.1/images/front.jpg etc.
That explains why the server can find them and my computer doesn't, but what have I done wrong?

I have edited httpd.conf in two places to point to the correct folder (should have worked because it finds the index file)

For giggles I switched from Apache to IIS and I get a Bad request (Invalid Hostname) reply when I try to connect.

The FileZilla connection for ftp works brilliant.

If you need any more information to help, please ask. I wanted to finish this project yesterday. :)
  • 0

Advertisements


#2
Fatheed

Fatheed

    Member

  • Member
  • PipPip
  • 38 posts
Have you checked to make sure the hyperlinks in each page are linking to files with a relative path and not with an actual http:// address.

I'll use an example as I couldn't think how to word that. :)

Example

I'll say the below is the contents of your directory.

Posted Image

and the image folder....

Posted Image


To link to the image in the index file you would have this: -

<img src="/images/front.jpg">

What I think you have done is entered the URL as: -

<img src="http://127.0.0.1/ima...ges/front.jpg">


Obviously, as you know if you try and connect to 127.0.0.1 it's gonna come back to your machine, which won't respond since you don't have Apache :)

Let me know if that's confusing, 'cos I struggled to explain that well :)
  • 0

#3
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Hi Fatheed, :)

I understood what you meant and had checked that.

The site is based on a Wordpress blog.
The paths are coded in php like this:
<img src="<?php bloginfo('url'); ?>/images/front.jpg">

So I guess the good news is there might be one central place where I can change it.
Someone was so kind to give me a link to this:
http://codex.wordpre...dress_.28URL.29
I will try that tonight and keep you all posted.
  • 0

#4
Fatheed

Fatheed

    Member

  • Member
  • PipPip
  • 38 posts
In that case, I think I know the problem.

When it was installed the IP was entered as Localhost, so if it's changed to his actual IP it should work fine :)
  • 0

#5
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Hi Fatheed,

You mean during the XAMPP install?

Do you happen to know where I can change that?
  • 0

#6
Fatheed

Fatheed

    Member

  • Member
  • PipPip
  • 38 posts
No, XAMPP is just waiting for any incoming connections on the Apache port.

You mentioned <img src="<?php bloginfo('url'); ?>/images/front.jpg">

bloginfo('url') will refer to WP_HOME in the config.

If WP_HOME is set as 127.0.0.1 instead of the actual I.P. address of the machine, the images will attempt to load from your own machine :)

If that made sense :)
  • 0

#7
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Changed in wp-config.php:

define('WP_HOME', 'http://www.example.com');
define('WP_SITEURL', 'http://www.example.com');

and in my hosts file

192.168.2.4 www.example.com

That works!! Thanks to all that helped.
Now get the server to keep the connection open and I should be good to go, but that's another story.
  • 0

#8
Fatheed

Fatheed

    Member

  • Member
  • PipPip
  • 38 posts
Your Welcome! :)

Merry Christmas!
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP