我需要把我以前的网站运行wordpress到一个单一的网站。 我的网站只能包含一个login页面,我希望所有的旧url都redirect到我的网站的根目录。 我有这个工作,但不完全如何我更喜欢。 目前,一切都redirect到mysite.com/index.html,但我希望它直接指向mysite.com。 以下是我在我的位置/ {}标签中使用的redirect代码: try_files $uri $uri/ /index.php?q=$uri&$args; if ( $uri !~ ^/(index\.php|css|images|uploads|js|robots\.txt|favicon\.ico|wp-admin|launch|wp-login\.php|inc) ) { rewrite ^ http://www.mysite.com/index.html permanent; } 这段代码redirect除了那些特定的目录和我列出的文件之外的所有内容。 这样,我仍然可以访问我的wp-admin目录,以便将内容添加到Wordpress中,所以当我稍后拔出交换机时,我可以重新切换站点,并更新所有内容并准备启动。 如果我从上面的redirect中删除index.html,我的网站进入redirect循环。 如果我把重写规则指向/,那么我的网站也会进入redirect循环。 有人可以帮助我更新该代码,以便index.html不显示int浏览器窗口作为实际的URL? 我真的很喜欢实际的url是www.mysite.com,而不是www.mysite.com/index.html。 编辑: 我真正需要的是在我的!〜语句中指定根目录。 但是,如果我添加| / | 它允许所有的文件和子目录被忽略…这意味着我的redirect规则永远不会被调用。 我可以只指定一个根目录,而不包括该根目录中的任何文件或子目录? 这样我可以告诉nginx不要redirect到我的域,但是如果它find/index.html,它将redirect到/。
我正在寻找一种方法来修改由我使用Nginx代理我的请求的一些Web服务器创build的响应正文: server { listen 80; server_name localhost; location /myproject/ { proxy_pass http://127.0.0.1:8080/myproject/; > modify response from http://127.0.0.1:8080/myproject/ before sending } } 这是像HttpSubModule,但与外部程序,而不是简单的文本replace。 修改程序是一个Node.js的networking服务器,所以我想在发送请求中发送响应。 但这只是一个简单的想法,各种方法都非常感谢。
我试图创build一个组合“超级caching” – >文件 – >模块模式与try_files(“超级caching”从wordpress超级caching采取,因为它是一个类似的方法)。 适用于caching的文件位于“caching”文件夹内。 如果文件存在于其中一个位置,则应该提供该文件。 / $caching$ URI / $caching$ URI / $ URI $ URI / 1.cache – > 2.file – > 3.pattern location / { try_files /$cache_dir$uri /$cache_dir$uri/ $uri $uri/ /index.php; } 地址为“domain.com/css/style588.css”的示例 寻找/srv/www/domain.com/public_html/cache /css/style588.css 寻找/srv/www/domain.com/public_html/cache /css/style588.css /index.html&.php 寻找/srv/www/domain.com/public_html /css/style588.css 寻找/srv/www/domain.com/public_html /css/style588.css /index.html&.php 如果没有find:/srv/www/domain.com/public_html /index.php 我试图使它与下面的configuration工作。 我究竟做错了什么? 包括来自nginx.conf的domain.conf server { ## […]
我在Ubuntu服务器上安装了几乎所有的LEMP,我只是设置了一些静态文件。 当为了testing目的而设置PHPNuke时,我注意到我没有安装GD支持。 我有nginx设置php5-fpm所以运行“apt-get安装php5-gd”来安装GD支持库。 之后,nginx破了。 卸载php5-gd也没有解决它。 我在nginx中得到错误500,错误日志出现如下: 2013/01/23 13:27:45 [debug] 16943#0: *16 http script var: "/index.html" 2013/01/23 13:27:45 [debug] 16943#0: *16 trying to use dir: "/index.html" "/etc/nginx/html/index.html" 2013/01/23 13:27:45 [debug] 16943#0: *16 trying to use file: "/index.html" "/etc/nginx/html/index.html" 2013/01/23 13:27:45 [error] 16943#0: *16 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 10.2.1.1, server: […]
我试着在这里安装spdy支持nginx: ningx spedy ,我使用了这个configuration命令 ./configure –with-http_ssl_module –with-http_spdy_module –with-openssl="/…./openssl/openssl-1.0.1c" 但是当我去spdycheck.org检查我的网站时,我得到的结果是NPN启用,但不是spdy,找不到任何信息,现在我可以开始破解(没有在错误日志中),任何想法的人? 编辑: # Force URL on https and www server{ listen 80; server_name www.example.com example.com; rewrite ^ https://www. example.com$1 permanent; } server { listen 443 ssl spdy; ssl_certificate /usr/ssl/nginx/server.crt; ssl_certificate_key /usr/ssl/nginx/server.key; server_name www. example.com; access_log /var/log/nginx/test.tedxnanjing.access; error_log /var/log/nginx/test.tedxnanjing.error error; fastcgi_read_timeout 120; location / { root /var/www/html; index […]
我目前正在从事Web平台的更新工作,并将Apache从Apache切换到Nginx。 所以我必须在做之前testing我们所有的pipe理和内部应用程序。 那么到目前为止,我并没有遇到任何问题,但是如果没有这个问题,它会有点过于简单:D 所以,今天,我使用以下组件安装我的监督平台: 操作系统:Debian挤压6.0.6 WebServer:Nginx 1.2.5 FastCGI:fcgiwrap 1.0.3-3 PhpCGI:php 5.4.11 监督:Nagios 3.4.3 这是我的目录结构: /usr/local/$APPNAME$/$SUBTREE$ –> Aim for all binaries and libraries outside the OS. /etc/$APPNAME$/$SUBTREE$ –> Directory for all binaries configuration files. /srv/apps/$WEBAPPNAME$/$SUBTREE$/ –> Directory for all HTML/PHP/CGI related files. 以下这些我有: /usr/local/nagios/ all owned by nagios user/group. /usr/local/nginx/ all owned by nginx user/group. /usr/local/fcgiwrap/ […]
运行在多个ec2实例上的电子商务网站。 网页内容是使用nginx和它的轨道应用程序的ruby。 我正在使用负载均衡器将stream量路由到多个ec2实例。 有没有什么办法可以找出使用nginx它服务的用户数量以及在一个特定的ec2实例中有多less个并发用户。 所以我可以匹配nginx提供的同时在线的用户数量以及CPU和内存数量以及进程的运行情况,生成报告并进行性能分析。请帮助我! 谢谢
我认为这是非常受欢迎的问题,但是我找不到我感兴趣的信息,希望你能帮助我。 我新的服务器pipe理的东西,所以不要扔石头在我:)我安装nginx到我的debian虚拟服务器,并已经安装了PHP,MySQL和所有我需要的。 但是,当我开始使用我的PHP脚本,我发现我不能通过HTML格式上传文件。 我做了一些testing页,我看到,提交表单后,我可以看到$ _FILES ['tmp_name'],但PHP函数move_uploaded_file不起作用。 它不移动文件。 所以这就是为什么我开始使用Googlesearch,并find很多有关nginx_upload模块等信息。 configurationnginx上传文件是否可行?或者我必须安装nginx_upload模块才能这样做? 我必须做什么允许上传文件到我的nginx服务器。 谢谢。
新手在这里,所以请温柔:) 我按照ArsTechnica的指南在Ubuntu 10.04上安装了php5-fpm的Nginx: http : //arstechnica.com/information-technology/2012/12/web-served-part-3-bolting-on-php -with-PHP-FPM / Nginx运行起来,它提供静态html罚款。 我遇到了让php5-fpm工作的问题。 我得到一个502坏的网关错误,当我看着它说: connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream 当我回到指南时,它提到configuration/etc/php5/fpm/pool.d/www.conf。 我似乎根本没有一个pool.d目录,也没有名为www.conf的文件。 我在/ etc / php5 / fpm目录下有一些php-fpm.conf文件,它们与指南中介绍的设置相似( listen = /var/run/php5-fpm.soc等)。 我可以使用这个文件,或者在安装php5-fpm时出错了吗?
请帮忙解决HTTP保持活着的问题。 基本上,我在运行nginx( v1.2.6 )的EC2上有amazon-ami linux( v2012.09 )。 Chrome( v25.0.1364.99 )正常访问HTTP页面,然后经过约30秒的连接(由于netstat在服务器上监视)而丢弃(未知原因)。 之后,如果chrome从服务器请求某个东西,它将无法接收任何内容,并等待一些明显中断的连接。 超时后,以后的请求工作正常。 Nginxconfigurationkeepalive_timeout 70s 60s; cat /proc/sys/net/ipv4/tcp_keepalive_time显示7200 这可能是一件容易的事,但是使用谷歌search显示了很多类似的问题,但不完全一样。 ( https://code.google.com/p/chromium/issues/detail?id=27400请阅读http://blog.fastmail.fm/2011/06/28/http-keep-alive-connection-timeouts / )。 什么答案会有帮助: 如何更改服务器的configuration,以避免过度等待Chrome浏览器掉线 什么产品可能会内容错误或可以使用什么解决方法 对于Chrome来说,禁用保持活动是一种不得已的解决scheme:因为它减less了响应延迟,并且具有很长的HTTP连接保持活动时间,至less有一分钟。 谢谢