AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题

问题[rewrite](unix)

Martin Hope
Chris Stryczynski
Asked: 2019-11-21 09:17:30 +0800 CST

即使文件存在,Apache RewriteCond 在“REQUEST_FILENAME”上也不匹配?

  • 0

跟踪日志:

apache_1    | [Wed Nov 20 17:14:43.950796 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] init rewrite engine with requested uri /css/main.css
apache_1    | [Wed Nov 20 17:14:43.950822 2019] [rewrite:trace3] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1    | [Wed Nov 20 17:14:43.950836 2019] [rewrite:trace4] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] RewriteCond: input='/css/main.css' pattern='-f' => not-matched
apache_1    | [Wed Nov 20 17:14:43.950839 2019] [rewrite:trace3] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1    | [Wed Nov 20 17:14:43.950842 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] rewrite '/css/main.css' -> '/index.php'
apache_1    | [Wed Nov 20 17:14:43.950845 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] local path result: /index.php
apache_1    | [Wed Nov 20 17:14:43.950850 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] prefixed with document_root to /var/www/html/public/index.php
apache_1    | [Wed Nov 20 17:14:43.950852 2019] [rewrite:trace1] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] go-ahead with /var/www/html/public/index.php [OK]

重要的一点是:

RewriteCond: input='/css/main.css' pattern='-f' => not-matched

为什么找不到文件?它肯定在那里。

配置有:

    DocumentRoot /var/www/html/public/

该文件位于:/var/www/html/public/css/main.css.


在apache上运行strace我看到以下内容:

apache_1    | [pid    11] poll([{fd=9, events=POLLIN}], 1, 3000 <unfinished ...>
apache_1    | [pid    10] <... select resumed> )      = 0 (Timeout)
apache_1    | [pid    10] wait4(-1, 0x7ffd156f4e0c, WNOHANG|WSTOPPED, NULL) = 0
apache_1    | [pid    10] times({tms_utime=2, tms_stime=13, tms_cutime=0, tms_cstime=0}) = 478112492
apache_1    | [pid    10] select(0, NULL, NULL, NULL, {tv_sec=1, tv_usec=0}) = 0 (Timeout)
apache_1    | [pid    10] wait4(-1, 0x7ffd156f4e0c, WNOHANG|WSTOPPED, NULL) = 0
apache_1    | [pid    10] times({tms_utime=2, tms_stime=13, tms_cutime=0, tms_cstime=0}) = 478112592
apache_1    | [pid    10] select(0, NULL, NULL, NULL, {tv_sec=1, tv_usec=0}) = 0 (Timeout)
apache_1    | [pid    10] wait4(-1, 0x7ffd156f4e0c, WNOHANG|WSTOPPED, NULL) = 0
apache_1    | [pid    10] times({tms_utime=2, tms_stime=13, tms_cutime=0, tms_cstime=0}) = 478112692
apache_1    | [pid    10] select(0, NULL, NULL, NULL, {tv_sec=1, tv_usec=0} <unfinished ...>
apache_1    | [pid    67] <... epoll_wait resumed> [{EPOLLIN, {u32=3893182512, u64=140578172780592}}], 52, -1) = 1
apache_1    | [pid    59] <... epoll_wait resumed> [{EPOLLIN, {u32=3893182512, u64=140578172780592}}], 52, -1) = 1
apache_1    | [pid    67] accept4(3,  <unfinished ...>
apache_1    | [pid    59] accept4(3,  <unfinished ...>
apache_1    | [pid    67] <... accept4 resumed> {sa_family=AF_INET, sin_port=htons(42176), sin_addr=inet_addr("172.18.0.1")}, [128->16], SOCK_CLOEXEC) = 16
apache_1    | [pid    59] <... accept4 resumed> 0x7fda85ffad30, [128], SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
apache_1    | [pid    67] futex(0x7fdae80d3160, FUTEX_WAKE_PRIVATE, 1) = 1
apache_1    | [pid    59] epoll_wait(13,  <unfinished ...>
apache_1    | [pid    67] epoll_wait(13,  <unfinished ...>
apache_1    | [pid    22] <... futex resumed> )       = 0
apache_1    | [pid    22] futex(0x7fdae80d30e8, FUTEX_WAKE_PRIVATE, 1) = 0
apache_1    | [pid    22] getsockname(16, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("172.18.0.3")}, [128->16]) = 0
apache_1    | [pid    22] fcntl(16, F_GETFL)          = 0x2 (flags O_RDWR)
php-main_1  | - -  20/Nov/2019:17:40:08 +0000 "GET /css/main.css" 200
apache_1    | [pid    22] fcntl(16, F_SETFL, O_RDWR|O_NONBLOCK) = 0
apache_1    | [pid    22] read(16, "GET /css/main.css HTTP/1.1\r\nHost"..., 8000) = 90
apache_1    | [pid    22] getpid()                    = 13
apache_1    | [pid    22] getpid()                    = 13
apache_1    | [pid    22] getpid()                    = 13
apache_1    | [pid    22] write(6, "[Wed Nov 20 17:40:08.966703 2019"..., 249[Wed Nov 20 17:40:08.966703 2019] [rewrite:trace2] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] init rewrite engine with requested uri /css/main.css
apache_1    | ) = 249
apache_1    | [pid    22] getpid()                    = 13
apache_1    | [pid    22] write(6, "[Wed Nov 20 17:40:08.966779 2019"..., 240[Wed Nov 20 17:40:08.966779 2019] [rewrite:trace3] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1    | ) = 240
apache_1    | [pid    22] stat("/css/main.css", 0x7fdae534f8d0) = -1 ENOENT (No such file or directory)
apache_1    | [pid    22] getpid()                    = 13
apache_1    | [pid    22] write(6, "[Wed Nov 20 17:40:08.966875 2019"..., 259[Wed Nov 20 17:40:08.966875 2019] [rewrite:trace4] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] RewriteCond: input='/css/main.css' pattern='-f' => not-matched
apache_1    | ) = 259
apache_1    | [pid    22] getpid()                    = 13
apache_1    | [pid    22] write(6, "[Wed Nov 20 17:40:08.966925 2019"..., 240[Wed Nov 20 17:40:08.966925 2019] [rewrite:trace3] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1    | ) = 240
apache_1    | [pid    22] getpid()                    = 13
apache_1    | [pid    22] write(6, "[Wed Nov 20 17:40:08.966980 2019"..., 236[Wed Nov 20 17:40:08.966980 2019] [rewrite:trace2] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] rewrite '/css/main.css' -> '/index.php'

编辑

为什么 Apache 试图阅读/css/main.css?为什么它不在那里使用文档根目录

apache-httpd rewrite
  • 1 个回答
  • 301 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve