我正在使用Intranet系统,该系统在每个页面上检查用户的cookie,验证他们是否可以根据数据库权限查看当前页面,并记录包含其id和页面URL的页面匹配.
我只是注意到在pagehits表中,我看到每个合法页面命中后一秒钟404.php(我在Apache配置中指定的自定义404页面)的条目.
这可能是我的错,还是与Apache决定如何加载404页面有关?
我正在使用Apache 2.2.14(Win32)和PHP 5.3.2.
我正在开发一个拥有HTML5视频的网站.看起来当ogg文件与其他mime类型一起提供时,视频/ ogg firefox翻转.我已经更新了mamp/apache/config文件夹中的mime.types文件,并多次重启MAMP服务器,但ogg文件仍然使用普通/文本上下文类型.
有人可以指出我需要做什么吗?
UPDATE
我能够改变的MIME类型的唯一情况是,如果我改变DefaultType text/plain到DefaultType video/ogg这是愚蠢的.
大家好,
现在我想使用apache2中的mod_rewrite模块来重定向url。
重写规则如下所示:
RewriteCond %{QUERY_STRING} ^url=(.+)$
RewriteRule ^/redir$ %1 [R=301,L]
Run Code Online (Sandbox Code Playgroud)
但是,当输入 http://website.com/redir?url=http%3A%2F%2Fwww.google.com 时,mod_rewrite 模块无法取消 url 参数 http%3A%2F%2Fwww.google.com,为有什么方法可以解决这个问题吗?
可能的重复:
我的网络主机正在添加 ?PHPSESSID=fgh2h45... 到 URL 的末尾
我如何在 Symfony2 中删除 PHPSESSID
我用 Symfony 2 开发了我的网站,所以我尝试从 URL 中删除 PHPSESSID,然后在 /web/.htaccess 中放入以下代码:
SetEnv SHORT_OPEN_TAGS 0
SetEnv REGISTER_GLOBALS 0
SetEnv MAGIC_QUOTES 0
SetEnv SESSION_AUTOSTART 0
SetEnv ZEND_OPTIMIZER 1
SetEnv PHP_VER 5_4
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
#remove PHPSESSID
RewriteCond %{QUERY_STRING} PHPSESSID=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
然后我备注上面的代码禁用了 PHPSESSID,但它产生了另一个问题,我的网站的所有 URL 中都出现了 app.php:
www.mysite.com/app.php/.....
Run Code Online (Sandbox Code Playgroud)
所以我不知道我能做什么,我想我遇到了新问题,因为我使用了多个 RewriteRule。
我在本地运行我的登台服务器使用:
RAILS_ENV=staging rails console -p 1337
Run Code Online (Sandbox Code Playgroud)
我有预编译资产,一切正常,但我无法找到如何提供这些资产.我在staging.rb中有这个:
config.serve_static_assets = false
Run Code Online (Sandbox Code Playgroud)
在我的apache vhost中,如果我在80上听,我可以访问我的资产:
http://domain.local/assets/application.css
Run Code Online (Sandbox Code Playgroud)
但是,如果我在1337上听,与我的rails服务器相同的端口,那么rails会吐出404.我的困惑是,我已经告诉rails不要发送给serve_static_assets,那么为什么要尝试为它们服务呢?
http://domain.local:1337/assets/application.css
Run Code Online (Sandbox Code Playgroud)
我肯定错过了什么.该网站显示正常,只返回所有资产404:
ActionController::RoutingError (No route matches [GET] "/assets/application-791b26264f9bbe462a28d08cf9a79582.css"):
Run Code Online (Sandbox Code Playgroud) 我试图根据IF条件发送http 404状态代码.但是,在客户端我看到http 500错误.在我的apach2错误日志中,我看到格式错误的标题.看了很多次我的代码,我无法弄清楚出了什么问题!任何人都可以建议我如何向客户发送404消息?
以下是我的perl代码:
#!/usr/bin/perl
use CGI qw(:standard);
use strict;
use warnings;
use Carp;
use File::Copy qw( copy );
use File::Spec::Functions qw( catfile );
use POSIX qw(strftime);
use Time::Local;
use HTTP::Status qw(:constants :is status_message);
use Digest::MD5 qw(md5 md5_hex md5_base64);
use File::Basename;
use URI;
my $extfile = '/home/suresh/clientrequest.txt';
open(FH, ">>$extfile") or die "Cannot open file";
my $query = CGI->new;
my $stcode = status_message(200);
my $uri =$ENV{'REQUEST_URI'};
my $rdate =strftime("%a, %d %b %Y %H:%M:%S %Z", localtime());
print FH "Got Following Headers:\n";
print …Run Code Online (Sandbox Code Playgroud) 我正在编写一组 svn 钩子来允许远程管理 SVN 存储库,就像 gitolite 对 GIT 所做的那样。
我创建了为我拥有的每个存储库生成 AuthzSVNAccessFile 的脚本,现在我需要告诉 Apache 根据存储库查找它们中的每一个。
我不能为每个存储库都有一个 apache 配置文件,因为它需要重新启动 apache 服务器。
我知道我可以使用单个 AuthzSVNAccessFile 来管理多个存储库,但是构建文件的脚本需要时间(需要发现存储库中每个目录的完整路径),并且会使提交花费太长时间。
我尝试使用mod_rewrite,但没有用,可能是我用错了。
基本上我需要在我的 apache 配置文件中有一个规则,根据请求的 URL 读取不同的文件,这可能吗?如何?
或者我需要一个能够重写文件块的脚本。我sed用来替换模板中的字符串,但不知道如何使用它来替换多行。
谢谢你的时间
我已将我的操作系统从12.04更新到ubuntu 14.04,当我尝试重新加载我的Symfony2项目时,我收到此错误:
You don't have permission to access /app_dev.php/ on this server.
Run Code Online (Sandbox Code Playgroud)
这是我的apache2文件:
<VirtualHost *:80>
ServerName s**a
ServerAlias d**n
# Indexes + Directory Root.
DirectoryIndex index.html index.php
DocumentRoot /home/****/
<Directory />
Options -Indexes +FollowSymLinks
Require all granted
</Directory>
<DirectoryMatch .*\.svn/.*>
Deny From All
</DirectoryMatch>
# Logfiles
</VirtualHost>
PS : it works well before the update !
Run Code Online (Sandbox Code Playgroud) 执行此操作时出现此错误:
amontoya@ubuntu:~/pruebas$ sudo a2ensite default-ssl
ERROR: Site default-ssl not properly enabled: /etc/apache2/sites-enabled/default-ssl.conf is a real file, not touching it
Run Code Online (Sandbox Code Playgroud)
这是我的default-ssl.conf文件:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled …Run Code Online (Sandbox Code Playgroud) 我刚刚完成了 Logstash、Elasticsearch、Kibana 和 Filebeat 的安装和配置。在 Kibana 接收我的 Logstash 数据遇到很多麻烦之后,我决定停止 Logstash 并切换到 Filebeat。现在,我设法在 Kibana 的 Discover 部分获取了我的 Filebeat 数据,但是在打开任何默认仪表板时,我收到“未找到结果”消息。我希望你们中的一个人能够帮助我。
亲切的问候,蒂斯
Filebeat 配置
#=========================== Filebeat inputs =============================
filebeat.inputs:
# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.
- type: log
# Change to true to enable this input configuration. enabled: true
# Paths that should be crawled and fetched. …Run Code Online (Sandbox Code Playgroud)