我有一个旧的网站“档案”服务器,不再使用,但我想保持在线,作为我的简历/投资组合的一部分。 他们需要不同的apache和php版本和设置,所以我在不同的端口上运行多个apaches,在nginx反向代理之后。 然而,这些网站并不经常有访问者。 访问之间可能需要几天甚至几周的时间,所以我认为这是一个很大的内存和CPU的浪费,让所有这些Apache实例始终运行。 我想要做的是让nginx按需启动适当的apache服务器。 也许这样的事情: 传入http请求到nginx。 nginx检查一个apache服务器是否响应它的tcp端口。 如果apache没有响应:运行一些脚本来启动apache。 当apache开始响应时,将http请求反向代理到apache。 我希望Apache的守护进程作为模块加载PHP。 当访问者浏览网站时,我希望访问速度快,但是,在第一个请求上加载几秒钟是没有问题的。 一些网站是非常强大的AJAX,所以加载Apache的每个请求不是一个选项。 我没有find任何明显的方式来做到这一点。 有没有人有类似的设置有任何想法或经验? 还有其他反向代理软件(比nginx)会这样做吗? (当然,我也需要一种closuresapache的方式来closures不活动,但是用cron作业来检查apache的access.log中是否发生了一些事情是非常简单的。) Btw ..服务器正在运行Debian Lenny。 编辑/我的解决scheme: 我通过https://github.com/nodejitsu/node-http-proxy为node.js编写脚本解决了这个问题。 // I'm using http-proxy to make the proxying: var server = httpProxy.createServer(function (req, res, proxy) { var domain = getDomain(req); proxy.proxyRequest(req, res, { host: '127.0.0.1', port: configuration[domain].port }); }).listen(80); // And a error […]
我认为从一个小片段开始将是最明智的: location ^~ /test/ { proxy_pass http://frontend; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-Port $server_port; if ( $remote_addr ~* "123.123.123.123" ) { proxy_cache cache_base; proxy_cache_valid 720m; } } 所以,实质上我们想要做的就是设置基于coniditonal IF语句的代理caching。 以上不起作用,因为proxy_cache在IF中无效。 有谁知道如何代理caching基于正则expression式匹配在众多的nginx内部variables之一? 注意: 我们希望基本上禁用/启用基于$ remote_addr正则expression式的proxy_caching。 不指定不同的proxy_cache值。 谢谢。
我们想知道以下几点: 通过编译新版本升级nginx,并进行make install。 目标都是一样的,基本上旧版本被覆盖(我们通常从nginx -V中取出configurationstring)。 是否足够做一个nginx -s重载来强制新版本的nginx开始使用? 或者我们必须杀死这个进程并且开始备份? 我们要求这个试图尽可能地限制停机时间。 我知道我知道,一个快速的killall nginx; nginx ….是宕机时间的第二个…但是为什么如果可以避免的话,甚至有宕机时间。 谢谢。
我在nginx中有以下configuration: location /static/ { root /srv/kose/; expires 2w; access_log off; } location / { proxy_pass http://127.0.0.1:8089; } 如果在/ static /中找不到文件,我想提供一个默认的映像,而不是 proxy_pass到8089.目前,它查找根目录中的静态文件,如果找不到它,它会尝试代理。 我已经尝试了以下,但它不起作用。 我怎么能告诉nginx服务的默认图像? 我也试过try_files无济于事。 location /static/ { root /srv/kose/; expires 2w; access_log off; error_page 404 /srv/static/defaultimage.jpg; } location / { proxy_pass http://127.0.0.1:8089; }
我正在用PHP 5.3为多个运行wordpress的网站设置Nginx。 我刚刚添加了一个新的网站,它被redirect到默认的欢迎页面。 我在日志中看不到任何“真正的”错误。 这里是我的缩写nginx.conf: http { access_log /var/log/nginx_access.log; index index.php index.html; server { listen 80 default_server; server_name _; root /opt/nginx/html; location / { } } server { listen 80; server_name example.com *.example.com; rewrite ^ $scheme://www.example.com$request_uri? permanent; } server { listen 80; server_name www.example.com; root /home/example/example.com; location / { } location ~ \.php$ { try_files […]
我非常喜欢NGINX和服务器pipe理员初学者。 我使用这个教程来安装NGINX / PHP / mySQL / WordPress: C3M数字教程 在本教程中,使用fastcgiconfiguration后端php-cgi安装程序。 本教程中安装了php5-fpm: apt-get install nginx-full php5-fpm php5 php5-mysql php5-apc php5-mysql php5-xsl php5-xmlrpc php5-sqlite php5-snmp php5-curl 在阅读了WordPress编解码器上的NGINXconfiguration比大多数教程更安全之后,我决定使用codexconfiguration: Codex中的WordPress NGINXconfiguration Codexconfiguration使用php-fpm作为后端php-cgi。 当打开浏览器时,我得到了502错误的网关错误。 错误日志是: “2012/06/10 21:18:27 [暴击] 14009#0:* 4连接()到unix:/tmp/php-fpm.sock失败(2:没有这样的文件或目录),同时连接上游,客户端:12.3.456.789,服务器:mywebsite.com,请求:“GET / HTTP / 1.1”,上游:“fastcgi:// unix:/tmp/php-fpm.sock:”,主机:“mywebsite.com” 在codex提供的主要NGINXconfiguration文件中,我注意到在上游php块中指向空目录的行“server unix:”: # Upstream to abstract backend connection(s) for PHP. upstream php { server unix:/tmp/php-fpm.sock; […]
我有以下nginx位置块: location /publish/domain.io.php { allow 127.0.0.1; deny all; } location ~\.php { try_files $uri =404; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; include /etc/nginx/fastcgi_params; } 问题是位置块/publish/domain.io.php似乎没有执行。 我可以从任何主机调用php脚本domain.io.php 。 想法? 非常感谢。
我使用Verisign Extended SSL证书,由运行默认密码套件configuration的nginxpipe理。 这会导致256位encryption连接。 但是,由于这是CBC方法,我应该关心BEAST攻击吗? nginx手册提供了以下回退到RC4的build议(似乎没有受到特定攻击的影响): ssl_ciphers RC4:HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; 这很好,但是它也将encryption还原为128位。 最好select容易受到BEAST攻击的256位,或128位不是(但可能容易受到其他攻击)?
我正在用Directadmin运行一些虚拟主机服务器。 我将Apache作为主要的Web服务器运行,Nginx作为它的代理工作。 为了保持Nginx对Directadmin“隐形”,我在端口81上运行Nginx,并将所有到达端口80的连接转发到端口81,然后让Nginx作为代理(我基于这个post的设置)。 这已经完美工作了一年多了。 事情是,昨天我们开始注意到在我们的几个服务器的攻击。 我们收到这样的请求(取自Apache的mod_status): 11-2 29087 0/17/17 W 1.88 19 0 0.0 0.07 0.07 31.7.58.56 www.somedomain.com GET http://124.108.121.178/?.src=pop&.intl=e1&.help=1&.v=0&.u=c 12-2 29105 0/5/5 W 0.02 42 0 0.0 0.06 0.06 95.79.20.72 www.somedomain.com GET http://chek.zennolab.com/proxy.php HTTP/1.1 13-2 29111 0/14/14 W 0.29 26 0 0.0 0.07 0.07 87.227.9.151 www.somedomain.com POST http://arhack.net/vb/index.php HTTP/1.1 14-2 29113 0/5/5 W 0.80 […]
我读过许多关于Apache优化的文章。 在阅读时,两个名字重复了一遍又一遍, nginx和php-apc 。 我试着去了解哪一个可能对我有帮助,但是我找不到明确的答案。 我需要我的服务器支持大约10k连接。 服务器有5GB RAM和4个CPU。 我的问题是我应该使用哪一个? 我是否需要更改我的代码以更好地使用APC和nginx ? 使用nginx会不会从Web服务器上删除任何function? 我错过了什么? 有什么基本的,我已经错过了? Apache信息: [root@web conf]# httpd -V Server version: Apache/2.2.3 Server built: Sep 3 2009 17:38:51 Server's Module Magic Number: 20051115:3 Server loaded: APR 1.2.7, APR-Util 1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7 Architecture: 32-bit Server MPM: Prefork threaded: no forked: yes (variable […]