Articles of nginx

php-fpm错误日志是trucated

我正在设置testing环境,我有nginx和php-fpm在centos 7.我已经成功设置了一切,我可以运行php代码。 这是我的configuration: nginx版本:nginx / 1.9.9 PHP 7.0.0(cli)(内置:2015年12月2日20:42:32)(NTS) 版权所有(c)1997-2015 The PHP Group Zend Engine v3.0.0,版权所有(c)1998-2015 Zend Technologies 使用Zend技术公司的Zend OPcache v7.0.6-dev版权所有(c)1999-2015 我的挑战是获取php错误日志。 我设法启用catch_workers_output = yes但错误在那里。 如果错误文本很长,则会被截断。 我的问题是如何configurationphp-fpm从subprocesslogin所有的stderr? 最好的祝福

Nginx +旅客服务资产在子Uri

我正在服务一个Rails应用程序在一个sub-uri像https://projects.mydomain.com/app1/ 但我的资产没有加载。 这里是我的nginxconfiguration: location ~ ^/app1(/.*|$) { root /srv/www/app1/current/public; passenger_base_uri /app1; passenger_app_root /srv/www/app1/current; passenger_document_root /srv/www/app1/current/public; passenger_enabled on; } location ~ ^/(assets)/ { root /srv/www/app1/current/public; gzip_static on; expires max; add_header Cache-Control public; } 该应用程序已加载,所有URL / PATH前缀为/ app1 /,但资源未加载。 https://projects.mydomain.com/app1/assets/application-123456.css不起作用 当我尝试没有前缀的资产path时,我可以看到资产存在: https://projects.mydomain.com/assets/application-123456.css工作 任何想法 ? 更新: 增加了error_log /var/log/nginx/error.logdebugging; 当然这是一个编辑的摘录: 2015/12/18 11:15:44 [debug] 27187#0: *1 http process request line […]

Nginx反向代理被阻止

我们在主域名的子目录中运行一个WordPress博客。 domain.com => Server A (Nginx) domain.com/blog => Server B (Apache) 博客本身位于不同的(便宜的共享主机)服务器上,并被反向代理。 Nginx => Apache 由于对博客的每个请求都通过主服务器传输,所以服务器B不断阻止我们的服务器IP地址,因为所有请求都来自同一个IP。 如果同时发生大量请求(主要是爬虫),我们会被列入黑名单10分钟,导致502错误的网关错误。 有没有办法将真实的IP地址传递给服务器B? 或者知道别人解决scheme,而不升级到根服务器? 在服务器A上托pipewordpress博客,现在可悲的是不是一个选项。

NGINX不caching内容

因为我被困在黑暗中,所以我希望任何人都可以在这里投入一些光 基本上,我试图制作一个反向代理NGINXcaching内容。 反向代理工作正常,但caching部分…不。 我遵循许多指南和不同的方法,但所有的结果在我的caching文件夹emtpy和每一个 curl -X GET -I 资源返回X-Proxy-Cache:MISS 我的设置非常基本,正如我所说的,我有一个运行Apache和Tomcat的后端服务器,以及一个运行NGINX的前端反向代理所有请求。 我只是发布一个特定的(最简单的)nginx虚拟主机的信息,它提供了en owncloud安装。 猫/ etc / redhat-release CentOS Linux版本7.2.1511(核心) NGINX -V nginx version: nginx/1.6.3 built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) TLS SNI support enabled configure arguments: –prefix=/usr/share/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –http-client-body-temp-path=/var/lib/nginx/tmp/client_body –http-proxy-temp-path=/var/lib/nginx/tmp/proxy –http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi –http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi –http-scgi-temp-path=/var/lib/nginx/tmp/scgi –pid-path=/run/nginx.pid –lock-path=/run/lock/subsys/nginx –user=nginx –group=nginx –with-file-aio –with-ipv6 –with-http_ssl_module […]

nginx多个静态内容服务器上的子域与url重写

我有一台服务器与nginx的前端和apache的后端。 我需要设置nginx来从其他两台服务器返回图像 http://example.com/images/*.jpg – > http://i1.example.com/images/*.jpg http://example.com/images/*.jpg – > http://i2.example.com/images/*.jpg 图像文件夹在两台服务器上是相同的。 早些时候我问了这个问题,并得到答案 上游后端{ 服务器i1.example.com; 服务器i2.example.com; } location / images / { proxy_pass http:// backend / ; #restconfiguration } 在我的configuration。 这行得通。 但我需要一些其他解决scheme,需要在头文件中看到i1.example.com和i2.example.com,现在我只能看到example.com头文件。 可能吗? 我会很感激任何意见。

端口80正在redirect,除本地networking外无法访问

我知道这可能是一个简单的事情,但我并不是Nginx或Linux的专业人士。 我有一个configuration为端口80的Wordpress MUnetworking(我可以在LAN上的my.site上访问它) 我有我的/ etc / hosts中的端口80上的phpmyadmin去http:// phpmyadmin所以它只能在本地机器上访问 Emby Server也安装到端口8096(我可以访问这个局域网或广域网)Webmin安装在端口10000(我可以访问这个局域网和广域网) 如果我从WAN进入my.site,那么将会在WP网站的应用程序页面出现。 如果我卸载emby-server,那么我得到ERR_CONNECTION_REFUSED 但是,如果我从我的networking内部访问my.site WordPress的网站加载,无论安装或不安装。 附加信息 nginx.conf user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect […]

主机头更改上游服务器nginx

我有我的configuration文件中的以下configuration upstream static { server server1.dom.com; server server2.dom.com; } server { listen 80; server name dom.com; location ^~ /images/ { proxy_pass http://static/images/; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|xls|flv)$ { root /var/www; expires 10d; } location / { proxy_pass http://127.0.0.1:8080/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 如何更改它以查看请求头中上游服务器的主机头。 […]

如何通过docker更改nginx运行的configuration文件

我已经通过这个命令行在Windows 7上通过docker安装了这个映像https://github.com/sharelatex/sharelatex-docker-image的 sharelatex $ docker run -d –name sharemongo mongo:latest $ docker run -d –name shareredis redis:latest $ docker run -d -P -p 80:80 -v /opt/sharelatex –env SHARELATEX_MONGO_URL=mongodb://mongo/sharelatex –end SHARELATEX_REDIS_HOST=redis –link sharemongo:mongo –link shareredis:redis –name sharelatex sharelatex/sharelatex and it seems to work 它可以运行。 但我有问题上传一个较大的文件(> 2MB)。 一个人告诉我,只要将这行添加到configuration文件nginx client_max_body_size 8m; 但我不知道如何改变已经通过docker运行的nginxconfiguration文件。 谢谢

HTTP标头不匹配

php的返回值和nginx中设置的值有什么区别? 当我运行: curl -I mydomain.com 我得到了预期的结果(我keep-alive off ) Connection: close 但是当我输出$_SERVER[HTTP_CONNECTION]在同一个域时,我得到: Connection: keep-alive 我不知道为什么PHP返回保持活动,其他地方我拉头,它显示连接closures。

nginx提供大图片

我的页面上有一些图像会在Safari中丢失,控制台中的信息Failed to load resource: The network connection was lost. 图片服务器是不同的域名,我可以通过在其他浏览器标签中粘贴url来正确地看到图片。 我发现这个https://gist.github.com/voronianski/791ef517c5392d7ce5fb但我不知道如何解决? https://stackoverflow.com/questions/27828576/unable-to-turn-off-chunked-transfer-encoding-in-nginx-with-gzip-for-static-asset 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; open_file_cache max=102400 inactive=20s; open_file_cache_valid 30s; reset_timedout_connection on; send_timeout 2; gzip on; gzip_comp_level 5; gzip_min_length […]