标签: apache2

Apache RewriteRule标志错误

我遇到以下代码问题:

Options FollowSymLinks
RewriteEngine on
RewriteRule ^thing/([^/]+)/?$  index.php?t=$1 [B]
Run Code Online (Sandbox Code Playgroud)

我收到"500内部服务器错误"

错误日志说:

RewriteRule: unknown flag 'B'
Run Code Online (Sandbox Code Playgroud)

我检查了我的Apache版本:

[root@server ~]# httpd -v
Server version: Apache/2.2.3
Server built:   Jan 21 2009 22:00:55
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

(注意:页面加载没有[B]标志)

mod-rewrite apache2

2
推荐指数
1
解决办法
3194
查看次数

找不到软件包libapache2-mod-wsgi

我已经在Django中开发了一个网站,现在它必须投入生产。我想用mod_wsgi和apache2做。不幸的是,在运行下一个命令时,出现错误“找不到软件包libapache2-mod-wsgi”:

sudo apt-get install libapache2-mod-wsgi
Run Code Online (Sandbox Code Playgroud)

我在ubuntu服务器kermic(9.10)上使用apache2。

我还将输入我的sources.list:

deb http://archive.ubuntu.com/ubuntu karmic main
deb http://security.ubuntu.com/ubuntu karmic-security main
Run Code Online (Sandbox Code Playgroud)

有人知道是什么问题吗?

django apt mod-wsgi apache2

2
推荐指数
3
解决办法
5170
查看次数

关于nginx对Apache2的内存占用量减少了多少?

我想知道如果从Apache2 + Passenger到Nginx + Passenger移植Rails应用程序是值得的.我们这样做的主要原因是释放RAM或处理给定数量RAM的更多请求.

有谁知道Nginx + Passenger在使用RAM方面的效率有多高?

ruby ruby-on-rails apache2 nginx

2
推荐指数
1
解决办法
1959
查看次数

如何忽略.htaccess?

有没有办法告诉Apache忽略当前目录下的其他.htaccess文件?例如:

/web/.htaccess [this is parsed, I would like to define the rule here]
/web/uploads/.htaccess [this should be ignored]
Run Code Online (Sandbox Code Playgroud)

apache .htaccess apache2

2
推荐指数
1
解决办法
4229
查看次数

重定向到trailng斜杠(htaccess)

尝试向每个链接添加尾部斜杠.即http://mysite.com/products应该将301重定向到http://mysite.com/products/等.但是如何?这是htaccess:

RewriteEngine on
DirectoryIndex index.php
Options -Indexes
RewriteBase /

RewriteCond %{REQUEST_URI} \.css$
RewriteCond %{QUERY_STRING} ^pack$
RewriteRule ^(.*)$ /modules/system/css_compactor.php?filename=$1 [L]
RewriteCond %{REQUEST_URI} \.js$
RewriteCond %{QUERY_STRING} ^pack$
RewriteRule ^(.*)$ /modules/system/js_compactor.php?filename=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php
RewriteRule /admin/(.*)$ /admin/index.php
Run Code Online (Sandbox Code Playgroud)

需要帮忙!

.htaccess apache2

2
推荐指数
1
解决办法
1138
查看次数

如何在Windows服务器上升级Apache?

我刚刚将我们的Web服务器从PHP 5.3.6升级到5.3.10,现在我想将Apache从2.2.17升级到2.2.22(在Windows Server上).我如何以一种好的方式(在实时网络服务器上)进行此操作?停机时间不多,但不会太多.

Apache是​​通过MSI安装程序安装的,我不知道如何以最少的停机时间安全升级.我是否只下载最新的安装程序并安装它?那我的配置文件怎么样?我不认为可以将两个实例安装在"彼此相邻"之外吗?或者是吗?

apache webserver apache2

2
推荐指数
1
解决办法
1万
查看次数

SetEnvIf HTTP_HOST不起作用

我无法让它工作.htaccess的这部分,IfDefine永不运行.我做错了什么,setenvif启用了mod.

RewriteBase /

SetEnvIf HTTP_HOST ^localhost$ local
<IfDefine local>
  RewriteBase /codeigniter-app/
</IfDefine>

SetEnvIf HTTP_HOST ^testing.alex.com$ testing
<IfDefine testing>
    RewriteBase /app/
</IfDefine>
Run Code Online (Sandbox Code Playgroud)

这是基于:使用mod_rewrite可以在RewriteCond中指定RewriteBase吗?

编辑: 完成上述任何其他方式?

.htaccess apache2 setenv ifdefine http-host

2
推荐指数
2
解决办法
2万
查看次数

mod_rewrite:为什么不能使用环境变量来防止递归?

为什么我不能使用mod_rewrite与此类似的规则:

RewriteEngine On
RewriteCond %{ENV:did_rewrite} !=true
RewriteCond %{REQUEST_URI} ^(.*)/
RewriteRule (.*) %1/foo.php?original=$1 [E=did_rewrite:true]

为了防止递归?

当我转过身时RewriteLogLevel,我看到:

[.../initial] (3) [perdir /.../test/] strip per-dir prefix: /.../test/stuff -> stuff
[.../initial] (3) [perdir /.../test/] applying pattern '(.*)' to uri 'stuff'
[.../initial] (4) [perdir /.../test/] RewriteCond: input='' pattern='!=true' => matched
[.../initial] (4) [perdir /.../test/] RewriteCond: input='/test/stuff' pattern='(.*)/' => matched
[.../initial] (2) [perdir /.../test/] rewrite 'stuff' -> '/test/foo.php?original=stuff'
[.../initial] (5) setting env variable 'did_rewrite' to 'true'
[.../initial] (3) split uri=/test/foo.php?original=stuff -> uri=/test/foo.php, args=original=stuff …

mod-rewrite apache2

2
推荐指数
1
解决办法
667
查看次数

Python + Django在aphat2(httpd),Redhat上的不同用户下运行

我有一个django应用程序绑定到Red Hat上的httpd(apache2),它运行良好,但我想用不同的用户名运行它,所以如果它写入文件系统文件的所有者应该是newuser .我正在寻找实现这一目标的解决方案.

我尝试使用httpd-itk(在此之后:http://www.webtatic.com/packages/httpd-itk/),但它抱怨:

permission denied: mod_wsgi (pid=31322): Unable to connect to WSGI daemon process
'myapp.djangoserver' on '/var/run/wsgi.31085.0.1.sock' after multiple attempts.
Run Code Online (Sandbox Code Playgroud)

在解决了这个问题后(通过给予777权限来测试文件),我仍然拥有文件所有者的apache.

我的conf文件如下所示:

<VirtualHost *:80>

    ServerName myapp
    ServerAlias myapp 
    DocumentRoot /usr/share/myapp

    <Directory /usr/share/myapp>
        Order allow,deny
        Allow from all
    </Directory>

    WSGIDaemonProcess syntyma.djangoserver processes=10 threads=20 display-name=%{GROUP}
    WSGIProcessGroup myapp.djangoserver

    WSGIScriptAlias / /usr/share/myapp/apache/django.wsgi
    CustomLog logs/myapp-access.log combined
    ErrorLog logs/myapp-error.log

    LogLevel debug
    AssignUserId newuser newuser

</VirtualHost>
WSGISocketPrefix /var/run/wsgi
Run Code Online (Sandbox Code Playgroud)

,以及创建的测试文件:

ls -l /tmp/ggg
-rw-r--r-- 1 apache apache 3 Sep  6 09:46 /tmp/ggg
Run Code Online (Sandbox Code Playgroud)

. …

python apache django redhat apache2

2
推荐指数
1
解决办法
1695
查看次数

CGI脚本(Perl)在带有fastcgi_module的Apache下永远运行

我正在尝试使用Apache2(Apache/2.4.6(Ubuntu))运行cgi脚本fastcgi_module.这是我设置的虚拟主机

<VirtualHost *:8080>
        ServerName cgi.local
        DocumentRoot /home/noobeana/CGI
        <Directory /home/noobeana/CGI>
                AllowOverride All
                Order allow,deny
                Allow from all
                Require all granted
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                SetHandler fastcgi-script
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这是我创建的用于运行测试()的Perl脚本(正确775'/home/noobeana/CGI/test.pl):

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello there!<br />\n";
Run Code Online (Sandbox Code Playgroud)

Perl可执行文件的路径确实是/usr/bin/perl其他一切看起来很好,但是当我在浏览器中打开http://cgi.local:8080/test.pl时,脚本会永远运行 - 我必须停止Apache强制退出.此外,print正在输出到Apache的错误日志(而不是浏览器),只要脚本正在运行,它就会显示以下多行:

[Fri Feb 07 10:24:54.059738 2014] [:warn] [pid 4708:tid 140365322880896] FastCGI: (dynamic) server "/home/noobeana/CGI/test.pl" started (pid 4771)
Content-type: text/html

Hello there!<br />
[Fri Feb 07 10:24:54.078938 …
Run Code Online (Sandbox Code Playgroud)

apache perl cgi fastcgi apache2

2
推荐指数
1
解决办法
352
查看次数