我最近转向了2台服务器设置,其中Nginx,Apache Fastcgi和Php-fpm位于一台服务器上,而另一台服务器上则安装了Mysql 5.5。 每台服务器都有1GB的RAM Nginx被用作Apache的映像代理。 而Apache使用FastCgi通过套接字与Php-Fpm进行通信。 Apache正在使用MPM工作者configuration(我使用下面的configuration) <IfModule mpm_worker_module> StartServers 2 ServerLimit 2 MinSpareThreads 50 MaxSpareThreads 80 ThreadLimit 80 ThreadsPerChild 50 MaxClients 100 MaxRequestsPerChild 10000 </IfModule> Nginx的基本configuration user www-data www-data; worker_processes 2; events { worker_connections 1024; use epoll; } server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 55; 现在,当我使用ab和Siege进行负载testing时,我在两个工具之间的每秒交易中获得了很大的差异 有时abs会产生非常差的结果,每秒转换3-6次,围攻返回结果每秒转换22-26次 我在这里有点困惑,无法决定我的新设置是否提高了性能! 以前,当我用来testing我用来获得平均每秒3-6转换,这是平低的,但是当围攻开始给出每秒26转的结果时我确信。 nginx.conf设置 client_header_timeout […]
这个问题让我疯狂。 我现在试着修复它至less30分钟 如果我注释掉我的try_files一切工作正常,除非我的caching文件没有被送达(我通过日志文件检查) 如果我有以下的url / /name /name/ 他们应该匹配下面的文件。 /var/www/domain/cache/index.html /var/www/domain/cache/name/index.html /var/www/domain/cache/name/index.html 我如何使用try_files来检查它们,如果htmlcaching不存在继续到位置块的其余部分。 这里是任务块 location ~ /$ { #try files here root /var/www/domain/; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket; fastcgi_param SCRIPT_FILENAME $document_root/index.php; }
基本上我发现你可以通过使用php的basedir / open_basedir限制每个用户可以访问的文件夹。 我想每个PHP只能访问自己的文件。 所以我写了 fastcgi_param open_basedir $document_root; 希望能够奏效。 它没有。 我GOOGLE了,只发现结果说你不能通过fastcgi或nginx做到这一点。 这是真的还是我不能这样做? PS:我把衍生的PHP作为自己的用户(而不是www数据),所以它不会对我的nonphp网站造成严重破坏。 但我仍然想阻止一个PHP脚本在PHP网站上访问其他目录(如果我有一个wordpress安装在yourface.com它非常明显的有效的PHPpath是/var/www/yourface/<wordpress scripts>
我目前已经安装了nginx并在CentOS服务器上运行。 都很好。 现在我试图启用PHP,但似乎无法find任何明确的教程( 甚至nginx的文档 ),将直接解释它。 到目前为止我了解到,它由两个组件组成:PHP-CGI和FCGI。 什么命令简单地安装它? 最好使用“yum”。 另外,我希望nginx通过一个unix套接字文件将数据传递给PHP,而不是通过TCP性能明智的。 这个nginx的文档页面跳转,并不适合刚刚开始认识这些东西的人,就像我自己一样。 我提前谢谢你!
我使用来自外部服务器的httperf来压力testing我的应用程序(在scalr / EC2上)。 然而,nginx被configuration为根据源的IP地址分配负载(因此每个应用服务器将接收来自同一用户的所有stream量)。 任何想法如何解决这个问题,并衡量负载处理时,nginx后面的应用程序服务器的数量增加?
目前我正在使用nginx从我的网站上下载下载。 点击下载链接后,用户有时需要等待大约5秒才能开始下载。 我不知道是否需要开始使用RAID 10(我目前正在使用RAID 50),或者如果这是我的Nginxconfiguration的问题。 我也在1gb线上,但下载有时候会低至10kB / s。 我的服务器:Dual Xeon 5620 CPU,12x2TB硬盘,8GB内存。 这是我的nginx.conf #user nobody; worker_processes 12; worker_rlimit_nofile 10240; worker_rlimit_sigpending 32768; error_log logs/error.log crit; #pid logs/nginx.pid; events { worker_connections 2048; } http { include mime.types; default_type application/octet-stream; access_log off; limit_conn_log_level info; log_format xfs '$arg_id|$arg_usr|$remote_addr|$body_bytes_sent|$status'; #sendfile on; #tcp_nopush on; reset_timedout_connection on; server_tokens off; autoindex off; keepalive_timeout […]
这是从乘客安装nginx模块(rvmsudo)安装nginx的错误信息。 nginx是安装在/ opt / nginx(默认)下的1.0.6。 gem成功安装乘客之前。 /usr/bin/ld: /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/ ext/nginx/../common/libpassenger_common.a(aggregate.o): undefined reference to symbol 'round@@GLIBC_2.2.5' /usr/bin/ld: note: 'round@@GLIBC_2.2.5' is defined in DSO /usr/lib/gcc/ x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libm.so so try adding it to the linker command line /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libm.so: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[1]: *** [objs/nginx] Error 1 make[1]: Leaving directory `/tmp/root-passenger-2135/nginx-1.0.6' make: […]
我正在尝试在我的nginx Web服务器上安装phpmyadmin。 我安装了phpmyadmin没有问题。 我为它创build了子域名。 出于安全原因,我没有打电话给我的子域“phpmyadmin”我用了一个不同的名字。 然后我用这个configuration为我的子域 server { listen 80; server_name myphpmyadminsubdomain.domain.com; access_log off; error_log /srv/www/myphpmyadminsubdomain/error.log; location / { root /usr/share/phpmyadmin; index index.php; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_intercept_errors on; fastcgi_pass php; } location = /favicon.ico { log_not_found off; access_log off; } […]
使用nginx有没有一种方法来设置大量的dynamic虚拟主机类似的方式apache2可以configuration? 我正在build立一个saas应用程序,每个用户将有他们自己的子域,我想使用nginx通过apache2。 谢谢 下面的代码应该是如何configuration的 map $http_host $subdir { hostnames; default "default"; .foo.bar.com "foo"; .baz.bar.com "baz"; } server { root /path/to/$subdir; }
有没有办法来捕获所有的请求到任何没有虚拟主机设置的子域,并redirect到Nginx的自定义404页面? 我将有一个通配符logging设置* .example.com,我们所有的用户将有一个子域名username.example.com。 如果有人进入一个不存在的子域,我怎样才能redirect到一个自定义的404页面,而不是让它解决,因为通配符被设置?