DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 11th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default Default Apache won't read .css file

Help! The default Apache install with my OpenBSD 4.3 box just won't display my webpages as styled -- displays them with no formatting at all.

Now, my "style.css" file is in the web directory, I checked the syntax, and the pages display as they should on my other machine, locally (a Mac laptop)

Both the CSS and HTML validate fine. I have tried both

Code:
<style type="text/css"> /*<![CDATA[*/ @import url(style.css) screen; /*]]>*/ </style>
and

Code:
<link rel="stylesheet" type="text/css" href="./style.css" />
but neither works.

I have TypesConfig conf/mime.types in my httpd.conf and css is listed; and I just don't get it.
Reply With Quote
  #2   (View Single Post)  
Old 11th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

I should say, it won't read (or import) the linked file. If I paste the CSS into the <style> section, it displays as intended.
Reply With Quote
  #3   (View Single Post)  
Old 11th May 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,142
Thanked 182 Times in 149 Posts
Default

The standard OpenBSD Apache, no modifications at all, displays the following test page and css file well.
Code:
$ pwd
/var/www/htdocs
$ ls -l my*
-rw-r--r--  1 www  www   59 May 12 01:01 my.css
-rw-r--r--  1 www  www  617 May 12 01:22 mylinks.html

$ cat mylinks.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
        <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
        <link rel="stylesheet" type="text/css" href="./my.css" />
        <title>My test page</title>

  </head>
<body>

    <div style="color: black; font-size: 80%; display: block ;">

    <h1>Some links</h1>

    <a class="ref" href="xml.html">XML, XSLT etc</a>
    <a class="ref" href="openbsd.html">OpenBSD related stuff</a>
    <a class="ref" href="freebsd.html">FreeBSD utilities </a>

    </div>

</body>
</html>


$ cat my.css

.ref { display: block ; padding: 0.25em ; color: red ; }
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #4   (View Single Post)  
Old 12th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

I've edited my httpd.conf but a syntax check returns OK

Furthermore, every time I use apachectl to start the server, 'ddclient' echoes and spawns another process. Here's my rc.conf.local

Code:
httpd_flags=""
# ddclient
  if [ -x /usr/local/sbin/ddclient ]; then
     echo -n ' ddclient'; /usr/local/sbin/ddclient
  fi
I wonder if this is in any way related?
Reply With Quote
  #5   (View Single Post)  
Old 12th May 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,142
Thanked 182 Times in 149 Posts
Default

You should remove these lines from /etc/rc.conf.local. This file should only contain variable assignments and not any executable shell commands.
Code:
# ddclient
  if [ -x /usr/local/sbin/ddclient ]; then
     echo -n ' ddclient'; /usr/local/sbin/ddclient
  fi
The proper place for this is the file /etc/rc.local.

The apachectl files reads/sources the /etc/rc.conf file. Because rc.conf reads in rc.conf.local, your commands to load ddclient are executed. So you have to take these commands out and put them in the proper file /etc/rc.local

Does the Apache logs complain that it cannot find your css file?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #6   (View Single Post)  
Old 12th May 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,068
Thanked 198 Times in 156 Posts
Default

Did you try opening the CSS file in your browser? What happens if you try?
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #7   (View Single Post)  
Old 12th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by J65nko View Post
You should remove these lines from /etc/rc.conf.local. This file should only contain variable assignments and not any executable shell commands.
Code:
# ddclient
  if [ -x /usr/local/sbin/ddclient ]; then
     echo -n ' ddclient'; /usr/local/sbin/ddclient
  fi
The proper place for this is the file /etc/rc.local.

The apachectl files reads/sources the /etc/rc.conf file. Because rc.conf reads in rc.conf.local, your commands to load ddclient are executed. So you have to take these commands out and put them in the proper file /etc/rc.local
Thanks! I was asleep at the wheel

Quote:
Does the Apache logs complain that it cannot find your css file?
The logs don't contain any errors relating to the css file, that I can find.
Reply With Quote
  #8   (View Single Post)  
Old 12th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Carpetsmoker View Post
Did you try opening the CSS file in your browser? What happens if you try?
The browser (Firefox) opens the CSS file as if it is plain text. The file is a Unix UTF-8 file with no BOM, .css extension.
Reply With Quote
  #9   (View Single Post)  
Old 12th May 2008
roundkat roundkat is offline
Shell Scout
 
Join Date: May 2008
Posts: 107
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by erehwon View Post
The browser (Firefox) opens the CSS file as if it is plain text. The file is a Unix UTF-8 file with no BOM, .css extension.

I think that is what it is supposed to do..
i.e. display plain text..

At least that is what I get from my style.css file on a website that
I maintain..


rk
Reply With Quote
Old 12th May 2008
drhowarddrfine drhowarddrfine is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 358
Thanked 9 Times in 8 Posts
Default

Quote:
Originally Posted by roundkat View Post
I think that is what it is supposed to do..
i.e. display plain text..
Correct when you access the css directly.

Are you sure the css is being served as text/css and not text/plain or something else (common problem)?

Last edited by drhowarddrfine; 12th May 2008 at 06:04 PM.
Reply With Quote
Old 12th May 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,068
Thanked 198 Times in 156 Posts
Default

Can you provide us with a link to the HTML file?
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 13th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Carpetsmoker View Post
Can you provide us with a link to the HTML file?
I can list the relevant source

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>My Site</title>
<style type="text/css">
[long list of css entries]
</style>
It's strange that "text/css" would work here, but not in a linked file in the same directory.

Could it be the Content Type? Default type in my httpd.conf is text/plain....
Reply With Quote
Old 13th May 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,068
Thanked 198 Times in 156 Posts
Default

It doesn't seem to matter:
http://www.rwxrwxrwx.net/test.php
<link type="text/css" rel="stylesheet" href="test.jpeg" />
Works fine...

Can you provide a link? That way I can look at the file to see if there may be an error somewhere, and save it to see if I can reproduce the problem...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 15th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

Soon, I hope. Thanks.
Reply With Quote
Old 15th May 2008
drhowarddrfine drhowarddrfine is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 358
Thanked 9 Times in 8 Posts
Default

Quote:
Originally Posted by erehwon View Post
Could it be the Content Type? Default type in my httpd.conf is text/plain....
Yes, that's the problem. CSS must be served as text/css. Your html, otherwise, is fine.
Reply With Quote
Old 22nd May 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

Having tried getting Apache going on my OpenBSD 4.3 box (I'm not used to 1.3.x), I noticed this peculiarity as well. Forgive posting in an old thread but I've found some thing interesting:


I wanted to test to ensure every thing works in my apache setup before configuring virtual hosts for several projects, so I copied a small template for a home page I made awhile back but noted that my CSS file was not being loaded when testing it.


I found some thing rather odd though, the access log was showing a successful hit on the stylesheet but it would only work in Mozilla if I made it an internal style sheet (no @import or <link>) in my index.html.


After racking my head a bit and exhaustingly reviewing every configuration option I know of without finding any problems in my setup. Then I had a brain fart, every test I had made was via Firefox or Flock over the LAN or Lynx on the server. So I've fired up another machine and ran through tests on the following browsers:

Firefox 2
Flock 1.1
Internet Explorer 7
Safari 3 Beta
Opera 9.x
Netscape 9
Seamonkey 1.1

They all display the dang gum stylesheet except for the Mozilla based ones.


Do you get similar results erehwon?
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.

Last edited by TerryP; 22nd May 2008 at 09:41 PM. Reason: an apology for posting in an old thread
Reply With Quote
Old 26th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by TerryP View Post
noted that my CSS file was not being loaded when testing it.

I found some thing rather odd though, the access log was showing a successful hit on the stylesheet but it would only work in Mozilla if I made it an internal style sheet (no @import or <link>) in my index.html.

So I've fired up another machine and ran through tests on the following browsers:

Firefox 2
Flock 1.1
Internet Explorer 7
Safari 3 Beta
Opera 9.x
Netscape 9
Seamonkey 1.1

They all display the dang gum stylesheet except for the Mozilla based ones.
Very interesting, thanks TerryP. I have not taken such notes, but will do so soon. I wonder why Mozilla browsers would not load the css file that way?
Reply With Quote
Old 26th May 2008
erehwon erehwon is offline
Port Guard
 
Join Date: May 2008
Location: Cascadia
Posts: 34
Thanked 0 Times in 0 Posts
Default

Yes, it works with IE6...what's also odd is that CSS validation returns "I/O error: unknown file type: text/plain" -- but the file is saved as .css -- I wonder if it's a byte-order mark issue or if the .css file has non-Unix line endings?
Reply With Quote
Old 28th May 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

Let me put it this way, Firefox (and apache) is (are) to fat to look threw the code to find out lol.


I think HTTP request messages are supposed to be termnated with a carriage return and line feed. But I've never bothered to read the standard, so I'm not sure what clients receive (\r\n or actual file content byte by byte).

I've tested with my stylesheet using both \n and \r\n formats with the same results.

BOM issue, I haven't really considered yet.

Code:
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
...
  <link rel="stylesheet" charset="utf-8" type="text/css" href="/spidey01.css" />
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 28th May 2008
xCipherx xCipherx is offline
New User
 
Join Date: May 2008
Posts: 8
Thanked 0 Times in 0 Posts
Default

I've got an obsd 4.3 webserver and it handles .css just fine.

I'm using the following code:
Code:
<link rel="stylesheet" type="text/css" href="style.css" />
and I've got my .css file in the rootdirectory.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP read file contents - Maximum file size cksraj Programming 1 21st September 2009 11:38 AM
Upgrading application not installed in default port directory APACHE ijk FreeBSD Ports and Packages 5 13th July 2008 04:34 PM
apache 2.2.8 , is it on chroot by default? superslot OpenBSD Security 9 30th June 2008 11:56 AM
DVD file read error louie FreeBSD General 7 30th May 2008 03:50 PM
Swfdec read-only file access vulnerability corey_james FreeBSD Ports and Packages 0 14th May 2008 11:31 PM


All times are GMT. The time now is 11:18 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick