Articles of apache 2.4

提高Apache后面的Plone站点性能的最佳实践

我有一小部分在Apache 2.4服务器的虚拟主机上运行的Plone站点。 我有强烈的感觉,performance可能会好得多。 我们假设一个Plone站点的基本设置: <VirtualHost *:80> ServerAdmin [email protected] ServerName www.example.com CustomLog /var/log/httpd/vhost-example.log combined ErrorLog /var/log/httpd/vhost-example.error.log RewriteEngine on DocumentRoot /opt/zope/instances/example/htdocs ErrorDocument 502 /error-500.html ErrorDocument 503 /error-500.html RewriteEngine On RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:80/example/VirtualHostRoot/$1 [L,P] </VirtualHost> 在这个设置中,几乎所有事情都由Zope服务器完成,监听端口8080 ,在虚拟文件夹/example (位于对象数据库)中运行Plone站点。 现在,这个服务器提供了一些静态资源,例如图片和样式表(它们存在于文件系统中)以及一些伪静态资源,比如带有时间戳名称(没有文件系统位置)的脚本或样式表的编译。 一些静态资源的path给出了物理资源所在browsername的提示(例如/++resource++browsername/name-of-script.js ,其中browsername是提示)。 其他的是从所谓的皮肤(即从包含它们的第一皮肤)中取出的,没有简单的方法从皮肤名称(从反应中不会知道这个信息)知道文件系统的位置。 这样的请求不需要由底层的Zope服务器使用其中一个线程来处理。 什么是推荐的策略,以避免Zope的Apache可以做自己(更有效率,而不阻止Zope的线程),并caching内容? 所以,一个完整的解决scheme可能包括 在可能的情况下将静态资源的不同path映射到已知的文件系统位置 尝试从皮肤中获取静态资源的几个位置 生成资源的caching(例如,HTML页面,或CSS或Javascript的编译) 而且,通过ZEO设置, 负载均衡(将请求分发给多个ZEO客户端,然后与ZEO服务器交谈) 任何configuration指南都可以

在CentOS 7 Apache 2上使用HTTPS Index.html而不是ProxyPass反向代理站点时

目标是外部用户可以通过HTTPS进行连接,通过Apache的基本身份validation,然后查看代理tomcat站点。 我已经build立了一个反向代理到一个运行在不同端口上的同一台机器上的tomcat服务器,使用基本authentication:(/etc/httpd/conf.d/vhost.conf) NameVirtualHost *:80 <VirtualHost *:80> ServerName sub.domainx.co.uk ErrorLog "/var/log/proxy/domainx_prox_error_log" CustomLog "/var/log/proxy/domainx_prox_access_log" common ProxyRequests Off <Proxy *> Order deny,allow Deny from all Allow from all </Proxy> <Location /> AuthType Basic AuthName "Proxy Auth" AuthUserFile /var/www/syzygy-auth/CONFLUENCE/.htpasswd Require user ukuser Satisfy any Deny from all Allow from 192.168.0.0/21 </Location> ProxyPass / http://sub.domainx.co.uk:8090/ ProxyPassReverse / http://sub.domainx.co.uk:8090/ </VirtualHost> 以上工作正常。 […]

在目录上下文中启用apache用户目录中的基本authentication,而不是.htaccess文件

我在我的Ubuntu服务器上启用了Apache用户目录。 用户现在可以通过访问http://example.com/~username从浏览器加载他们的/home/username/public_html目录。 我试图密码保护这些目录。 我能够使用.htaccess文件正常工作,但我更愿意从Directory目录启用身份validation。 这是我的用户目录模块的configuration文件,位于/etc/apache2/mods-enabled/userdir.conf : <IfModule mod_userdir.c> UserDir public_html UserDir disabled root <Directory /home/*/public_html> AuthType Basic AuthName Private Authuserfile /etc/apache2/.htpasswd Require valid-user Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Require all granted </Limit> <LimitExcept GET POST OPTIONS> Require all denied </LimitExcept> </Directory> </IfModule> 当我将浏览器导航到其中一个用户目录时,它甚至不会提示我input凭据。 当我切换回.htaccess方法,它正常工作。 每次对用户目录configuration文件进行更改后,我都重新加载了apache。 为什么不从目录上下文authentication工作?

如何为所有非错误的Apache响应设置默认的内容types?

我希望所有的apache非错误响应与内容types的'application/json; charset=UTF-8' 'application/json; charset=UTF-8' 。 我如何做到这一点? 我试过添加: <VirtualHost *:80> AddType 'application/json; charset=UTF-8' </VirtualHost> 但是这需要指定文件扩展名,我不想绑定到文件扩展名,因为我没有请求特定的文件,但像这样的资源: http://my.domain.com/rest/articles/ 我也试过DefaultType指令: <VirtualHost *:80> DefaultType 'application/json; charset=UTF-8' </VirtualHost> 但这似乎并没有工作 – Content-Type:text/html; charset=utf-8 Content-Type:text/html; charset=utf-8被返回。 我错过了什么吗?

如何强制一个http webapp所以使用https(ssl)?

在我们的Linux服务器上,我们得到了一些sorting或Web应用程序使用http ONLY运行自己的小型networking服务器。 这意味着它本身不支持ssl。 所以即时通讯寻找一种方法来在这个小的Web服务器/ WebApp的前面打包“东西”,所以它正在对用户(必需)说HTTPS,并保持在本地(服务器内部)与WebApp交谈。 我试图find这样的事情。 但事实上,我发现很多东西涵盖了Apache,SSL和反向代理并没有真正清除事情。 我比以前更困惑了。 需要一些提示,关键字或configuration的例子来实现这一点。 谢谢

如何在Apache中find不必要的加载模块?

我试图找出我真正需要运行Magento的Apache模块。 有没有一种简单的方法来找出我需要哪些模块,所有这些加载模块? 服务器正在使用以下模块(据我所知): rewrites deflate log header ssl auth vhost expires mime dir alias 现在我们已经加载了所有这些: core_module (static) so_module (static) http_module (static) mpm_prefork_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) socache_shmcb_module (shared) buffer_module (shared) reqtimeout_module (shared) ext_filter_module (shared) request_module (shared) include_module (shared) filter_module (shared) substitute_module (shared) […]

高CPU +内存,没有访问者

目前这是我运行顶部时得到的 Tasks: 151 total, 2 running, 149 sleeping, 0 stopped, 0 zombie Cpu(s): 74.1%us, 1.3%sy, 0.0%ni, 43.6%id, 0.0%wa, 0.0%hi, 0.3%si, 3.6%st Mem: 4045608k total, 3447088k used, 598520k free, 13588k buffers Swap: 131068k total, 0k used, 131068k free, 387916k cached 3569 www-data 20 0 349m 72m 14m S 14 1.8 1:49.47 apache2 3572 www-data 20 0 […]

重写拒绝工作

我想重写这个url: http://cyanogenupdatetracker.com/api/v1/show_devices.php 到http://cyanogenupdatetracker.com/api/v1/devices 我用这个.htaccess文件 Options +FollowSymlinks RewriteEngine on RewriteRule ^devices$ devices/ RewriteRule ^devices/$ /var/www/api/v1/show_devices.php 它总是返回一个404错误,即使我知道,并且100%确定PHP文件存在于给定的位置。 我尝试了一切(PHP文件,自定义虚拟主机,重写基地之前没有path),但没有任何工作。 这个目录的apacheconfiguration如下: Alias /api /var/www/api <Directory /var/www/api> Options FollowSymLinks DirectoryIndex index.php AllowOverride All </Directory> 我完全完成了这一点。 这似乎很简单(只有几个PHP文件),为什么它很难,只是为了简化url,使他们更好。 我究竟做错了什么?????

SSL故障,Apache将无法启动

按照这些说明从Comodo安装SSL证书后,我发现apache将不再启动。 这是我的configuration: <VirtualHost *:80> ServerName latimer.io ServerAlias *.latimer.io ServerAdmin webmaster@localhost DocumentRoot /var/www/latimer.io/html # RewriteEngine On # RewriteCond %{HTTPS} off # RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </VirtualHost> <VirtualHost *:443> ServerName latimer.io ServerAlias *.latimer.io ServerAdmin webmaster@localhost DocumentRoot /var/www/latimer.io/html SSLEngine On SSLCertificateKeyFile /etc/ssl/server.key.secure SSLCertificateFile /etc/ssl/latimer_io.crt SSLCertificateChainFile /etc/ssl/latimer_io.ca-bundle ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> Apache错误日志给出以下(不是很有帮助的)错误: [ssl:emerg] [pid 30910] AH02240: Server should […]

Apache(httpd)VirtualHost RewriteCondvariables不起作用

我试图做一个dynamic的虚拟主机条目的目的是redirect到.mydomain.com所有stream量到/ var / www / html /这部分工作,但我也是一个重写条件,检查如果目录存在,如果不那么我想将所有stream量redirect到根/var/www/html/index.php。 这部分是不工作的,因为在我的testing期间,我注意到,没有重写variables工作,他们是空白的,我不明白为什么这里是我的虚拟主机configuration # get the server name from the Host: header UseCanonicalName Off # this log format can be split per-virtual-host based on the first field # LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon CustomLog logs/access_log […]