Articles of nginx

具有多个ipv4地址的服务器添加ipv6

我有一个专用的Centos 6.5服务器,用nginx和2个ip地址(这些是来自OVH的2个ip(v4)-failover地址),用于在同一台服务器上托pipe2个不同的网站。 我想添加ipv6地址,但不知道如何实现这一点。 我有ifcfg-eth0和ifcfg-eth0:1都有不同的ipv4地址。 nginxconfiguration文件看起来像 server { listen ipv4address_site1:80; listen ipv4address_site1:443 default ssl spdy; server_name server_for_eth0; } server { listen ipv4address_site2:80; listen ipv4address_site2:443 default ssl spdy; server_name server_for_eth0:1; } 我应该如何select我的ipv6地址(我的ifconfig应该是什么样的),我的nginxconfiguration应该是什么样的? 干杯,阿德南

加载多个php页面后504网关超时

我发现,在成功申请几个php页面之后,页面加载时间似乎减慢,最终不加载,并给出504。 除了这个在php5-fpm日志中找不到任何相关的错误 [13-Dec-2013 17:53:41] WARNING: [pool web36] child 6797 exited on signal 9 (SIGKILL) after 3165.155870 seconds from start [13-Dec-2013 17:53:41] NOTICE: [pool web36] child 8078 started [13-Dec-2013 17:55:15] WARNING: [pool web36] child 7848 exited on signal 9 (SIGKILL) after 633.767987 seconds from start [13-Dec-2013 17:55:15] NOTICE: [pool web36] child 8100 started [13-Dec-2013 17:56:19] WARNING: […]

configurationnginx虚拟主机

我在Debian GNU / Linux 7(wheezy)机器上configurationnginx虚拟主机时遇到问题。 我得到的是一个500内部服务器错误。 这是我的vhost_autogen.conf文件的一个例子: server { listen *:80; server_name api-dev.domain.com; access_log /var/log/nginx/api-dev.domain.com.access.log; error_log /var/log/nginx/api-dev.domain.com.error.log; location / { root /code/api.domain.com/public; try_files $uri $uri/ /index.php?$args; index index.html index.htm index.php; } location ~ \.php$ { root /code/api.domain.com/public; try_files $uri $uri/ /index.php?$args; index index.html index.htm index.php; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME […]

位置指令不允许nginx

你好,我正在build立php与nginix,我需要添加一些代码 /etc/nginx/nginx.conf file. 我的nginx.conf文件目前看起来像这样 user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; gzip on; include /etc/nginx/conf.d/*.conf; } 当我尝试添加下面的行时,出现此错误 位置指令在/etc/nginx/nginx.conf中是不允许的 我正在尝试添加的行 […]

Nginx:安全与条件

我正在四处阅读,寻找Nginx可以采取的一些安全措施,以保护我使用Nginx作为反向代理服务的应用程序。 我发现这个代码有一些好的东西来保护网站,但它充满了条件,文档阻止了我使用它们。 我对Nginx专家的问题: 有没有更好的方法去做这件事? 有没有一个这样的地方常用的片段沟渠的条件? 我需要这个吗? build议感激。 ## Block SQL injections set $block_sql_injections 0; if ($query_string ~ "union.*select.*\(") { set $block_sql_injections 1; } if ($query_string ~ "union.*all.*select.*") { set $block_sql_injections 1; } if ($query_string ~ "concat.*\(") { set $block_sql_injections 1; } if ($block_sql_injections = 1) { return 403; } ## Block file injections set $block_file_injections […]

Nginx没有把uri传递给php5-fpm,而是作为文本文件

如上所述,uri没有被传递给nginx。 我已经包括了整个“尝试”块来显示这个。 location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. set $page_to_view "/index.php"; try_files $uri $uri.php $uri/; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } 所以它本质上是说:“噢,我们做了$ uri.php文件存在,让我们服务器,而不是实际发送到PHP。 我的fpm部分在下面。 # pass the PHP scripts to FastCGI server listening […]

nginx和Mysql服务器负载限制(取决于服务器configuration)

我的服务器configuration是 Technology: Ivy Bridge Processor: Intel Xeon E3 1245v2 Intel Smart Cache: 8MB Cores: 4 Threads: 8 Frequency: 3.4GHz+ Turbo Boost: 3.8GHz Virtualization: yes RAM : 32 GB DDR3 Hard drive: Intel SSD 2 x 120GB RAID: SOFT – 0/1 (RAID-1 by default) NIC: GigaEthernet Bandwidth: 200 Mbps guaranteed Version: Parallels Plesk Panel v11.5.30_build115130819.13 os_CentOS […]

NGINX – url重写正则expression式

我有像example.com/page.php?username=test这样的url。 我想重写这个url到像这样的: example.com/test只有当test遵循下面的正则expression式: /^[0-9a-zA-Z_-]{1,35}+$/ ,否则404页面。

为多个EC2服务器使用一个卷

我安装了将托pipe一个wordpress网站的ubuntu服务器。 我正在使用的技术是: nginx + php5-fpm作为networking服务器 作为caching系统 mysql数据库服务器(RDS)。 问题是,当我上传一个wordpress媒体将它保存在其中一台服务器的数据,我想使用负载均衡器的多台服务器据我所知,我需要使用服务器之间的一些共享,并将其安装到每台服务器。 我的问题: 有没有一种方法,我可以用AWS做到这一点? 或者我需要创build另一台服务器来托pipe我上传的文件? 我应该select什么样的文件共享作为EC2服务器之间的文件共享系统?

nginx似乎不会加载用于php的memcached模块

我有一台运行nginx和memcache的Ubuntu机器,我试图在Memcached上使用PHP。 我遇到了Fatal error: Class 'Memcached' not found 。 ini文件是从/etc/php5/fpm/php.ini加载的,除了memcached.ini(即使在重新启动nginx之后)之外,所有其他附加的.ini文件都被parsing,如phpinfo()的输出所示。 我试着apt-get install php5-memcache ,它没有错误地完成。 但是, pecl install memcached失败,出现以下错误: In file included from /tmp/pear/temp/memcached/php_memcached.h:22:0, from /tmp/pear/temp/memcached/php_memcached.c:47: /tmp/pear/temp/memcached/php_libmemcached_compat.h:5:40: fatal error: libmemcached-1.0/memcached.h: No such file or directory compilation terminated. make: *** [php_memcached.lo] Error 1 ERROR: `make' failed 服务器在/usr/include/libmemcached ,但即使使用–with-libmemcache=/usr/include/libmemcached pecl安装也会失败。 输出为php -i | grep -i memcache php -i | […]