Articles of nginx

nginx默认服务器不工作

我正在使用Debian,最近的dotdeb nginx-lite。 我读过nginxfind的第一个server部分将被用作fallback / default部分,如果域没有特定的服务器部分。 我从我的安装删除了sites-available和sites-enabled ,因为我使用专用的挂载/www相关的HTTP。 我的/etc/nginx/nginx.conf有这些行,包括其他的confs: include /www/conf.d/nginx/default.conf; include /etc/nginx/conf.d/*.conf; include /www/conf.d/nginx/*; default.conf如下所示: server { server_name 0.0.0.0; listen 0.0.0.0:80; rewrite ^ http://mymaintarget.com permanent; } 这对我不起作用。 我仍然得到这个警告: Restarting nginx: nginxnginx: [warn] conflicting server name "0.0.0.0" on 0.0.0.0:80, ignored 林相当肯定没有其他的服务器部分和default.conf是第一个包括/使用。 任何人都知道什么是错的,或者如何正确configuration默认服务器? 更新完整的configuration文件: nginx.conf: user www-data; worker_processes 8; pid /run/nginx.pid; events { worker_connections 768; } http […]

将nginx 1.4.4更新为1.4.5,试图覆盖X也是在包Y中

尝试升级时出现此错误: Preparing to replace nginx 1.4.4-4~raring (using …/nginx_1.4.5-1~raring_amd64.deb) … Unpacking replacement nginx … dpkg: error processing /var/cache/apt/archives/nginx_1.4.5-1~raring_amd64.deb (–unpack): trying to overwrite '/usr/sbin/nginx', which is also in package nginx-full 1.4.4-4~raring dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/nginx_1.4.5-1~raring_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 我正在使用这些回购: deb […]

NGINX不会将.php5parsing为.php

我已经用ISPconfig安装了nginx。 一切工作正常,除了一些网站,我已经从Apache服务器移植不幸有.php5扩展名,我不知道如何让Nginxparsing它们。 我已经尝试了许多解决scheme和变体,但仍然无法使其工作。 我会从文件中粘贴我的设置,如果有人有类似的经验,想分享,我会感激。 部分来自文件的设置: /etc/php5/fpm/php.ini cgi.fix_pathinfo = 0 在/ etc / nginx的/网站可用/默认 服务器{ 听80 default_server; 根/ usr / share / nginx / html; index index.html index.php index.htm; 位置 / { try_files $ uri $ uri / /index.html; } } 位置〜\ .php $ { #fastcgi_split_path_info ^(。+ \。php)(/.+)$; ##注意:你应该有“cgi.fix_pathinfo = 0;” 在php.ini中 # #单独使用php5-cgi: #fastcgi_pass 127.0.0.1:9000; […]

在nginx中禁用恢复下载function

有什么办法可以禁用在Nginx服务器的简历下载? 我想停止从URL example.com/media/恢复下载function,但我不知道如何做到这一点。 我也通过互联网search,但我找不到任何有关nginx的。 这是一个服务器configuration? 或者我应该做点别的? 这是我的服务器configuration: # sites-avalaible/default server { listen 80; listen 443 ssl; server_name www.example.com example.com; ssl_certificate /var/www/example/ssl/ssl.crt; ssl_certificate_key /var/www/example/ssl/ssl.key; location /static { alias /var/www/example/static; expires 7d; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } location /media { alias /var/www/example/media; # limit download speed after 5mb download limit_rate_after 5m; limit_rate 120k; […]

nginx上行超时。 多个服务器在同一时间

我有几台服务器为单个站点提供服务。 主服务器运行nginx和php-fpm。 所有其他服务器运行php-fpm。 运行nginx和php-fpm的服务器通过unix套接字连接,其他的通过tcp连接。 大概一个小时(不完全,有时更频繁),有一个奇怪的行为。 所有连接的nginx到php-fpm服务器超时。 它无法build立连接。 2014/03/24 04:59:09 [error] 2123#0: *925153 upstream timed out (110: Connection timed out) while connecting to upstream, client: <<client ip removed>>, server: www.example.com, request: "GET /some/address/here HTTP/1.1", upstream: "fastcgi://192.168.1.5:9000", host: "www.example.com", referrer: "http://www.example.com/some/address/here" 2014/03/24 04:59:09 [error] 2124#0: *926742 connect() to unix:/tmp/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to […]

Nginx地理封锁&允许局域网IP

我想阻止除了列入白名单的国家和局域网之外的地理区域IP。 第一部分完美无瑕,第二部分完美无瑕。 Somweheresearch互联网我发现代码LH(本地主机)和LN(本地networking),但他们都不工作。 我正在使用标准的代码阻止。 nginx.conf中的相关http {}部分: geoip_country /usr/share/GeoIP/GeoIP.dat; map $geoip_country_code $allowed_country { default no; US yes; } 站点中的相关服务器{}部分可用/默认: block countries if ($allowed_country = no) { return 444; } 我们欢迎所有的build议! 更新: $ geoip_country_codevariables在LAN IP访问上返回“ – ”,但添加“ – yes;” 到geoip_county块也不起作用。

在Nginx中,如何redirect到另一个域,但也保留path和子域?

所以,例如,我有一个域olddomain.com和newdomain.com 以下是我希望redirect请求的方法: sub.olddomain.com/hello/world -> sub.newdomain.com/hello/world olddomain.com/hello/world -> newdomain.com/hello/world 有很多子域名,所以理想情况下我不想为每个子域创build一个规则。 这似乎是一个解决scheme: server { listen 80; server_name olddomain.com *.olddomain.com; rewrite ^(/)(.*)$ http://newdomain.com/$2 permanent; } 但它不适用于子域名,因为所有子域名将redirect到newdomain.com/path而不考虑子域名。

WordPress – Capistrano权限问题

我正在用Capistrano和Composerpipe理WordPress安装。 一切都安装好,运行良好,在我的ngix / php-fpm设置上相当快。 不过,当我试图从pipe理区域更新插件时,我遇到了一个问题,WordPress要求inputFTP凭据。 一个快速谷歌,它清楚这是因为WordPress可以访问我的服务器上的Web服务。 我SSD到我的服务器,并做了以下几点: ps aux | grep 'nginx' nginx正在www-data用户下运行。 这很正常。 这是我的问题:使用Capistrano你创build一个deploy用户,并给他们无密码的sudo特权。 好的。 我做到了。 Capistrano运作良好。 问题是文件必须由这个deploy用户拥有。 为了做到这一点,我只是像这样: sudo chown -R deploy:www-data /srv/www/mysite.com 之后,我想确保所有新的文件和目录inheritance组的所有权: sudo chmod g+s /srv/www/mysite.com 这样,当capistrano添加新的文件,他们都inheritance了正确的权限。 我还将deploy用户添加到www-data组中,以避免我使用WordPress所遇到的问题。 我通过运行groups deploy确认这一点 当我recursion地将该目录chown到www-data:www-data一切工作正常。 我可以更新和从后端下载插件,但我不能部署与Capistrano。 我需要做什么nginx访问我的WordPress的安装和解决这个问题? 谢谢。

无法更改默认根位置

我有以下configuration文件: # /etc/nginx/nginx.conif # vim: ts=4 user nginx; worker_processes 1; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; 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 0; keepalive_timeout […]

为您的网站使用非EV SSL内容的EV SSL证书

如果我为从非EV SSL站点使用静态内容的站点购买EV SSL证书,是否会影响主www站点上的EV SSL证书演示文稿? 例如: www.example.com(使用EV SSL证书)static.example.com(使用标准的SSL证书) 如果CSS和图像是从static.example.com提供的,那么www.example.com上的用户是否仍然会看到带有公司名称的绿色栏?