Articles of nginx

WordPress的Nginx PHP-FPM超时POST请求

我有一个庞大的数据库和大量的观众访问WordPress的安装。 我正在使用PHP-FPM和Nginx的Ubuntu服务器。 该网站运行几乎完美,除了人们试图在网站上发布一个post。 当有人在网站上提交post时,需要很长的时间,然后给他们留言: 过了一段时间,它会发布。 这是非常繁琐的,但是因为很多职位都想提出来。 这是我的nginxconfiguration: events { worker_connections 1024; use epoll; multi_accept on; } http { ## # EasyEngine Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 2; keepalive_requests 100000; types_hash_max_size 2048; server_tokens off; reset_timedout_connection on; add_header X-Powered-By "EasyEngine 3.7.4"; add_header rt-Fastcgi-Cache $upstream_cache_status; # Limit Request limit_req_status 403; limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; […]

清漆:使用http标头使URLcaching无效

Nginx有一个非常漂亮的命令来使一个特定的caching失效 proxy_cache_bypass $http_cachepurge; curl -I myapp.example.com/api/ping -H "cachepurge: true" 清漆有什么等价物吗?

无法通过端口80克隆到gitlab中的存储库

我遇到一个非常奇怪的问题与安装在服务器上的Ubuntu服务器(我已经尝试了这个与Ubuntu的服务器16.04和17.04),在我的本地networking上运行的gitlab-ce。 我使用gitlab与apache2,以下设置: 我的/etc/gitlab/gitlab.rb文件如下所示: external_url "http://localhost:17391" 我的网站的apache虚拟主机configuration文件(我们称之为'example.com')看起来像这样: <VirtualHost *:80> ProxyPass / http://localhost:17391 ProxyPassReverse / http://localhost:17391 </VirtualHost> 本质上,我采取了整个交通apache接收并redirect到nginx。 我可以在网页浏览器中查看“ http://example.com ”(当然,我必须通过代理访问网站,因为服务器与我的电脑在同一个本地networking上运行),一切正常(login,查看存储库等)。 只要我尝试通过在terminal中运行以下命令克隆到我的电脑上的存储库,我收到一条错误消息: $ git clone http://example.com/user/repoName Cloning into repoName… fatal: repository 'http://example.com/user/repoName' not found 但是,当我尝试与服务器的本地IP(让我们说192.168.1.100),而不是似乎工作的领域: $ git clone http://192.168.1.100/user/repoName Cloning into repoName Warning: redirecting to http://192.168.1.100/user/repoName.git remote: counting objects: 3, done remote: total 3 (delta 0), reused […]

在nginx的访问日志中转义\ x22

我通过在log_format中使用$ request_body来logging我的应用程序的所有请求及其请求主体。 输出:{\ x22foo \ x22:\ x22bar \ x22} 预期输出:{“foo”:“bar”} 我知道“正在转换\ x22但有什么办法逃脱\ x22? Nginx版本:1.10.2

nginx:代理tcpstream量取决于远程ip

我想用nginx代理tcpstream量到不同的后端,这取决于请求者的IP地址。 到目前为止,我在nginx.conf中有以下设置: stream { server { listen 1025; if ($remote_addr != 10.0.99.18) { proxy_pass mailcatcher_production:1025; } if ($remote_addr = 10.0.99.18) { proxy_pass mailcatcher_others:1025; } } } 但是在启动nginx时出现以下错误: [emerg] 1#1: "if" directive is not allowed here in /etc/nginx/nginx.conf:36 我认为这并不重要,但我在docker中运行nginx,并在启动时将nginx.conf复制到容器中。

PHP-FPM 7.0 + NGINX:空闲进程

我知道有很多很好的答案这样的问题在stackoverflow或serverfault,但我无法find我的问题的答案。 我有我的php-fpm 7.0进程的以下/status输出。 pool: www process manager: dynamic start time: 04/Jul/2017:15:09:20 +0200 start since: 609 accepted conn: 6113 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 89 active processes: 11 total processes: 100 max active processes: 27 max children reached: 0 slow requests: 0 正如你所看到的,我有很多闲置的进程正在等待某些事情要做。 闲置的stream程是好还是不好的做法? ; The number of […]

还有另外一个Nginx的504超时,当一个反向代理

所以我有一个nginx安装程序作为我的域的反向代理,这是从我的angularjs 2应用程序的/ api开始的调用redirect到同一台机器上的一个春季启动应用程序 但是,当我尝试执行login调用/ myname /loginPOST,调用成功进入春季启动应用程序,然后successfulyl答复,但我的前端应用程序永远不会收到一个响应,因此我得到一个504网关超时。 什么可能导致这个问题呢? 我有以下configuration: user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { 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; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type […]

为nginx中的每个元素设置caching/过期时间?

在configurationnetworking服务器(nginx)时,设置和过期时间并caching客户端浏览器请求的每个目录中的每个元素的情况并不常见? 我刚刚在nginx网站和servervault上find了一些到期时间的例子: location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { expires 30d; add_header Pragma public; add_header Cache-Control "public"; } location ~* \.(?:css|gif|jpe?g|png)$ { expires max; } 如果我想通过设定每个元素的到期时间,我将如何写location线? location ~* \.(?:*)$ { expires 2d; add_header Pragma public; add_header Cache-Control "public" }

将它从Apache移动到Nginx后无法访问MediaWiki

这是我在nginx.conf文件中写的。 目前在这个文件中有两个server类别,分别是Redmine和MediaWiki。 38 server { 39 listen 80; 40 server_name wiki.mypage.com; 41 root /var/www/html/mediawiki; 42 43 location / { 44 index index.php; 45 error_page 404 = @mediawiki; 46 } 47 48 access_log /var/log/nginx/access-wiki.log; 49 error_log /var/log/nginx/error-wiki.log; 50 51 charset utf-8; 52 passenger_enabled on; 53 client_max_body_size 50m; 54 } 55 56 server { 57 listen 80; […]

Nginx的正则expression式不工作

我试图使用这个正则expression式来获得每个主机不同的sitemap.xml,没有子域: rewrite "([a-zA-Z\d-]+).([a-zA-Z\d-]+\.([az]{2,3}))\/sitemap.xml" /sitemaps/$2.xml; 正如你可以在这里看到https://regex101.com/r/WVQQ27/1正则expression式工作和第二捕获组应该是没有子域的主机。 但由于某种原因,我一直得到404。任何想法? 技术背景是,我们针对不同的域名拥有不同的站点地图,但也根据同一应用程序提供的内容的语言来共享内容。