Apache 我想配置不区分大小写的web服务器
注意:我读到的很多帖子都在谈论httpd,有人告诉我,这误导了我, 现代Apache不使用httpd.conf文件,而是使用自己的apache2.conf 我已经用debian在vps上安装了apache 我已发出以下命令Apache 我想配置不区分大小写的web服务器,apache,.htaccess,mod-speling,Apache,.htaccess,Mod Speling,注意:我读到的很多帖子都在谈论httpd,有人告诉我,这误导了我, 现代Apache不使用httpd.conf文件,而是使用自己的apache2.conf 我已经用debian在vps上安装了apache 我已发出以下命令 sudo a2enmod speling sudo service apache2 restart cd /etc/apache2/sites-available sudo a2ensite 000-default sudo service apache2 restart
sudo a2enmod speling
sudo service apache2 restart
cd /etc/apache2/sites-available
sudo a2ensite 000-default
sudo service apache2 restart
如果我试图在我的/etc/apache2/apache2.conf
中将AllowOverride从None更改为All,特别是在本节中
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
这是/etc/apache2/sites available/000-default.conf的副本
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.mumti.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
请记住,您可以指示我配置实现目标所需的任何最低设置。除了上面的一些小改动之外,配置文件与前几天晚上apache的默认安装非常接近。谢谢
为什么我会得到这样的回应
admin@VRR:~$ sudo service apache2 restart
: invalid option-
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
admin@VRR:~$
我被@mrwhite应用于建议答案中000-default.conf的建议模板,但是上面的sudo服务apache2重启投诉仍然存在?无效选项??
这是最近的error.log(我最近删除了它)
我发现invalid option
thingy存在问题,这是我上传用于mintty on windows编程的.bash_配置文件的结果,我想不是所有bash命令都是相同的go figure。。。
我希望有一个像这里看到的那样的系统/命令提示符
注意:不仅仅是URL,还有引用的文件。被接受的答案甚至适用于HTML中引用的图像文件名,如
,而实际文件名是大小写错误的,如敏感。JpG
它真的很有效谢谢APACHE
如果您有权访问服务器配置,则实际上不需要.htaccess
(除非这有助于分发)
请尝试以下操作:
<VirtualHost *:80>
# Assuming you want to access the domain apex as well?
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
# Case-Insensitive
CheckSpelling on
CheckCaseOnly on
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#假设您也想访问域apex?
ServerName example.com
ServerAlias www.example.com
服务器管理员webmaster@localhost
DocumentRoot/var/www/html
选项索引跟随符号链接
不允许超限
要求所有授权
#不区分大小写
拼写检查
只检查箱子
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
并删除.htaccess
文件
注意DocumentRoot(站点的根目录)是/var/www/html
。您需要在相应的
容器中授予对该目录的访问权限。并且通常是.htaccess
文件应该位于的目录(如果启用)。“有关此错误的更多信息可以在服务器错误日志中找到。
”-您的错误日志报告了什么?@MrWhite我在帖子中添加了一些错误。日志这些错误告诉您mod_重写了(即,RewriteEngine')未安装。尽管在您发布的指令中没有使用该指令(您应该删除
RewriteEngine`指令-这似乎是您的500错误的原因)。其他错误与在.htaccess
中使用
有关(该指令确实无效)-但这似乎已经被注释掉了。您的
容器在哪里?为什么它不在
容器中?DocumentRoot也被设置为不同的目录-不是您允许访问的目录?@MrWhite我没有触摸DocumentRoot,但我移动了。htaccess到www,也许我应该将它移回html文件夹。Al因此,我应该将重命名的添加到.htaccess.OFF以禁用它。我按原样应用了您的模板,只是更改了“示例”到我的域名。我已经在帖子末尾发布了错误日志。哇,我刚发布了上面的评论,它就开始工作了,一定是Firefox拉了一些网站的缓存版本???Qudos到@MrWhite是一个真正的天才,很抱歉没有表情符号给你送吻。现在我需要为傻瓜们写一个指南,让每个人都离开剽窃网站Godaddy。到处都不区分大小写(C'EST LA ViE;-)虽然从浏览器中,URL最终由Apache映射到实际拼写,但是,从我的应用程序中调用了相同的URL,检索XML文件时出现CORS错误,尽管我在任何站点的配置中都启用了跨源。如果我拼写正确,代码中的URL将成功。所以CORS的错误是误导性的。试着我应该开始一个不同的帖子吗?Chrome如何成功检索此URL?根据我正在执行http.get(…)的代码,这里是DevConsole:8100/#/tabs:1从源代码“”对XMLHttpRequest的访问已被CORS策略阻止:请求的资源上不存在“Access Control Allow origin”头。00:20:24.146 CatsService.ts:153 CatsService.LoadData
[Wed Mar 11 18:59:50.815205 2020] [mpm_event:notice] [pid 3281:tid 140482295300160] AH00489: Apache/2.4.25 (Debian) configured -- resuming normal operations
[Wed Mar 11 18:59:50.815277 2020] [core:notice] [pid 3281:tid 140482295300160] AH00094: Command line: '/usr/sbin/apache2'
[Wed Mar 11 18:59:56.596612 2020] [core:alert] [pid 3283:tid 140482088769280] [client 24.20.17.209:24867] /var/www/.htaccess: <Directory not allowed here
[Wed Mar 11 18:59:59.797563 2020] [core:alert] [pid 3283:tid 140482097161984] [client 24.20.17.209:24872] /var/www/.htaccess: <Directory not allowed here
[Wed Mar 11 19:00:02.115843 2020] [core:alert] [pid 3283:tid 140482080376576] [client 24.20.17.209:24877] /var/www/.htaccess: <Directory not allowed here
[Wed Mar 11 19:02:09.976967 2020] [core:alert] [pid 3282:tid 140482122340096] [client 24.20.17.209:25087] /var/www/.htaccess: <Directory not allowed here
[Wed Mar 11 19:02:11.213632 2020] [core:alert] [pid 3282:tid 140482113947392] [client 24.20.17.209:25090] /var/www/.htaccess: <Directory not allowed here
[Wed Mar 11 19:02:26.878673 2020] [core:alert] [pid 3282:tid 140482105554688] [client 24.20.17.209:25119] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[Wed Mar 11 19:02:28.125043 2020] [core:alert] [pid 3282:tid 140482097161984] [client 24.20.17.209:25122] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[Wed Mar 11 19:02:29.623182 2020] [core:alert] [pid 3282:tid 140482088769280] [client 24.20.17.209:25126] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[Wed Mar 11 19:02:32.544649 2020] [mpm_event:notice] [pid 3281:tid 140482295300160] AH00491: caught SIGTERM, shutting down
[Wed Mar 11 19:02:32.636398 2020] [mpm_event:notice] [pid 3361:tid 139631042101312] AH00489: Apache/2.4.25 (Debian) configured -- resuming normal operations
[Wed Mar 11 19:02:32.636474 2020] [core:notice] [pid 3361:tid 139631042101312] AH00094: Command line: '/usr/sbin/apache2'
[Wed Mar 11 19:02:36.250353 2020] [core:alert] [pid 3363:tid 139630838007552] [client 24.20.17.209:25137] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[Wed Mar 11 19:02:37.400118 2020] [core:alert] [pid 3363:tid 139630829614848] [client 24.20.17.209:25141] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[Wed Mar 11 19:02:38.932964 2020] [core:alert] [pid 3363:tid 139630821222144] [client 24.20.17.209:25144] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[Wed Mar 11 19:04:54.443494 2020] [mpm_event:notice] [pid 3361:tid 139631042101312] AH00491: caught SIGTERM, shutting down
admin@VRR:~$ sudo service apache2 restart
: invalid option-
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
admin@VRR:~$
[Wed Mar 11 21:47:47.515090 2020] [mpm_event:notice] [pid 3621:tid 140717672165440] AH00489: Apache/2.4.25 (Debian) configured -- resuming normal operations
[Wed Mar 11 21:47:47.515169 2020] [core:notice] [pid 3621:tid 140717672165440] AH00094: Command line: '/usr/sbin/apache2'
[Wed Mar 11 21:59:14.795332 2020] [mpm_event:notice] [pid 3621:tid 140717672165440] AH00491: caught SIGTERM, shutting down
[Wed Mar 11 21:59:14.895378 2020] [mpm_event:notice] [pid 3716:tid 140701491482688] AH00489: Apache/2.4.25 (Debian) configured -- resuming normal operations
[Wed Mar 11 21:59:14.895455 2020] [core:notice] [pid 3716:tid 140701491482688] AH00094: Command line: '/usr/sbin/apache2'
<VirtualHost *:80>
# Assuming you want to access the domain apex as well?
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
# Case-Insensitive
CheckSpelling on
CheckCaseOnly on
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>