Articles of nginx

好的Magento单服务器解决scheme?

我正在设置一个Debian服务器,使用Mysql来提供Magento。 预计会有高负荷(每天点击数百万次)。 我一直在阅读不同的人的意见,发现了很多不同的设置,但我不知道如果我想要做什么。 多个服务器之间的负载平衡当然是好的,但我只有一个服务器。 那么这个怎么样? 在nginx和apache之前进行清漆,其中nginx只做静态数据和apachedynamic。 或者将清漆放在阿帕奇面前会更好? 所以nginx是在前面,有静态数据直接服务nginx和dynamicapache页面通过清漆?

Nginx如何禁用multithreading下载

我想知道是否有可能禁用nginx上的multithreading下载。 现在用户可以使用下载pipe理器通过分割文件下载文件,我想知道如何防止在我的nginx服务器上。

如何在nginx上进行代理?

我将如何设置我的networking服务器以下面描述的方式工作? Http请求:mypublic.com —>由nginx正常处理,因为它已经build立( listen 80; ) http请求:myprivate.com —>通过apache处理设置工作在8080( listen 8080 ) 我想避免在浏览器中input地址时包含端口,nginx中的某种模型(代理?/ squid?)。 这两个域都指向我的机器,并通过命名来设置。

如何在Nginx日志文件中查看响应的内容types

是否有可能在Nginx的日志文件中看到对请求的响应的content-type ? 目前,这是我所看到的有关请求的要求: 127.0.0.1 – – [23/Nov/2012:10:17:19 -0500] "GET /fonts/cantarell-bold-webfont.eot? HTTP/1.1" 200 22679 "https://www.example.com/blah/doc" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET4.0C)"

如何阻止CloudFront或其他CDN访问我的网站

有些人创build了一个CloudFront CDN代理我的网站,所以人们可以使用像df03039lsls933.cloudfront.net这样的url来访问我的网站,而不是www.example.com 如何使用nginx阻止这个? 从CloudFront文档,它说.. Host: CloudFront sets the value to the domain name of the origin that is associated with the requested object. 所以我不能通过使用host头阻塞,另一种方法是什么? (CloudFront只是一个例子,我想用类似的方法阻止所有的CDN)

如何在server_name指令中设置IP地址,而不是域名?

出于某种原因,如果我在server_name指令中设置了一个裸IP地址,NGINX不起作用: server { listen 80; server_name xx.xx.xxx.xx; # doesn't work server { listen 80; server_name ec2-xx-xx-xxx-xx.ap-southeast-2.compute.amazonaws.com; # this works fine 为什么NGINX不接受IP地址? 如何强制它接受IP? 我使用dynamicDNS与我的域名注册商(确切地说是namecheap),并有一个我有公共域名映射到AWS EC2实例的“A”logging: 所以,当我去到example.com我redirect到我的EC2实例应用程序。 不过,我看到的是一个默认的NGINXlogin页面,而不是我应用的login页面。 NGINX不会将请求进一步代理到Node.js。

为高stream量负载configurationNginx + PHP-FPM

我的nginx在浏览器中不断崩溃并报告“坏门户”错误。 Nginx和PHP-FPM不会预先configuration来处理大stream量负载。 为了确保我的网站在停留时间不会太长,我必须在每个小时将systemctl restart php7.0-fpm cron作业。 让我们来谈谈它。 我从/var/log/php7.0-fpm.log得到一些错误: [20-Sep-2017 12:08:21] NOTICE: [pool web3] child 3495 started [20-Sep-2017 12:08:21] NOTICE: [pool web3] child 2642 exited with code 0 after 499.814492 seconds from start [20-Sep-2017 12:32:28] WARNING: [pool web3] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 7 idle, and […]

Nginx:/etc/nginx/nginx.conf中不允许使用“server”指令:76

Nginxconfiguration就像默认: 我找不到任何关于这个错误的线索。 谁能帮我? 任何帮助将不胜感激。 谢谢。

严格传输安全标头集,但Firefox和Chrome仍然使用HTTP

我的网站使用CloudFlare的通用SSL,我希望浏览器自动redirect到HTTPS。 但是,由于并非所有浏览器都支持SSL cloudflare使用的types ,我不想直接强制使用SSL。 所以HSTS似乎是一个不错的select。 但是,当我在浏览器中testing它时,它并不像我预期的那样工作。 在我的网站configuration文件中,我有这样的一行: server { … listen 443 ssl; add_header Strict-Transport-Security max-age=63072000; … } 它显示在响应标题中: Strict-Transport-Security: max-age=63072000 但是,Windows 10和OS X 10.10.3上的Firefox 35和Chrome 41仍然会在HTTP上导航站点,而不会redirect到HTTPS。 我正在使用在CentOS 7上运行的NGINX版本1.7.3。

减less由nginx引起的IO

我有很多可用的RAM,但是我的IO总是100%util或者非常接近。 我可以通过使用更多的RAM来减lessIO的方式? 我的iotop显示最高io率的nginx工作进程。 这是一个文件服务器提供从1MB到2GB的文件。 这是我的nginx.conf #user nobody; worker_processes 32; worker_rlimit_nofile 10240; worker_rlimit_sigpending 32768; error_log logs/error.log crit; #pid logs/nginx.pid; events { worker_connections 51200; } 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 off; tcp_nopush off; tcp_nodelay on; directio 4m; output_buffers 3 512k; reset_timedout_connection on; open_file_cache max=5000 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses […]