Articles of apache 2.4

Ubuntu 14.04上的Apache 2.4将默认网页显示为源代码

尝试在Ubuntu 14.04服务器上设置Apache 2.4。 我已经启用了默认的000-default.conf站点configuration以及默认的apache2.conf 。 当我访问服务器时,将显示默认页面/var/www/html/index.html的源代码,而不是其HTML显示。 search这个问题给PHP问题的结果和如何更改默认文件的问题,所以我一直无法find帮助,肯定是一个简单的问题。 我究竟做错了什么? 编辑:如果我编辑apache2.conf读取 ForceType text/html 代替 ForceType text/plain 那么对server.com/index.html的请求确实呈现为HTML(它不在ForceType text/plain )。 但是,对于server.com的请求将继续返回index.html的源代码。 由于ForceType text/plain是默认值,所以必须有不同的问题,但这个事实可能有助于排除故障。

Apache与mod_proxy和磅/故障转移

我正在使用loadbalance和failover来运行Apache( mod_proxy/mod_proxy_balancer )的一些testing,但是现在我在loadbalance(tomcat)成员在Windows环境中时遇到问题。 例: Apache – Ubuntu | | / \ Tomcat Tomcat Windows Ubuntu 设置: <Proxy balancer://lb_lab> #linux BalancerMember http://192.168.0.10:8012 #windows BalancerMember http://192.168.0.20:8080 </Proxy> <Location /test> Allow From All ProxyPass balancer://lb_lab/test ProxyPassReverse balancer://lb_lab/test </Location> testing用例: 我正在运行两个Tomcat,如果我closuresWindows Tomcat,Apache不会识别它是脱机的。 否则,通过closuresTomcat Ubuntu,Apache通常会认识到它处于脱机状态并执行故障转移。 仅当Windows防火墙处于活动状态时,才会出现此行为,但是即使执行端口/服务发行版也不起作用。 到目前为止,我所能诊断的是,在防火墙打开的情况下,Apache发送一个SYNC标志并且不会收到任何回应。 在防火墙closures的情况下,Apache发送SYNC标志并接收一个RESET标志作为返回。 对不起,我的英语,如果你不明白,我改善这个问题,评论。

DEBIAN – Nginx和Apache反向代理丢失HTTPS状态?

我在configurationDebian 8机器上的nginx和apache时遇到了一个问题。 我使用nginx的反向代理,它被设置为在HTTPS上运行(它的工作原理就像一个魅力)。 但是,当请求被发送到Apache,$ _SERVER ['HTTPS']是空的,虽然它应该是“开”(无论如何,这就是我想实现)? 这是我的Apacheconfiguration: <VirtualHost 127.0.0.1:8080> ServerName shop.mywebsite.com ServerAdmin webmaster@localhost DocumentRoot /var/www_shop ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined LogLevel debug <Directory "/"> Require all granted </Directory> </VirtualHost> 下面是我的nginx congif,部分代理密码: location ~ \.php { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Original-Request $request_uri; add_header Front-End-Https on; proxy_pass http://127.0.0.1:8080; […]

apache2将httpredirect到httpsstream浪箱中

我试图实现apache2 httpredirect到httpsstream浪。 下面是我的Vagrantfile和bootstrap.sh脚本。 在无家可归的情况下,我无法弄清楚我在这里做错了什么。 我正在使用Ubuntu 16.04stream浪汉形象。 VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu/xenial64" config.vm.hostname = "suffire" config.vm.network :forwarded_port, guest: 80, host: 8080, protocol: "tcp" config.vm.network :forwarded_port, guest: 443, host: 8443, protocol: "tcp" config.vm.network :private_network, ip: "10.0.1.10" config.vm.provision :shell, path: "bootstrap.sh" end Bootstrap脚本如下。 #!/usr/bin/env bash # ————————————— # Virtual Machine Setup # ————————————— # […]

从URL中删除特定的string和查询string

似乎有些人创build链接到我的url与额外的参数,所以谷歌网站pipe理员工具给我服务器错误500 (我甚至不明白为什么谷歌送我服务器错误,因为链接是从外部网站,而不是我的服务器)。 例如: 这是我的url www.example.com/my-post/ 有人用附加的index.php和查询string/index.php?id=123中的随机数字链接到我的文章 并成为www.example.com/my-post//index.php?id=123 (注意额外的斜线)。 在Google网站pipe理员工具中,有太多的抓取错误,例如: www.example.com/my-post//index.php?id=123 www.example.com/my-other-post//index.php?id=1234 www.example.com/my-post-2//index.php?id=12345 问题:如何删除/index.php?id=<random_numbers>并redirect到我的原始发布url,例如www.example.com/<random-posts>/ ? 我试过了 RewriteEngine On RewriteCond %{QUERY_STRING} \bid=(.*) [NC] RewriteRule ^ %{REQUEST_URI}? [L,R] 和 RewriteCond %{QUERY_STRING} ^id=\d+$ [NC] RewriteRule ^ %{REQUEST_URI}? [L,R] 和 RewriteCond %{QUERY_STRING} id RewriteCond %{REQUEST_URI} /index.php RewriteRule ^ %{REQUEST_URI}? [L,R]

使用正确的密码在apache中获取authentication错误

我今天来,因为我得到一个有趣的错误,即使它应该是基本的。 [Fri Sep 08 15:20:03.551343 2017] [auth_basic:error] [pid 28263:tid 140305491785472] [client 192.168.1.107:49808] AH01617: user mac: authentication failure for "/server/php/index.php": Password Mismatch, referer: http://share.xxx.net/jquery-ui.html [Fri Sep 08 15:20:03.733753 2017] [auth_basic:error] [pid 28263:tid 140305470805760] [client 192.168.1.107:49808] AH01617: user mac: authentication failure for "/server/php/index.php": Password Mismatch, referer: http://share.xxx.net/jquery-ui.html [Fri Sep 08 15:20:03.899829 2017] [auth_basic:error] [pid 28263:tid 140305449826048] [client […]

用Apache + PHP-FPM(SetHandler)返回一个自定义的500

我的Drupal 8网站托pipe在Apache 2.4 + PHP-FPM上(请参阅下面的configuration)。 Drupal自己pipe理404错误(一切都redirect到/index.php?q=),但是我想返回一个自定义页面,当一个严重的错误发生在PHP代码(错误500)。 由于它是一个PHP-FPM,如果没有“ProxyErrorOverride On”,“ErrorDocument 500”就无法正常工作,如果没有它,那么从“”proxy:fcgi“到Apache的所有内容都可以正常转发给用户。 但是,如果我启用ProxyErrorOverride ,所有的错误现在被Apache 抓住 ,我不能使用Drupal 404,我留下了静态的“ErrorDocument 404”。 有没有办法只设置一个自定义的500页面,而不要触及其余的apache行为? <FilesMatch \.php$> SetHandler "proxy:fcgi://127.0.0.1:58243" # Catch backend errors ProxyErrorOverride On # Return a custom error ErrorDocument 500 "==== 500 =====" # I want this one to be ignored and be process by PHP-FPM #ErrorDocument 404 /404.html </FilesMatch>

为什么不是<IfModule mod_version.c>在Apache中工作?

Bugzilla上游提供了一个.htaccess文件,其中包含Apacheconfiguration的这个片段: # Don't allow people to retrieve non-cgi executable files or our private data <FilesMatch (\.pm|\.pl|\.tmpl|localconfig.*)$> <IfModule mod_version.c> <IfVersion < 2.4> Deny from all </IfVersion> <IfVersion >= 2.4> Require all denied </IfVersion> </IfModule> <IfModule !mod_version.c> Deny from all </IfModule> </FilesMatch> 我正在运行Apache 2.4; 但是,每当访问Bugzilla主页时,我都会收到关于Deny 500个错误。 结果是Apache从<IfModule !mod_version.c>块内部Deny from all获得Deny from all ,并将其更改为Require all denied修复错误。 其他<IfModule>块例如mod_rewrite工作正常。 Apache为什么这样做? […]

无法让php7在apache2上工作

这个问题也存在SFO,但是我build议在这里问一下,因为这更多的是服务器configuration问题。 我有一个主要问题。 我的apache2不处理php7代码,而是直接在浏览器(chrome)或空白页(firefox)中显示代码 许多人有类似的问题,但显然设法解决这个问题。 ( 白屏 – Ubuntu 16.04上的PHP 7无法渲染脚本 ) 我跟随了很多关于如何使它无效的线索。 此外,我强迫我的网站只能在https上工作,如果这可能是一个问题。 信息: Ubuntu发行版:Ubuntu 16.04.3 LTS 阿帕奇: apache2 -v 服务器版本: Apache / 2.4.18(Ubuntu) 服务器内置: 2017-07-27T14:34:01 PHP的: $ php -v PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright […]

Apache 2.4和PHP-FPM超时导致我无法find的东西

所以我正在寻找我使用PHP-FPM在Apache 2.4服务器上持续超时的原因。 这是错误: [proxy_fcgi:error] [pid ###] (70007)The timeout specified has expired:[client XXXXXXXX] AH01075 : Error dispatching request to:, referer: http://address 在下面的configuration文件中,我已经玩过每一个我显示的超时。 我在fpm有两个池: [www] ;user and group info and listening ip and such up here access_log = /path/to/access.log request_terminate_timeout = 15 php_admin_value[error_log] = /path/to/error.log php_admin_flag[log_errors] = on 第二个: [app] ;user and group info and listening ip […]