Project

General

Profile

[UE] failed to add CSS and JS file

Added by sixteenccc about 2 months ago

lighttpd 1.4.63


Replies (4)

RE: failed to add CSS and JS file - Added by sixteenccc about 2 months ago

sixteenccc wrote:

lighttpd 1.4.63

Operating System (OS) :
inux version 6.5.0-21-generic (buildd@lcy02-amd64-091) (x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
conf :

server.modules = (
    "mod_indexfile",
    "mod_access",
    "mod_alias",
    "mod_redirect",
)

server.document-root        = "/var/www/html" 
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log" 
server.pid-file             = "/run/lighttpd.pid" 
server.username             = "www-data" 
server.groupname            = "www-data" 
server.port                 = 80

# features
#https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_feature-flagsDetails
server.feature-flags       += ("server.h2proto" => "enable")
server.feature-flags       += ("server.h2c"     => "enable")
server.feature-flags       += ("server.graceful-shutdown-timeout" => 5)
#server.feature-flags       += ("server.graceful-restart-bg" => "enable")

# strict parsing and normalization of URL for consistency and security
# https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_http-parseoptsDetails
# (might need to explicitly set "url-path-2f-decode" = "disable" 
#  if a specific application is encoding URLs inside url-path)
server.http-parseopts = (
  "header-strict"           => "enable",# default
  "host-strict"             => "enable",# default
  "host-normalize"          => "enable",# default
  "url-normalize-unreserved"=> "enable",# recommended highly
  "url-normalize-required"  => "enable",# recommended
  "url-ctrls-reject"        => "enable",# recommended
  "url-path-2f-decode"      => "enable",# recommended highly (unless breaks app)
 #"url-path-2f-reject"      => "enable",
  "url-path-dotseg-remove"  => "enable",# recommended highly (unless breaks app)
 #"url-path-dotseg-reject"  => "enable",
 #"url-query-20-plus"       => "enable",# consistency in query string
)

index-file.names            = ( "index.php", "index.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
#url.access-allow = (".jpg", ".gif",".css")

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.conf.pl" 
include "/etc/lighttpd/conf-enabled/*.conf" 

#server.compat-module-load   = "disable" 
server.modules += (
    "mod_dirlisting",
    "mod_staticfile",
)

dir-listing.external-css ="/var/www/html/bootstrap.min.css" 

RE: failed to add CSS and JS file - Added by sixteenccc about 2 months ago

sudo etc/init.d/lighttpd start
server is running,but the css file doesn't work

RE: failed to add CSS and JS file - Added by sixteenccc about 2 months ago

<link rel="stylesheet" href="/bootstrap.min.css" />

RE: failed to add CSS and JS file - Added by gstrauss about 2 months ago

The request for http://127.0.0.1/index.html is handled by mod_staticfile since you requested index.html directly.

If you had requested http://127.0.0.1/, then mod_indexfile would handle the request since your config has index-file.names = ( "index.php", "index.html" )

To use mod_dirlisting please read the documentation and use dir-listing.activate = "enable". Note that mod_indexfile will still handle requests to directories if those directories contain index.php or index.html, so test mod_dirlisting with a directory that does not contain either of those files.

    (1-4/4)