Forums / General Questions / Apache Problem, Apache on our LAN not showing images/css

Apache Problem, Apache on our LAN not showing images/css

Views: 5,134

Results 1 to 8 of 8
24 Feb 2012, 9:01 PM
#1
ddy1 avatar

ddy1

New Zenner

Join Date:
Jun 2009
Posts:
8
Plugin Contributions:
0

Apache Problem, Apache on our LAN not showing images/css

Hi,

I have an apache web server set up on my lan. It serves the public_html directory of one of it's users to the rest of the lan, and is not available outside of the lan. I have a Zen Cart installed on it. The Zen Cart works fine when it is accessed from the server itself, either via localhost or 192.168.x.x. from the other computers on the lan it seems that it is refusing to serve the images and css files, but the basic Zen Cart is more or less there. Running Ubuntu on all computers, second to latest version.

Thanks for your help,

Mark

24 Feb 2012, 9:05 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Apache Problem, Apache on our LAN not showing images/css

In your configure.php files, you must use an HTTP_SERVER value which all the other computers on your LAN are able to understand.

"localhost" is not valid, because it only applies to the computer you're using at the time.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Feb 2012, 2:43 AM
#3
ddy1 avatar

ddy1

New Zenner

Join Date:
Jun 2009
Posts:
8
Plugin Contributions:
0

Re: Apache Problem, Apache on our LAN not showing images/css

Dr. Byte,

Thank you so much. I don't think I would have been able to figure that one out.

Sincerely,

Mark

25 Feb 2012, 7:02 AM
#4
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Apache Problem, Apache on our LAN not showing images/css

I am using a similar set up at home on a Ubuntu 11.04 LAMP to develop my ZC sites.

the includes/configure.php file looks something like this and works a treat:

/*************** NOTE: This file is similar, but DIFFERENT from the "admin" version of configure.php. ***********/
/***************       The 2 files should be kept separate and not used to overwrite each other.      ***********/

// Define the webserver and path parameters
  // HTTP_SERVER is your Main webserver: eg-http://www.your_domain.com
  // HTTPS_SERVER is your Secure webserver: eg-https://www.your_domain.com
  define('HTTP_SERVER', 'http://192.168.x.x');
  define('HTTPS_SERVER', 'https://192.168.x.x');

  // Use secure webserver for checkout procedure?
  define('ENABLE_SSL', 'false');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
  // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
  define('DIR_WS_CATALOG', '/zen-cart-site/');
  define('DIR_WS_HTTPS_CATALOG', '/zen-cart-site/');

  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');
  define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');

  define('DIR_WS_PHPBB', '/');

// * DIR_FS_* = Filesystem directories (local/physical)
  //the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
  define('DIR_FS_CATALOG', '/var/www/dispensary/');

  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');
  define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/');
  define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS);
  define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/');

// define our database connection
  define('DB_TYPE', 'mysql');
  define('DB_PREFIX', 'zen_');
  define('DB_SERVER', 'localhost'); // localhost works here
  define('DB_SERVER_USERNAME', 'whatever');
  define('DB_SERVER_PASSWORD', 'SOME_PASSword');
  define('DB_DATABASE', 'zencart');
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'db');
  // for STORE_SESSIONS, use 'db' for best support, or '' for file-based storage

  // The next 2 "defines" are for SQL cache support.
  // For SQL_CACHE_METHOD, you can select from:  none, database, or file
  // If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache 
  // or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder
  // ie: /path/to/your/webspace/public_html/zen/cache   -- leave no trailing slash  
  define('SQL_CACHE_METHOD', 'none'); 
  define('DIR_FS_SQL_CACHE', '/var/www/zen-cart-site/cache');

// EOF

Anyone on the LAN wanting to access the zen-cart-site would type http://192.168.x.x/zen-cart-site/ in the browser address bar.

192.168.x.x is the IP of the Ubuntu box where your LAMP is installed.

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

25 Feb 2012, 7:55 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Apache Problem, Apache on our LAN not showing images/css

Just be aware that sometimes you may run into problems with sessions working properly if you're running with an IP address specified in HTTP_SERVER, especially if you choose to enable SSL and put an IP address in HTTPS_SERVER. This is due to session-cookie problems associated with using an IP address instead of a proper FQDN. In reality this would never be a problem on a legitimate live store, but could cause troubles on a self-hosted PC-server at home or in a local LAN.

There are various ways of setting up an understood FQDN that all the other PCs on your LAN would recognize. But that's an advanced networking concept way beyond the scope of Zen Cart itself.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

28 Feb 2012, 7:16 PM
#6
ddy1 avatar

ddy1

New Zenner

Join Date:
Jun 2009
Posts:
8
Plugin Contributions:
0

Re: Apache Problem, Apache on our LAN not showing images/css

Hi,

If I use /etc/hosts to attach a name, say,
"pine" to a computer on my local network, would this be sufficient to avoid the problems associated with using ip addresses in the configure.php files?

/etc/hosts entry

192.168.x.x            pine

If so, would the following configure.php work?

define('HTTP_SERVER', 'http://pine');
define('HTTPS_SERVER', 'https://pine');

Thanks,

Mark

28 Feb 2012, 7:20 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Apache Problem, Apache on our LAN not showing images/css

Mark,
Yes, that works fine. I use that approach very often.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

28 Feb 2012, 9:26 PM
#8
ddy1 avatar

ddy1

New Zenner

Join Date:
Jun 2009
Posts:
8
Plugin Contributions:
0

Re: Apache Problem, Apache on our LAN not showing images/css

Hi,

Once again, thank you very much.

Sincerely,

Mark