Articles of apache 2.2

index.php不能由localhost自动读取

我只是在Windows 8中手动安装Apache,PHP和MySQL。它工作正常 但问题是,当我尝试打开浏览器中的目录,它会自动打开index.html而不是index.php 例如:我有以下文件夹结构 htdocs-> folder1->的index.php 如果我访问“本地主机/ folder1 / index.php”它加载罚款,但如果我访问“本地/文件夹1”,那么它会显示该文件夹中的所有文件和文件夹。 有没有反正我可以让本地打开index.php自动打开,并不显示该文件夹内的文件?

如何使用多个IP地址设置多个Apache SSL站点

你如何设置一个Apache2configuration来托pipe多个HTTPS站点,每个站点都有自己的IP地址? 在一个IP地址上也会有多个HTTP站点。 我不想使用这里描述的服务器名称指示(SNI) ,我只关心重要的顶层Apache指令。 也就是说,我只需要知道我的configuration应该看起来的骨架。 基本的设置看起来像这样: Hosted on 1.1.1.1:80 (HTTP) – example.com – example.net – example.org Hosted on 2.2.2.2:443 (HTTPS) – secure.com Hosted on 3.3.3.3:443 (HTTPS) – secure.net Hosted on 4.4.4.4:443 (HTTPS) – secure.org 这里是我迄今为止的重要configuration指令,这是最接近我的工作迭代,但仍然没有骰子。 我知道我很接近,只需要一点点的正确的方向。 Listen 1.1.1.1:80 Listen 2.2.2.2:443 Listen 3.3.3.3:443 Listen 4.4.4.4:443 NameVirtualHost 1.1.1.1:80 NameVirtualHost 2.2.2.2:443 NameVirtualHost 3.3.3.3:443 NameVirtualHost 4.4.4.4:443 # HTTP VIRTUAL […]

确定Apache的执行环境

我有这个错误: [Mon Dec 05 10:22:23 2011] [warn] mod_rewrite: Running external rewrite maps without defining a RewriteLock is DANGEROUS! [Mon Dec 05 10:22:23 2011] [error] (13)Permission denied: mod_rewrite: could not start RewriteMap program /etc/httpd/conf.d/upsell_by_id.py 这个错误是和这行关联的: RewriteMap upsells prg:/etc/httpd/conf.d/upsell_by_id.py 我意识到这可能意味着apache的执行用户不能执行这些文件。 我如何确定apache的执行环境是什么? 如何使这个文件upsell_by_id.py可执行文件到Apache? I get this error when I try to run the upsell_by_id.py as apache: Traceback (most […]

.htaccess 301redirect,相同的服务器

我在mywebsite.net上build立了一个网站,但是最近买了域名mywebsite.com。 现在,我通过网站pipe理员工具更新了Google上的信息,并build议我们将.netredirect到.com。 我已经find了如何通过像这样的代码添加到.htaccess中: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] 我的问题是,两个域指向同一台服务器,所以我是否正确假设这将尝试redirect,即使我最初访问.com? 如果是这样,那么完成这个的正确方法是什么? 这可能没有关系,但是我不想为我的search排名带来任何问题。 提前致谢!

多站点Nginx反向代理路由到Apache

我正在运行一个Ubuntu 10.04 nginx服务器,用一个反向代理到apache(运行munin监视)。 这是我的默认Apache站点文件的摘录: <VirtualHost *:8090> ServerAdmin webmaster@localhost DocumentRoot /var/cache/munin/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> 以及我的example.com nginxconfiguration文件的摘录: location /stats { proxy_pass http://127.0.0.1:8090/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_buffers 32 4k; } 每当我去到example.com/stats,nginx指向apache通过端口8090,和apache提供了munin网站目录。 它工作很好。 但是如果我想添加另一个域名,例如example.org呢? 我会有另一个nginxconfiguration文件,但我怎么会使Apache的DocumentRoot别的东西? 由于请求是通过本地端口8090从nginx进入apache,apache如何确定请求来自哪个站点以及哪个DocumentRoot /configuration与它一起提供? 我假设我将不得不使用nginx( $host;或$proxy_add_x_forwarded_for;variables?)设置在Apache中的标头…

为什么RewriteBase不起作用?

这是我正在做的事情: 域名是thinkingmonkey.me 域名具有127.0.0.1作为IP地址 mod_alias已安装。 我有一个名为directories.conf的conf文件。 其中我有所有有关目录的configuration。 directories.conf包含在httpd.conf 我的directories.conf有 Alias /runs /xhprof/xhprof_html <Directory /mysite/xhprof/xhprof_html> Order allow,deny Allow from all AllowOverride All </Directory> 在/mysite/xhprof/xhprof_html/.htaccess 。 我有以下几点: RewriteEngine on RewriteBase /runs RewriteRule .* index.php 我所要做的就是将/mysite/xhprof/xhprof_html/下的任何请求指向index.php 。 当我请求不带结尾斜线的 thinkingmonkey.me/runs ,我404 not found 。 所以,我推断RewriteBase不起作用。 我究竟做错了什么?

如何使用Apache和Dlink 524Tredirectstream量?

我想redirect所有局域网的httpstream量到我的Apache服务器(这是临时位于我的笔记本电脑)。 基本思想是每个连接到networking并尝试连接到网站的用户将被redirect到我的服务器的index.html (或者…)我可以访问路由器。 我可以用什么方法来实现这个目标?

将KeepAlive设置为1秒而不是一起closures会更好吗?

我听说将keepalive超时设置得太高会降低其值。 所以,为了安全起见,还是从中受益,我可以把它设置为1秒吗? 或者将它设置为1秒等同于将其closures?

inotifywait没有反应

我有一个非常简单的脚本来logging什么时候创build新文件,实际上,为了testing的目的,我告诉它要监视任何事件。 #!/bin/sh WATCHED_DIR="/var/www/html/magento/media/tmp/catalog/product" echo "Watching directory: $WATCHED_DIR for events" inotifywait -m -q -r "$WATCHED_DIR" –format "%|e %w%f" | while read resp do echo "$resp" >> watcher.log done 当我在watch目录中创build一个文件时,它会作出反应并logging下来 CREATE /var/www/html/magento/media/tmp/catalog/product/2/1/new file OPEN /var/www/html/magento/media/tmp/catalog/product/2/1/new file CLOSE_WRITE|CLOSE /var/www/html/magento/media/tmp/catalog/product/2/1/new file OPEN /var/www/html/magento/media/tmp/catalog/product/2/1/new file CLOSE_NOWRITE|CLOSE /var/www/html/magento/media/tmp/catalog/product/2/1/new file OPEN|ISDIR /var/www/html/magento/media/tmp/catalog/product/2/1 OPEN|ISDIR /var/www/html/magento/media/tmp/catalog/product/2/1/ OPEN /var/www/html/magento/media/tmp/catalog/product/2/1/new file CLOSE_NOWRITE|CLOSE /var/www/html/magento/media/tmp/catalog/product/2/1/new file CLOSE_NOWRITE|CLOSE|ISDIR /var/www/html/magento/media/tmp/catalog/product/2/1 […]

即使在本地networking上,Linux / Apache的性能也很慢

我有一个运行Apache和MYSQL的Ubuntu服务器机器。 系统和版本信息如下:Linux kernel 3.0.0.-12 Apache / 2.2.20 MySQL Ver 14.14.Distrib 5.1.58 我正在运行这个服务器上的一些网站,只有一些HTML,一些PHP / MySQL。 问题是响应时间非常缓慢,无论是静态还是dynamic网站。 有时需要10秒钟才能得到响应,这使网站非常缓慢,几乎无法使用。 即使从本地networking请求,也会出现此问题。 我已经将涉及到的子域添加到我的/ etc / hosts文件中,并且解决了所有的问题都不是通过使用IP编号而是使用IP编号解决的。 所以没有DNS查询问题。 我已经通过显示响应时间修改了日志格式,有时一个文件需要12秒钟才能提供,请参阅示例屏幕截图中的jquery〜.js文件。 我对这个非常长的响应时间没有任何解释,但是这里甚至不是唯一的问题,其他一些文件也需要很长时间才能提供,但是在日志文件中不会显示很长的响应时间。 所以这里可能涉及不同的组织。 我找不到解决scheme,直到现在,任何build议? THanx提前,Klaas 链接到来自访问日志文件的截图图片 一些额外的configuration信息: apache2.conf(注释已删除) LockFile ${APACHE_LOCK_DIR}/accept.lock PidFile ${APACHE_PID_FILE} Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5 <IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 </IfModule> […]