Articles of nginx

将_SERVER 设置为yes与stunnel Haproxy Nginx

我想在我的Web服务器上设置_SERVER [“HTTPS”] phpvariables为yes。 实际上,httpsstream量来到stunnel转发到haproxy将其转发到我的networking服务器运行在nginx下。 试图在haproxy.cfg中添加这个: reqidel ^HTTPS: reqadd HTTPS:\ yes 但是,而不是清除HTTPS,并将HTTPS添加到是,它会添加一个新的variables: _SERVER [ “HTTP_HTTPS”] 任何想法? 问候,

在Nginxconfiguration中路由除了一个以外的所有子域

如何将www.domain.com和domain.com所有请求发送到root /directoryA除了需要到根/directoryA的子域specific.domain.com 。 www.domain.com已经被redirect到domain.com ,如果可能的话应该保持这种方式。

nginx“漂亮的url”

所以基本上我目前正在面临一个问题,让以下工作。 http://example.net/url.php/value1/value2/value3 我已经尝试了各种try_files的方法,但没有一个似乎在工作。 以上是我需要做的所有事情,但这是我想出的错误: 这是我当前configuration的副本。 server { listen 80; server_name example; error_log /var/log/nginx/error.log; index index.php; root /www/example.net; location / { try_files $uri $uri/ /index.php =404; } location ~* \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } } 我已经尝试了很多组合,我已经阅读了各种教程中的try_files在位置/和他们都没有以我想要的方式工作。 我得到了404(如果index.php不包括在最后,因为它没有find文件或目录)或500错误。 2013/01/23 07:21:35 [error] 1411#0: *1 rewrite or internal redirection cycle while internally redirecting to "/testing_nginx.php/test", client: 75.182.96.115, […]

configurationNginxredirect不同的服务器

我正在尝试设置Nginx将不同的域redirect到一个 – http://knyt.tl : server { listen 81; server_name _; return 302 http://knyt.tl/; rewrite ^ http://knyt.tl permanent; } server { listen 81; server_name knyt.tl; } 然而,nginx只是返回域knyt.tl内容,不同的域不会被redirect,既不return 302也不rewrite ^ 。 我也试过以下内容: server { listen 81; if ($host != 'knyt.tl') { rewrite ^ http://knyt.tl/ permanent; } } 但是这个条款似乎也完全被忽略了。 只有当我设法让它运行时,从www.knyt.tlredirect到knyt.tl

在nginx服务器上托pipeStacey? (将.htaccess转换为nginx)

Stacey是一个轻量级的内容pipe理系统。 我在我的porfolio网站上使用它,但是它使用.htaccess文件来制作友好的url。 是否有可能重写这个.htaccess行在nginx中使用? 这里是.htaccess文件的内容; RewriteEngine on # Some hosts require a rewritebase rule, if so, uncomment the RewriteBase line below. If you are running from a subdirectory, your rewritebase should match the name of the path to where stacey is stored. # ie. if in a folder named 'stacey', RewriteBase /stacey #RewriteBase / ErrorDocument 404 […]

Nginx的fastcgi_cache_path

我是Nginx的新手。 我的nginx.conf中的nginxcaching设置 fastcgi_cache_path /dev/shm levels=1:2 keys_zone=my-cache:100m inactive=7d; 这是什么意思? 水平,100米和无效= 7天? 感谢在advaced。

在不同于apache端口的端口运行nginx

我想知道如何在不同的端口上运行nginx比apache端口 例如,当有人去链接 http://site.com 它将作为Apache服务 如果他去链接 http://site.com:81 该页面用作nginx

php-fpm,nginx magento商店。 即将停止

我们刚搬到新的服务器。 2 x专用,48 GB内存,php-fpm,nginx,memcached,APC。 我们有一个问题,每个产生的php-fpm进程越来越大。 重新启动php-fpm显示每个进程需要30-100 MB。 几个小时后,他们超过了250MB。 8小时后,每个产生的php-fpm过程都在1.1GB以上。 把服务器放在膝盖上。 我不得不每小时重新启动php-fpm。 为了缓解,我们把pm.max_requests从10,000减less到1,000。 似乎已经停止了每个过程的增长,但是我们还有其他的问题。 无论何时,您在pipe理员中保存产品,都会收到500个服务器错误。 该产品可以节省,但是很烦人。 我们从stoneedge magentoimport脚本将不会导入订单,并给我503错误的网关错误。 所以我们不能导入订单。 这个错误是在nginx中的导入脚本 2013/01/31 07:45:30 [error] 15417#0:* 435945从上游读取响应头时,recv()失败(104:由对等方重置连接),客户端:173.14.230.102,服务器:www.campsaver。请求:“POST /magento-import.php HTTP / 1.1”,上游:“fastcgi://127.0.0.1:9000”,主机:“www.campsaver.com” 这个错误在nginx错误日志里也是遍地都是。 每隔几分钟 2013/01/31 23:53:06 [error] 15430#0:* 1176895从上游读取响应头时,recv()失败(104:由对等方重置连接),客户端:209.85.238.209,服务器:www.campsaver。请求:“GET /男士服装/男士衬衫?品牌= 254 HTTP / 1.1”,上游:“fastcgi://127.0.0.1:9000”,主机:“www.campsaver.com” 这些错误都在我的php-fpm错误日志 1月31日23:56:40.551917 [警告] [池www]孩子32011信号退出7 SIGBUS后8332.830655秒从开始1月31日23:56:40.552514 [公告] [池www]孩子935开始1月31日23:56:51.018778 [警告] [池www]子675信号退出7 SIGBUS后从1080.377420秒开始1月31 23:56:51.019400 [注意] [池www]子936开始1月31日23:57:07.588714 [警告] [池www]儿童601从信号7退出SIGBUS从14月1日起开始1456.255594秒1月31日23:57:07.589324 […]

当没有提供尾部斜线时,nginxredirect(不是代理)到apache后端

当我访问http://example.com/folder ,我的浏览器redirect到example.com:8080 。 但是,当我访问http://example.com/folder/时,它工作正常。 后端是一个监听端口8080的apache服务器。 nginxconfiguration: server { listen 80 default_server; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080; proxy_redirect default; } } 我试过了: … proxy_pass http://127.0.0.1:8080/; …. 还是一样的问题。 我已经看过类似的问题,但似乎无法得到这个答案。 有人有主意吗?

nginx别名使用php5-fpm响应404

我使用nginx使用php5 fpm。 但我有一个问题。 # debug alias location /bb/ { alias /usr/share/blahblah/; } 找不到http://mysite.localhost/bb/index.php文件。 但仍然在/usr/share/blahblah/index.php 这是一个错误: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream