Articles of apache 2.4

Apache 2.4 – 403 HTTP状态码

在Debiantesting中,我得到了一个403错误信息。 Apache版本: # aptitude show apache2 | grep -i version Version: 2.4.9-1 # ls -la /home/ total 28 drwxr-xr-x 4 root root 4096 Apr 3 13:19 . drwxr-xr-x 23 root root 4096 Apr 4 07:28 .. drwx—— 2 root root 16384 Apr 3 13:13 lost+found drwx–x–x 36 username username 4096 Apr 7 13:30 username # […]

如何在php-fpm www.conf中有条件地设置php会话cookie?

我需要使用php-fpmconfigurationdynamic设置PHP会话cookie域,伪代码如下所示: <If "%{HTTP_HOST} !~ /[0-9]/"> php_value[session.cookie_domain] = ".mysite.com" </If> <If>指令在Apacheconfiguration中工作。 但是,我需要这个在www.conf ,它看起来像一个php.ini文件。 怎么做?

Sendmail:DSN:服务不可用

我一直有麻烦让我的服务器发送电子邮件,我没有为我的生活找出如何解决它。 如果有人能给我一些简单的指针,那将非常感激! May 19 15:36:03 ubuntu-12 sm-mta[2484]: s4JFa3jp002484: from=<[email protected] production>, size=412, class=0, nrcpts=1, msgid=<[email protected] production>, proto=ESMTP, daemon=MTA-v4, relay=ip6-localhost [127.0.0.1] May 19 15:36:03 ubuntu-12 sendmail[2483]: s4JFZw4c002483: [email protected], ctladdr=www-data (33/33), delay=00:00:05, xdelay=00:00:05, mailer=relay, pri=30123, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s4JFa3jp002484 Message accepted for delivery) May 19 15:36:03 ubuntu-12 sm-mta[2487]: s4JFa3jp002484: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120412, relay=mailserver.mycompany.com. […]

破解之后获取旧网站(甚至使用wget) – 不涉及代理

我们的服务器被黑了,几个页面被replace。 我们设法清理一切。 目前,如果您从任何地方使用任何浏览器访问网站,该网站显示正确和干净。 只有在一个特定的大学networking中,每台电脑(任何浏览器)都会不断显示被黑网站。 我们尝试了很多东西,非常尴尬: 没有涉及代理(与whatismyproxy.com检查透明代理) 如果您将服务器上的网站从index.php重命名为index2.php,则该文件将正确显示。 在浏览器上刷新页面将始终作为具有正确答案200的请求出现在apache日志中,但是由于在浏览器中旧页面将显示,所以在某处被截取。 我们甚至尝试使用wget,结果相同,旧的页面被下载。 我们不知道在哪里再看。 我们怎么能发现旧的页面caching? 非常感谢。

如何避免漏洞扫描程序通常导致的日志文件未find?

我的apache日志里充满了'admin.php' not found or unable to stat通过漏洞扫描程序来wp-login.php , default.php等类似的语句。 我可以configurationApache以避免logging某些文件的这些语句? 我不想过滤掉所有未find的文件,因为我想修复多年来可能已经放弃的不再对应相同文件的错误链接。 我可以使用像fail2ban或denyhosts这样的工具,但是从以前的经验来看 ,它来自很多地方,这些错误仍然会堆积如山,减less这些错误信息就是这个问题的要求。

Ubuntu的Apache2服务器不允许CORS或读取.htaccess

我有几个问题,第一个是我的apache2服务器不读取.htaccess 我有像这样的apache2.conf安装程序: # 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"> Order allow,deny Deny from all </FilesMatch> […]

mod_rewrite神秘地追加子文件夹重写URL

编辑:[解决]最后在文档中find解决scheme; 张贴了一个答案。 简而言之: DPI标志。 编辑:在底部,增加了一个简单的方法来重现在线问题。 我花了几个小时debugging一些重写。 一切都很好,只有一种行为让我感到困惑。 不知何故,当一个URL有两个或更多的子目录时,mod_rewrite自动将所有的子目录(除了第一个)附加到重写的url。 这是我可以减less的最简单的例子。 这是在DOCUMENT_ROOT的htaccess。 url: http://localhost/stripthis/stripthat RewriteRule ^ RewriteWasHere_ 输出: RewriteWasHere_/stripthat 那条stripthat从哪里来的? 上游有一些select可能导致这种情况吗 我试图用各种规则剥离子文件夹。 例如: url: http://localhost/stripthis/stripthat RewriteRule ^/?([^/]+) RewriteWasHere_$1 输出: RewriteWasHere_stripthis/stripthat 奇怪的是,这发生在本地xampp x Apache 2.4.7和远程CentOS x Apache 2.2上。 我一直在通过将它们输出到脚本来检查重写的URL,但是这里有一个方法来在线重现这个问题。 如何重现此在线 去这个在线htaccesstesting 对于该url,请inputhttp://example.com/a/123/b 对于规则,粘贴这个: # the `(?!)` negative lookaheads are just to make triple sure # we're not running […]

子域redirect到HTTPS,尽pipe缺less重写规则

我在staging.example.com上有一个域,我想在没有HTTPS的情况下运行它来进行testing。 主域(example.com)确实使用SSL。 我试图find一个重写规则,将转发到主域的HTTPS,但不是子域名(除www。)。 目前,我已经通过删除所有可以从我的虚拟主机文件find的重写规则进行了testing,并访问了域和子域。 尽pipe为两个虚拟主机文件再次运行a2ensite并运行sudo服务apache2重新加载和sudo服务apache2重新启动,浏览器仍然被redirect到子域和主域上的HTTPS。 这个redirect可能发生在其他地方吗? 这是我的虚拟主机: <VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com DocumentRoot /srv/www/example.com/public_html/example/example-production/current/public Options Indexes FollowSymLinks Includes ExecCGI <Directory /srv/www/example.com/public_html/example/example-production/current/public> Allow from all Options -MultiViews -Indexes </Directory> ErrorLog /srv/www/example.com/public_html/example/example-production/current/log/error.log CustomLog /srv/www/example.com/public_html/example/example-production/current/log/access.log combined <Location /> </Location> </VirtualHost> <VirtualHost *:443> ServerName example.com ServerAlias www.example.com DocumentRoot /srv/www/example.com/public_html/example/example-production/current/public ErrorLog /srv/www/example.com/public_html/example/example-production/current/log/error.log SSLEngine On SSLCertificateFile /etc/apache2/ssl/certs/example.com.crt SSLCertificateKeyFile […]

如何在不破坏客户端和服务器之间的https隧道的情况下configurationapache反向代理?

我configuration了Apache反向代理。 在该configuration中,可以在客户端到反向代理之间进行https连接,并再次向服务器反向代理。 但我希望HTTPS连接客户端之间的服务器像转发代理。 https连接不应该在反向代理中被破坏。 Https tunnel New Https tunnel <===============> <===================> 客户端———————– Apache反向代理———————– – – -服务器 以上解决scheme是不可取的 。 Https Tunnel <========================================> 客户端——————– Apache反向代理——————–服务器 以上解决scheme是可取的 如果在反向代理中不可能使用端到端的https隧道,那么如何才能确保ssl代理选项是安全的,即使是反向代理pipe理员(如果反向代理被攻陷)也不能解密中间人攻击的隧道或者不能做完了。

通过反向代理时获取客户端IP

在我的VPS我主持几个网站。 每个人都住在自己的Linux Container中。 例如 站点#1 – > 10.0.3.111 网站#2 – > 10.0.3.112 网站#3 – > 10.0.3.113 要知道在哪里redirect每个请求,我在10.0.3.101另一个Linux容器中也有一个反向代理nginx 我遇到的问题是,在运行Laravel的其中一个网站中,我尝试获取客户端的IP,如下所示: <p>IP Address: {{ Request::getClientIp() }}</p> 问题是,我一直在10.0.3.101 ,而不是客户端的IP。 我猜Laravel正在获取请求出现的最后一个主机的IP,而不是最初发起请求的主机的IP。 有没有办法,我可以得到这个知识产权,而不改变这种结构? configuration 这是我的nginx主机文件: server { listen 80; server_name example.com www.example.com; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://10.0.3.115; } }