Apache-CSS 하지 않습에 대한 링크를 제 웹 페이지의

0

질문

나는 구성된 웹 서버에 액세스할 때는 내 localhost, bash 스크립트를 실행 및 에코 HTML 문서는 그래서 브라우저 렌더링할 수 있습니다. 이것이 제대로 작동합니다.

나는 데 문제기 CSS 작동합니다. 그것을 던지 GET http://172.20.10.6/css/styles.css net::ERR_ABORTED 500 (Internal Server Error) 콘솔에서 액세스할 때 웹 페이지입니다.

나는 폴더 이름 webserver (/var/www/webserver다)및 폴더 안에 있는 나는 index.sh 제공하는 HTML 성공적으로 폴더 cssstyles.css 파일입니다.

.conf 파일에 대한 내 가상호스트:

<VirtualHost *:80>
    ServerAdmin user@localhost
    ServerName Test
    ServerAlias Test
    DocumentRoot /var/www/webserver

    ScriptAlias "/" "/var/www/webserver/"
    <Directory "/var/www/webserver">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    <Directory "/var/www/webserver/css">
        <Files *.css>
            Header set Content-type "text/css"
        </Files>
    </Directory>

    <IfModule dir_module>
        DirectoryIndex index.sh
    </IfModule>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

이것은 어떻게 내 CSS 에서 파일을 HTML:

echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/styles.css\">"

그러나 다음 500 오류,내가 무엇을 할 수 있습니까?

편집

이것은 오류 로그를 나에 액세스할 때 웹 페이지:

AH01215: (13)Permission denied: exec of '/var/www/webserver/css/styles.css' failed: /var/www/webserver/css/styles.css, referer: http://172.20.10.6/
End of script output before headers: styles.css, referer: http://172.20.10.6/

그래서 저는 생각했에 대한 모든 권한 및 실행 chmod 777 css/styles.css 하고 다시 시작하는 서버입니다.

이제 오류가 나를 얻을 통해 콘솔: Failed to load resource: the server responded with a status of 500 (Internal Server Error) 고서 error.log 파일:

AH01215: (8)Exec format error: exec of '/var/www/webserver/css/styles.css' failed: /var/www/webserver/css/styles.css, referer: http://172.20.10.6/
End of script output before headers: styles.css, referer: http://172.20.10.6/

또한 추가하려고 했 AddType text/css .css.htaccess 파일에서 또는 .conf 파일로 웹 서버의 없이 어떤 성공입니다. 또한,가 mime.loadheaders.load 개조에 사용 /etc/apache2/mods-enabled.

전체 index.sh:

#!/bin/bash

echo -e "Content-type: text/html\n\n"

echo "<!DOCTYPE html>
<html lang=\"en\" dir=\"ltr\">
  <head>
    <meta charset=\"utf-8\">
    <title>Server Manager</title>

    <link rel=\"stylesheet\" type=\"text/css\" href=\"css/styles.css\">
  </head>
  <body>
    <header>

    </header>

    <nav class=\"menu\">
      <ul>
        <li class=\"menu-item\">
          <span></span>
          <div class=\"menu-item-text\">Manage tasks</div>
        </li>
        <li class=\"menu-item selected\">
          <span></span>
          <div class=\"menu-item-text\">Monitoring</div>
        </li>
        <li class=\"menu-item\">
          <span></span>
          <div class=\"menu-item-text\">Logs</div>
        </li>
        <li class=\"menu-item\">
          <span></span>
          <div class=\"menu-item-text\">Users</div>
        </li>
        <li class=\"menu-item\">
          <span></span>
          <div class=\"menu-item-text\">Packet handler</div>
        </li>
        <li class=\"menu-item\">
          <span></span>
          <div class=\"menu-item-text\">Schedule tasks</div>
        </li>
        <li class=\"menu-item\">
          <span></span>
          <div class=\"menu-item-text\">Music</div>
        </li>
      </ul>
    </nav>

    <div class=\"content\">
      <div class=\"title\">Log in</title>
    </div>
  </body>
</html>"
apache bash css
2021-11-23 12:53:12
1
0

처럼에 오류가 있의 HTML 코드,수정에 다음 줄의 코드

<div class="title">Log in</title>
2021-11-24 07:47:11

공유하시기 바랍 더 많은 정보는 다른 사람을 배울 수 있습에서 당신의 대답이다. 이것이 정말로 해결하는 오류 메시지에 던져 선적 CSS 파일입니까? 그렇다면,이것은 어떻게 일하는가?
Nico Haase

나는 생각되었을 것이 분명합니다. 할 수 있는 가까이하지 않는 html DIV 태그와 함께 제목은 태그가 있습니다. Html 는 경우 DIV 태그를 닫아야 합니다 그것 DIV.
MikeMoy

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................