如何在ubuntu中启用AllowEncodedSlashes

时间:2016-04-09 04:45:07

标签: apache ubuntu

正如标题所说我难以在Ubuntu中启用AllowEncodedSlashes

我把

  

AllowEncodedSlashes On

在/etc/apache2/apache2.conf里面和/ etc / apache2 / sites-available / default里面但是在使用编码斜杠访问url之后仍然有404页面 error 404 not found

2 个答案:

答案 0 :(得分:0)

我为此寻找了很多。但是找不到Ubuntu 14.4和Apache 2.4.7的明确答案。我想到了。这是我做的:

转到/etc/apache2/sites-available

打开000-default.conf文件。

AllowEncodedSlashes NoDecode代码

中添加<VirtualHost>

保存并重新启动Apache。

不需要** apache2.conf修改。仅修改000-default.conf文件而不修改default-ssl.conf

答案 1 :(得分:0)

您应该使用

<VirtualHost *:80>
AllowEncodedSlashes On
ProxyPreserveHost On
ProxyRequests Off
ServerName www.domain.com
ServerAlias domain.com
Redirect permanent / https://example.com/
</VirtualHost>

如果您的域使用ssl证书是安全的,那么shuold也应使用443端口

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName example.com
DocumentRoot /var/www/html
ProxyPreserveHost On
AllowEncodedSlashes On
ProxyRequests Off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCertificateFile /home/ubuntu/domain.com/example.com.crt
SSLCertificateKeyFile /home/ubuntu/domain.com/example.com.key
SSLCertificateChainFile /home/ubuntu/domain.com/intermediate.crt
SSLCACertificateFile /home/ubuntu/domain.com/intermediate.crt
<FilesMatch “\.(cgi|shtml|phtml|php)$”>
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch “MSIE [2–6]” \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch “MSIE [17–9]” ssl-unclean-shutdown
</VirtualHost>
</IfModule>