我在我的.htaccess文件中使用下面的。 有3种types的redirect: redirect到目录/admin/index.php redirect到特定的.php文件,例如/ about redirect到/ John的用户个人资料页面 所有3个工作在我的本地环境,但在服务器上只有1和3的作品。 我真的很感激,如果你能告诉我为什么URLredirecttypes“/约”不适合我。 非常感谢。 <IfModule mod_rewrite.c> Options -Multiviews Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^admin$ /admin/index.php [QSA,L] RewriteRule ^about/?$ /about.php [NC,L] RewriteRule ^es/?$ /index.php?lang=2 [NC,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([_A-Z0-9a-z-+\.]+)/?$ /public_profile.php?id=$1 [L] </IfModule> ErrorDocument 404 /404.php
我有一个PHP的Web应用程序的nginxconfiguration,我想使它有一个额外的目的,我似乎无法find一个办法来实现它。 我目前的nginxconfiguration如下: 将/ /intro/*重写为非PHPdynamic“市场营销”网站的静态HTML页面 尝试加载/maintenance.html如果存在于磁盘上,只在部署期间存在) 如果/maintenance.html不存在,请通过FastCGI向PHP发送请求 最终结果是在部署过程中静态页面保持可用,后端PHP应用程序可以在部署发生时进行维护。 serverconfiguration块的重要部分如下所示: rewrite ^/$ /marketing/index.html last; rewrite ^/intro/(.*)$ /marketing/$1.html last; try_files $uri /maintenance.html @webapp; location @webapp { rewrite ^(.*)$ /index.php?url=$1 last; } include php.conf; ( php.confconfiguration处理location ~ \.php$位置,并执行所有通常的fastcgi_param设置。没有任何项目特定的,所以我没有发布该块。) 除了上述之外,我希望能够做的是当“维护模式”打开时,为标准HTTP请求提供/maintenance.html ,但在处理AJAX请求时响应一些JSON。 我发现我可以安全地返回基本内容: if ($http_x_requested_with = XMLHttpRequest) { return 503 '{"maintenance":true}'; } 但是,这显然发生在所有请求上,而不仅仅是/maintenance.html被提供的那些请求。 看来我需要一些标志,因为try_files不允许你做额外的事情取决于它select的文件或位置。 有什么办法可以将nginxconfiguration为返回HTML和JSON维护模式的详细信息? 编辑:更多的思考,也许将maintenance.html完全移出try_files将是很好的,所以它可以用503状态而不是200来提供。
我有一个非常古老的网站,我想尝试在NGINX而不是Apache上运行。 这个网站包含许多带有零星PHP SSI的平面HTML文件,比如: <!–#include virtual="/some_file.php" –> NGINX HttpSsiModule在dynamic时如何处理这些问题? 在模块文档中,它说: The distinction between "file" and "virtual" is mostly historical. "file" is the same as "virtual" with implied "wait" option. 这并不涉及我应该如何configurationPHP执行。 使用上面的#include ,这意味着我应该设置一个匹配/some_file.php的location ,并且configuration为fastcgi到php-fpm(或其他类似的东西)?
我们公司的WordPress的index.php文件(3.5.1,每天一个handfull访客)博客反应非常跛脚每个请求。 一分钟后出现。 这种行为是出于蓝色,对系统做出的改变没有改变。 看着apache 2 error.log文件,我发现以下内容: (32) Broken pipe: core_output_filter: writing data to the network 在互联网上search我发现已经有一个可能的解决scheme的问题。 有人提到,这将有助于补充 EnableSendfile Off 到httpd.conf,但没有任何变化。
这是完整的错误: PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08004] SQLConnect: 1033 [unixODBC][Oracle][ODBC][Ora]ORA-01033: ORACLE initialization or shutdown in progress\nProcess ID: 0\nSession ID: 0 Serial number: 0\n' 我正在使用unixODBC连接到Oracle 11g数据库。 数据库已经起作用,可以作为certificate: select open_mode from v$database; 回报 open_mode —————– read write 该服务的Web应用程序也是完全有效的。 最后,我可以运行: isql -v [odbc store] [user] [password] 并以这种方式查询数据库就好了。 所以我真的不知道为什么我不能通过ODBC连接来获得我所需要的。 我读过的所有内容都表明,我应该遵循类似于以下的过程: 链接来解决类似的问题 感谢您的任何意见。 我真的在我的智慧在这里结束。
我需要imageantialias()在我build立的服务器上工作。 我之前已经编写过PHP,但由于某种原因,我再也无法做到了。 我跑了这些步骤来尝试: apt-get source php5 apt-get build-dep php5 cd php5-* nano debian/rules find这一行–with-gd=shared,/usr –enable-gd-native-ttf \并移除,/usr 保存并退出 nano debian/setup_mysql.sh searchStart the daemon 在mysqld之后添加–user=root 保存并退出 dpkg-buildpackage –rfakeroot -us –uc -d 然后运行很长时间,然后在这里结束: make[1]: Leaving directory `/usr/src/php5-5.3.10/cgi-build' sed -i -e 's/-d output_buffering=1 -d open_basedir="" -d safe_mode=0/-d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d memory_limit="-1"/' \ /usr/src/php5-5.3.10/pear-build/usr/bin/pear && \ sed […]
我pipe理Minecraft:Pocket Edition的大型服务器。 在过去的几个月中,我遇到了这样的问题:服务器会间隔一段时间closures所有活动的连接(VNC和游戏中),然后脱机约30秒,然后重新联机。 这种情况每20分钟左右发生一次。 该服务器的平均上传量为3.1 MB,下载量为600kb,为57个播放器供电,并在所有四个核心上使用40%的CPU。 问题随着玩家数量和服务器实例数量的减less而缩小,断开连接也不复存在,随着玩家数量和服务器实例数量的增加,问题也随之增加。 服务器正在closures一个godaddy专用服务器,它承诺至less10mb的吞吐量,所以它不应该造成问题。 我使用他们的$ 140专用服务器,运行centos。 任何帮助是极大的赞赏。
我使用mac端口安装了php 5.4。 然后我git克隆phpredis存储库( https://github.com/nicolasff/phpredis )。 然后,我执行这些命令: phpize54 ./configure make && make install 问题是巨大的图书馆得到编译与PHP 5.3并安装在这个目录中: /opt/local/lib/php/extensions/no-debug-non-zts-20090626/ 我需要它被编译使用PHP 5.4并安装在这个目录中: /opt/local/lib/php54/extensions/no-debug-non-zts-20100525/ 任何人都知道我在做什么错了? 在此先感谢你们! 编辑: 此外,当我写make test ,我得到这个错误: PHP Warning: PHP Startup: redis: Unable to initialize module Module compiled with module API=20090626 PHP compiled with module API=20100525
我正在尝试在多个PHP版本(5.2,5.3,5.4和5.5)的devel计算机上configurationIIS8服务器,以testing脚本如何针对每个版本运行。 在服务器级别上,我成功创build了所有Handler映射,创build了所有指向相同物理path( c:\ www \ htdocs )的所有4个站点(每个站点都为一个PHP版本)。 现在我认为,对于每个站点,我将更改Handler映射顺序,使一个PHP版本为主。 但问题是这个设置保存在c:\ www \ htdocs中的 web.config文件中。 所以,而不是改变一个网站的PHP版本,它改变了所有网站。 TechNet文档的web.config读取没有太多帮助。 这甚至可以configuration?
注:我问这首先在StackOverflow并发送到这里。 我希望重复是可以的。 在使用Ubuntu 13.04上完全库存的软件包比较Apache 2.2和Nginx 1.2.6的负载testing中,我发现Nginx PHP请求的性能比Apache PHP的要低。 如果可能的话,我正在寻找指导,让我们的Nginx性能超过Apache的性能 。 Apache的设置相当标准,但是Nginx的设置是相当的定制的; 它们被列在基准结果之下 。 我使用名为Siege v3.0.2的基准testing工具( http://www.joedog.org/siege-home/ )为单个并发用户(c1),10个并发用户(c10)和100个并发用户( C100); 结果如下: Apache结果: Date & Time, Trans, Elap Time, Data Trans, Resp Time, Trans Rate, Throughput, Concurrent, OKAY, Failed **** c1 Apache Static **** 2013-08-01 00:54:12, 5982, 59.23, 338, 0.01, 101.00, 5.71, 1.00, 5982, 0 **** c1 Apache […]