Articles of nginx

在CentOS 5上安装nGinX反向代理服务器

我试图在CentOS 5上用apache安装nGinX作为反向代理。 说明如下: http://wiki.mediatemple.net/w/(dv):Configure_nginx_as_reverse_proxy_web_server 注意 – 在说明中,获取nginx的url我正在使用以下内容: http : //nginx.org/download/nginx-1.0.10.tar.gz 现在,这是我的问题。 安装所需的软件包并运行.configure后,我得到以下内容: 检查操作系统 + Linux 2.6.18-028stab094.3 x86_64 检查C编译器…发现 +使用GNU C编译器 + gcc版本:4.1.2 20080704(Red Hat 4.1.2-51) 检查gcc -pipe开关…find 检查gcc内置的primefaces操作…发现 检查C99可变macros…发现 检查海湾合作委员会可变macros…发现 检查unistd.h …发现 检查inttypes.h …发现 检查limits.h …发现 检查sys / filio.h …未find 检查sys / param.h …发现 检查sys / mount.h …find 检查sys / statvfs.h …find 检查crypt.h …发现 检查Linux的特定function […]

Nginx重写错误

出于某种原因,www.server-1.com/forum不会redirect到forum.server-1.com,而是www.server-2.com。 当我删除它redirectwww.server-1.com到www.server-2.com的部分,它就像一个魅力…好吧,不完全是,因为论坛后的第一个斜线得到不知何故在这个过程中,每当url并不以/ forum结尾,而是以/forum/index.php为例。 # Redirect www.server-1.com/forum to forum.server-1.com # Redirect www.server-1.com/forum/ to forum.server-1.com # Redirect www.server-1.com/forums to forum.server-1.com # Redirect www.server-1.com/forums/ to forum.server-1.com # Redirect www.server-1.com to www.server-2.com server { listen 80; server_name www.server-1.com; location = /forum { rewrite ^ http://forum.server-1.com redirect; break; } location /forum/ { rewrite ^/forum/(.*) http://forum.server-1.com$1 redirect; break; } location = […]

Nginx密码保护一个域名,避免configuration重复

我有2个域名dev.domain.com和beta.domain.com。 目前我有一个服务器部分(默认)与一堆特定的位置和规则。 现在我需要密码保护beta.domain.com。 有没有办法做到这一点,而不创build额外的服务器部分,实质上重复所有的位置和其他规则? 一般来说,我想知道其他人如何pipe理复杂的nginxconfiguration。 他们只是复制部分(重复)或包含共同的规则?

nginx删除if语句

我在这里寻找一个nginx noob的小build议。 我一直在阅读,如果语句在nginx方式慢,所以我希望在转换这些一些帮助。 我尝试了一堆不同的方法,所有的失败,所以我想我会抛出一个问题。 server_name *.noconformity.co noconformity.co; # remove all sub domains and www if ($http_host !~* "^(ftp|ssh)\.noconformity\.co$"){ set $rule_0 1$rule_0; } if ($http_host ~ "^([^.]+)\.noconformity\.co$"){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite ^/(.*)$ http://noconformity.co/$1 permanent; break; } # Login Short Cut if ($uri ~* "/login") { rewrite ^/login(/.*)? /wp-admin$1; }

nginx主机服务器日志轮换所有网站

我已经为目录中的每个站点设置了单独的日志文件 /var/log/nginx-hosts/ 我必须为这些文件configuration日志轮换。 我开始的基地是 /var/log/nginx-hosts/*.log { rotate 7 daily missingok notifempty sharedscripts copytruncate compress } 然而,就像apache似乎nginx必须closures预旋转,以实际截断它们。 当前的nginx logrotateconfiguration是: /var/log/nginx/*.log { daily missingok rotate 52 compress delaycompress notifempty create 0640 www-data adm sharedscripts prerotate if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ run-parts /etc/logrotate.d/httpd-prerotate; \ fi; \ endscript postrotate [ ! -f /var/run/nginx.pid ] || kill -USR1 […]

ubuntu:安装了php-mcrypt,但是并没有显示在phpinfo()

我试图安装在我的Ubuntu 10.04 LTS上的Web应用程序需要mcrypt,并且正在生成此错误:致命错误:调用未定义的函数mcrypt_module_open()。 我知道这是同一个问题: 安装php-mcrypt,但它不显示在phpinfo() ,但我尝试了几件事情,没有一个工作,并有其他问题。 我会评论最初的主题,但没有足够的声望去做; 原谅我的重复的问题。 我的版本的PHP和mcrypt(都通过apt-get安装): php: 5.3.2-1ubuntu4.10 mcrypt: 5.3.2-0ubuntu 做一个php -m显示安装了mcrypt模块。 我通过apt-get安装了mcrypt和php5-mcrypt 。 另外,我使用nginx作为我的web服务器。 我已经尝试重新安装mcrypt并重新启动nginx,但仍然无法让mcrypt显示在phpinfo()上,并且对mcrypt的调用仍然中断。 这里是一些更多的信息: $ php -i | grep "mcrypt" /etc/php5/cli/conf.d/mcrypt.ini, mcrypt mcrypt support => enabled mcrypt.algorithms_dir => no value => no value mcrypt.modes_dir => no value => no value 我还检查了/etc/php5/cli/conf.d/mcrypt.ini和/etc/php5/cgi/conf.d/mcrypt.ini中的mcrypt。 最后,我用nginx使用fastCGI。 我search了一下,看到了重新启动php5-fpm的build议。 我无法在apt-get中findphp5-fpm,因为我已经有了fastCGI,所以我不确定是否还需要php5-fpm。 还有什么我失踪?

nginx的Perl不工作

我有NGINX愉快地工作与PHP FPM所有tickety-boo。 我正在尝试添加一些Perl页面。 我有我的默认网站configuration; location ~ \.pl$ { gzip off; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.pl; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www/$fastcgi_script_name; } 在我的浏览器中浏览perl页面(下面的例子)只是显示源代码。 就好像代码没有被传递给FPM,或者它没有执行它,只是将它传递回来。 我不知道该怎么办 我不知道如何解决这个问题。 NGINX中没有error.log或php5-fpm.log。 test.pl; #!/usr/bin/perl print "Content-type:text/html\n\n"; print <<EndOfHTML; <html><head><title>Perl Environment Variables</title></head> <body> <h1>Perl Environment Variables</h1> EndOfHTML foreach $key (sort(keys %ENV)) { print "$key = $ENV{$key}<br>\n"; } print "</body></html>";

为什么我需要指定passenger_enabled两次?

我试图设置我的nginx.conf在Rails 3.1中使用资产pipe道。 我使用nginx 1.0.10和Passenger 3.0.11。 我的nginx.conf如下所示: server { listen 80; server_name .example.com root /srv/project/public; passenger_enabled on; passenger_use_global_queue on; # Assets shouldn't expire location ~ ^/assets/ { gzip_static on; expires 10y; add_header Cache-Control public; add_header Last-Modified ""; add_header ETag ""; } } 但是,当我尝试访问资产时,我得到一个404错误(当然,除非它正在访问caching)。 我想通过增加passenger_enabled on; 进入location ~ ^/assets/ block会解决这个问题,但是我不明白为什么在server块的前面已经指定了这个选项?

WordPress上的VPS上的nginx + php5-fpmpipe理速度令人难以置信。 其他应用程序/ WP前端运行良好

我以为这可能是一个StackOverflow的问题,但我发现Nginx + php5-fpm在这里讨论什么是错误在我的php-fpmconfiguration? 所以我会在这里发表。 其他的研究是多次search有关缓慢wordpress与类似的configuration,但在其他所有情况下,我可以find,这是前端和后端缓慢,不只是pipe理员。 这是我的规格: 在Ubuntu 11.10上的Wordpress 3.3 + Nginx 1.0.10 + php5-fpm 5.3.8 + ISPconfig 3.0.4.1 + 256Mb VPS 在一个Zen Cart商店和phpbb3中,以及不同的php-fpm池。 除了必需品外几乎没有任何东西在运行,而且这两个地点绝对是火箭。 当W3TC加速时,Wordpress网站的前端也一样。 但….pipe理员需要6-10秒做任何事情。 在mysql的慢日志里没有任何东西,或者是php-fpm的错误日志,负载不会突然增加,内存的使用也不会弹起来(但是请看下面的内存)。 它第一次加载,在WP-admin / options.php它显示了一个很长的页面,看起来不对,像线以后的行… active_plugins SERIALIZED DATA 这是ps_mem.py中的主要项目 732.0 KiB + 87.5 KiB = 819.5 KiB bash 2.1 MiB + 369.0 KiB = 2.4 MiB fail2ban-server 1.8 MiB + […]

在Amazon Linux EC2实例上升级到nginx 1.0

我注意到,官方的亚马逊回购仅主机nginx 0.8,现在被认为是一个旧版本。 从源代码手动编译的短缺我必须做什么来通过yum升级到稳定的nginx 1.0版本? 有没有人知道亚马逊的理由不包括1.0版本? 如果有一些错误或已知问题,我坚持0.8。