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
    • 最新
    • 标签
主页 / computer / 问题

问题[debian-buster](computer)

Martin Hope
Connor Irwin
Asked: 2021-04-07 06:22:28 +0800 CST

404 没有尾部斜杠

  • 4

我已经设置了我的网站,这样如果有人试图查看被禁止的内容,他们将收到 404 错误而不是 403,但是当他们这样做时,会在 URL 的末尾添加一个斜杠。此外,如果您尝试访问实际上应该返回 404(不存在)的 URL,则不会添加尾部斜杠。

例子:

https://example.com/forbidden-directory => https://example.com/forbidden-directory/

https://example.com/404-directory => (No change)

我如何使它始终添加尾部斜杠?

(我使用 apache 2.4)

apache2.conf:

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#       /etc/apache2/
#       |-- apache2.conf
#       |       `--  ports.conf
#       |-- mods-enabled
#       |       |-- *.load
#       |       `-- *.conf
#       |-- conf-enabled
#       |       `-- *.conf
#       `-- sites-enabled
#               `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#Mutex file:${APACHE_LOCK_DIR} default

#
# The directory where shm and other runtime files will be stored.
#

DefaultRuntimeDir ${APACHE_RUN_DIR}

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

# vv This code allows .*.gz files to be served as the file contained in the .gz file vv
Options +MultiViews
RemoveType .gz
AddEncoding gzip .gz
<FilesMatch ".+\.tar\.gz$">
        RemoveEncoding .gz
        #Note:  Can use application/x-gzip for backwards-compatibility
        AddType application/gzip .gz
</FilesMatch>
Header set Content-Encoding "gzip" env=is_gzip
# ^^                                                                                 ^^



# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr note

我在虚拟主机文件中尝试过的代码:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.connorirwin\.com$
RewriteRule ^/(.*)$ https://connorirwin.com/$1/ [R=301,L]
apache-http-server debian-buster
  • 1 个回答
  • 47 Views
Martin Hope
showkey
Asked: 2021-02-11 16:13:05 +0800 CST

为什么安装 vim 的一部分而不是整个 diectories?

  • 7

我发现 vim 的那部分安装了以下命令:

sudo apt install vim

检查路径包含 vim 的所有目录。

sudo find / -name  vim
/etc/alternatives/vim
/etc/vim
/var/lib/dpkg/alternatives/vim
/usr/share/bug/vim
/usr/share/cmake-3.13/editors/vim
/usr/share/lintian/overrides/vim
/usr/share/doc/vim
/usr/bin/vim

没有 , 之类的vim/vim81目录vim/vim81/autoload。我在我的操作系统上得到了矛盾的信息:

vim  --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 15 2019 16:41:15)

1.脚本名称

进入vim并输入:scriptnamesex模式,没有显示!

2.定位

locate vim81 |grep autoload
/usr/share/vim/vim81/autoload
/usr/share/vim/vim81/autoload/README.txt
/usr/share/vim/vim81/autoload/RstFold.vim
/usr/share/vim/vim81/autoload/ada.vim

3.ls

ls  /usr/share/vim/vim81/autoload
ls: cannot access '/usr/share/vim/vim81/autoload': No such file or directory

我不喜欢 vim82 而不是 vim81,对它们的任何版本都满意,我很遗憾在我安装后它们都不能工作。
我的安装有什么问题?

sudo updatedb
sudo apt remove vim
sudo apt install vim
locate vim81
Nothing output
locate vim82
Nothing output

还是不能安装。正如@harrymc 所说:

uname -a
Linux mydebian 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
sudo apt-get update
sudo apt-get install vim vim-gtk3
sudo updatedb

现在检查 vim81 或 vim82:

locate vim81
locate vim82

他们什么都不输出,我进入vim,scriptnames什么也不显示。

sudo find /  -name 'vim'  
/etc/alternatives/vim
/etc/vim
/var/lib/dpkg/alternatives/vim
/home/debian/nginx/contrib/vim
/usr/share/bug/vim
/usr/share/cmake-3.13/editors/vim
/usr/share/lintian/overrides/vim
/usr/share/doc/vim
/usr/bin/vim

在我朋友的debian中没有看到这样的目录/usr/share/vim,也就是说,安装一个brokervim并安装,重新安装并不能修复我的包管理系统。
有一个特殊的目录/usr/share/lintian/overrides/vim。

ls  /usr/share/lintian/overrides  |grep  vim
vim
vim-common
vim-gtk3
vim-gui-common
vim-tiny

显示这些文件中的内容。

debian@mydebian:/usr/share/lintian/overrides$ cat vim
# vim.xxx files are alternatives for (g)vim, which has a manpage in vim(-gui)-common
vim binary: binary-without-manpage usr/bin/vim.basic
debian@mydebian:/usr/share/lintian/overrides$ cat vim-common
# Provided by vim (virtual) packages
vim-common binary: desktop-command-not-in-package usr/share/applications/vim.desktop vim
debian@mydebian:/usr/share/lintian/overrides$ cat vim-gtk3
# vim.xxx files are alternatives for (g)vim, which has a manpage in vim(-gui)-common
vim-gtk3 binary: binary-without-manpage usr/bin/vim.gtk3
debian@mydebian:/usr/share/lintian/overrides$ cat vim-gui-common
# Provided by gvim (virtual) packages
vim-gui-common binary: desktop-command-not-in-package usr/share/applications/gvim.desktop gvim
debian@mydebian:/usr/share/lintian/overrides$ cat vim-tiny
# vim.xxx files are alternatives for (g)vim, which has a manpage in vim(-gui)-common
vim-tiny binary: binary-without-manpage usr/bin/vim.tiny
    

删除所有文件ls /usr/share/lintian/overrides |grep vim并重新安装?

vim debian-buster
  • 2 个回答
  • 191 Views
Martin Hope
malat
Asked: 2020-05-27 01:49:06 +0800 CST

nouveau:模块参数存储在哪里?

  • 8

我一直在尝试使用 nouveau 调试错误,现在我想删除以前的设置。

这是我看到的:

% dmesg | grep nouveau
[...]
[    1.487361] [drm:nouveau_drm_init [nouveau]] ... debug        : PTHERM=debug,PTIMER=debug

兼容:

# cat /sys/module/nouveau/parameters/debug 
PTHERM=debug,PTIMER=debug

此设置存储在哪里?

我尝试了一个天真的:

% find /etc/modprobe.d 
/etc/modprobe.d
/etc/modprobe.d/nouveau.conf

这使:

% cat /etc/modprobe.d/nouveau.conf
# debug nouveau
options nouveau debug="PFIFO=debug"
debian-buster kernel-module
  • 1 个回答
  • 114 Views
Martin Hope
massa
Asked: 2020-05-19 23:33:28 +0800 CST

在 Debian Buster 上强制使用 MAC 地址作为 DHCP 客户端 ID

  • 14

Debian Buster dhclient 随机使用其 MAC 地址或生成的 DUID-LLT 作为其 DHCP 客户端 ID。

我可以强制它始终使用 MAC 地址而不是生成的 DUID-LLT 吗?

我知道这个选项send dhcp-client-identifier = xx:xx:xx:xx:xx:xx;,但它迫使我使用自己的 MAC 地址手动配置每个接口,如果可能的话,我宁愿避免这种情况。

正如我之前所说,它已经在这样做了,但是是随机的。

可以强迫它总是这样做吗?

dhcp debian-buster
  • 2 个回答
  • 10142 Views
Martin Hope
Run CMD
Asked: 2020-01-19 04:31:58 +0800 CST

爱普生图像扫描!Linux 版(iscan 2.30.4 for Perfection V370)无法在 Debian 10(Buster)上正确安装

  • 6

当我尝试iscan-perfection-v370-bundle-2.30.4.x64.deb在 Debian 10 (Buster) 上安装时,我可以看到以下消息:

expr: syntax error: missing argument after „-“
tail: invalid number of lines: „/lib/udev/rules.d/60-libsane.rules“

注意:第二条消息出现在基于语言环境的翻译中;它已被我翻译回英文。

执行/sbin/dpkg-reconfigure iscan-data导致完全相同的消息。

因此,扫描仪仅对超级用户可用;超级用户可以iscan完美执行。

输出dpkg --status iscan-data:

Package: iscan-data
Status: install ok installed
[...]

问题是什么?如何修复?

debian-buster
  • 1 个回答
  • 662 Views

Sidebar

Stats

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

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve