当URL是以下任何一个时,从HTTP到HTTPS的redirect都正确发生: http://example.com >> https://example.com [确定] http://www.example.com >> https://example.com [确定] http://www.example.com/login >> https://example.com/login [确定] 但是,如果URL如下所示,redirect到HTTPS将失败 : http://example.com/login >>错误(请参见截图) 请告知如何解决。 代码和configuration如下。 先谢谢你… 其他详情: Ubuntu 16.04 Apache 2.4 mod_rewrite已启用 Laravel 5.3 清除浏览器caching .htaccess文件 <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Allow Blog in Sub-Directory RewriteCond $1 !^(blog) #Redirect to non-WWW RewriteCond %{HTTP_HOST} ^www.example.com$ RewriteRule ^(.*) […]
我使用Let's Encrypt( certonly )为Apache服务器上托pipe的几个网站生成SSL证书。 这些证书的文件位置在创build之前是确定的,所以我提前将他们的path写入到我的虚拟主机configuration中。 一旦网站正在运行,我将使用certbot来获取证书文件,然后重新加载Apacheconfiguration。 我也有一个用有效文件定义的全局SSL证书,所以每个SSL虚拟主机肯定会有一个证书。 我遇到的问题是Apache不会运行没有所有的证书文件,尽pipe有一个全球性的后备。 我试图有条件地configurationLet's Encrypt证书只有当文件存在使用IF ,但Apache说SSLCertificateFile not allowed here 。 只有当新的证书文件存在时,我如何覆盖全局SSLCertificateFile ? 我试图做所有这些,而不必在生成证书之前和之后修改configuration。 这是我试过的: <If "-f '/etc/letsencrypt/live/domain/fullchain.pem'"> SSLCertificateFile /etc/letsencrypt/live/domain/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/domain/privkey.pem </If> → SSLCertificateFile not allowed here
FreeBSD 11中Apache 2.4的000-default.conf在哪里? 看来它在FreeBSD 11中不存在。
我有一个接受来自第三方的HTTP POST的服务器,然后返回一个200或500。 第三方不受我控制,有时会发送非常大的POST,例如40MB。 这些POST导致我的PHP代码耗尽内存,我无法赶上,所以Apache发送500。 API重试该POST永远,并不会发送新的数据,所以这是一个问题。 我已经尝试了各种各样的东西,但是最终以为如果我可以让.htaccess返回一个200,并且什么都不做,如果content_length> X,那么这至less会让我花时间去重构它的工作原理。 所以… 是否有可能在.htaccess中编写规则,如果content_length> X,则返回200?
我正在尝试build立一个Nginx + Apache与PHP模块configuration。 它使用这样的configuration在Debian 6上工作: <VirtualHost 127.0.0.1:9002 > ServerName mysite.com AddDefaultCharset UTF-8 AssignUserID username username CustomLog /var/www/httpd-logs/mysite.com.access.log combined DocumentRoot /var/www/username/data/www/mysite.com ErrorLog /var/www/httpd-logs/mysite.com.error.log AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml AddType application/x-httpd-php-source .phps php_admin_value open_basedir "/var/www/username/data:." php_admin_value upload_tmp_dir "/var/www/username/data/mod-tmp" php_admin_value session.save_path "/var/www/username/data/mod-tmp" </VirtualHost> NameVirtualHost 127.0.0.1:9002 <Directory /var/www/username/data/www/mysite.com> Options -ExecCGI -Includes php_admin_value open_basedir "/var/www/username/data:." php_admin_flag engine on […]
我知道第一行,这是显而易见的,对于第二行,我认为它只允许这些less数扩展名,第三行我假设禁止任何其他文件types。 我不知道,如果我的假设是正确的,如果给定的htaccess文件是禁止上传不需要的其他文件types,如PHP或ZIP,或EXE … RewriteEngine on RewriteCond %{REQUEST_FILENAME} !(\.jpg|\.jpeg|\.pdf|\.png) RewriteRule ^(.*)$ – [F]
扫描其中一个域时,我已经为ssllabs.com安装了SSL,证书#1正确validation了等级“A”,尽pipe在结果页面上还有一个证书#2,似乎是从第一个由于某种原因,configuration了apacheconfiguration的SSL证书的域,当然由于域与证书不匹配,当然会给出“MISMATCH”。 想知道是否有人可以指出什么是错误的configuration。 目前我正在设置每个托pipe给ssl的域名(域名已更改): <Directory /home/info/> Options -Indexes +FollowSymLinks -Multiviews AllowOverride All Order allow,deny allow from all Require all granted </Directory> <VirtualHost _default_:443> DocumentRoot /home/info/pub/ ServerName domain.at ServerAlias domain.at www.domain.at SSLEngine on SSLCertificateFile /home/info/ssl/at.crt SSLCertificateKeyFile /home/info/ssl/at.key SSLCertificateChainFile /home/info/ssl/at.ca </VirtualHost> <VirtualHost _default_:443> DocumentRoot /home/info/pub/ ServerName domain.dk ServerAlias domain.dk www.domain.dk SSLEngine on SSLCertificateFile /home/info/ssl/dk.crt SSLCertificateKeyFile /home/info/ssl/dk.key SSLCertificateChainFile /home/info/ssl/dk.ca […]
我需要mod_rewrite重新映射传入的URL,以便它被AliasMatch捕获。 RewriteCond %{REQUEST_URI} ^/app/(.*)$ RewriteRule ^/app/(.*) ^/dev-dave/app/$1 RewriteCond %{REQUEST_URI} ^/static/(.*)$ RewriteRule ^/static/(.*) ^/dev-dave/static/$1 AliasMatch ^/(.*)/static/(.*)$ /var/www/html/cosmos/$1/dist/static/$2 AliasMatch ^/(.*)/app/(.*)$ /var/www/html/cosmos/$1/dist/index.html <Directory /var/www/html/cosmos> AllowOverride None Require all granted <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d </IfModule> </Directory> 这可能吗? 我无法得到这个工作。
我已经得到了Apache 2.4.6和OpenSSL的RHEL7服务器,我想安装mod_ssl。 问题是百胜没有find包: yum install mod_ssl No package mod_ssl available. Error: Nothing to do 在search过程中也找不到,只findmod_gnutls: yum search mod_ssl =================================================== Matched: mod_ssl =================================================== mod_gnutls.x86_64 : GnuTLS module for the Apache HTTP server 我怎样才能安装mod_ssl? 我需要find一个rpm或安装回购有百胜find它? 下面是列出httpd和openssl的输出以显示版本: yum list httpd openssl Installed Packages httpd.x86_64 2.4.6-67 @rhel-7-server-rpms openssl.x86_64 1:1.0.2k-8.el7 @rhel-7-server-rpms 这是我的repolist: yum repolist repo id repo name status epel/x86_64 […]
我有一个在以下规则的子域的htaccess: RewriteEngine On RewriteBase / RewriteRule ^feed([0-9]+)$ ../image.php?id=$1 [L] 所以基本上我想redirect请求从位于子域的饲料到位于主域(只是一个目录上面)的image.php文件。 使用../似乎不像PHP中的工作。 那么我怎么能重写到父目录中的文件?