Articles of nginx

在nginx服务器上安装SSL证书

我正在尝试在我的服务器上安装一个positivessl证书,但没有成功。 我开始在我的服务器上创build一个mydomain.key文件并请求证书。 我使用捆绑的文件 cat www_***_co_uk.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crt 我把这个file upload到我的服务器到home/piet目录。 这也是我的.key和.csr的地方。 现在我需要更新nginxconfiguration,对吧? 我正在使用从数字海洋的Drupal液滴安装。 在我的/etc/nginx/sites-enabled有 drwxr-xr-x 2 root root 4096 Apr 22 07:38 . drwxr-xr-x 5 root root 4096 Nov 25 18:45 .. -rw-r–r– 1 root root 16 Apr 22 07:38 default lrwxrwxrwx 1 root root 33 Nov 25 18:45 drupal -> /etc/nginx/sites-available/drupal 这里的默认文件是空的,所以我跟着链接。 […]

Nginx拒绝在/ home中读取新目录

我在CentOS6.6,安装了“Akeneo”,一切顺利。 安装在/home/pim所以nginx的实际位置就是app.php所在的web目录。 在/home/pim/web/app.php上做一个/home/pim/web/app.php显示: f: /home/pim/web/app.php dr-xr-xr-x root root / drwxr-xr-x nginx nginx home drwxrwxrwx nginx nginx pim drwxr-xr-x nginx nginx web -rwxrwxr-x nginx nginx app.php Nginx正在使用: user nginx nginx; worker_processes 4; 而PHP-FPM正在使用: listen.owner = nginx listen.group = nginx listen.mode = 0660 ; Unix user/group of processes user = nginx group = nginx Anyonan的想法,为什么这不工作? 我已经打了几个小时的权限了。 希望有人能指引我正确的方向。

Nginx SSL无法连接到网站

我刚刚为我的网站购买了SSL证书,并尝试使用我的nginx安装,但是uppon连接浏览器拒绝与网站的连接。 这是Vhost的相关部分: server { listen 80; listen [::]:80; server_name mysite.be www.mysite.be; return 301 https://mysite.be$request_uri; } server { listen 443 ssl spdy; listen [::]:443 ssl spdy; ssl_certificate /etc/nginx/ssl/mysite.be/www.mysite.be.pem; ssl_certificate_key /etc/nginx/ssl/mysite.be/mysite.be.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don.t use SSLv3 because of the POODLE attack # Enable OCSP Stapling, point to certificate chain ssl_stapling on; ssl_stapling_verify on; # […]

Nginx 301将httpsredirect到http

我有一个奇怪的问题,尾随/ 我正在使用nginx,它有一个小例外正常运行。 我有以下网站configuration server { listen 80; return 301 https://$server_name$request_uri/; server_name sub1.sub2.domain.com; } server { listen 443 ssl; # The ssl directive tells NGINX to decrypt # the traffic server_name sub1.sub2.domain.com; ssl_certificate /etc/nginx/ssl/sub1.sub2.domain.com/server.crt; # This is the certificate file ssl_certificate_key /etc/nginx/ssl/sub1.sub2.domain.com/server.key; # This is the private key file location / { proxy_pass http://1.1.1.1:8880; proxy_redirect off; […]

我怎样才能得到nginx反向代理与java小程序,检查文件库?

所以我试图用nginx设置一个反向代理到远程服务器上的Java applet,但是我遇到的问题是它检查文档库,我可以从http://remote.example.com/加载它http://remote.example.com/就好了,但是当我试图让它通过使用我试图使用的实际域的nginx运行, http://newdomain.example.com ,它会引发错误,因为文档库不是远程的。 有没有办法,我可以修改反向代理configuration传递http://remote.example.com/而不是http://newdomain.example.com/ ? 这是我的configuration到目前为止 upstream test { server remote.example.com:80; } server { listen *:80; server_name http://newdomain.example.com; location / { proxy_pass http://test; proxy_pass_request_headers on; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 180; proxy_send_timeout 180; proxy_read_timeout 180; }

为什么这个Nginx设置不caching响应?

我有Nginx坐在gunicorn前面,反过来坐在django应用程序的前面。 核心问题是“为什么我的回复没有被caching?” 但是,我非常青睐这个,所以这里是关于应该发生什么的假设(如果我的核心理解是有缺陷的)。 请求点击Nginx请求来自REST服务的某个json 。 Nginx在它的caching中没有这个,所以它传递给了Gunicorn/Django 。 生成一个响应,通过Nginx传回,在那里被caching,最后返回给客户端。 然后! 请求B进来要求相同的资源。 Nginx在它的caching中,因此直接服务它,永远不会碰到Django的应用程序。 基于这个假设,经过大量的阅读后,我终于在我的sites-enabled了这个最小的nginxconfiguration: proxy_cache_path /tmp/nginx keys_zone=one:20m inactive=60m; proxy_cache_key "$host$request_uri"; server { listen 8080; server_name localhost; proxy_cache one; location / { add_header X-Proxy-Cache $upstream_cache_status; proxy_ignore_headers X-Accel-Expires Expires Cache-Control; proxy_pass http://127.0.0.1:8000; } } 这段代码是基于nginxcaching的文档和这里的教程。 如果我testing一些请求,我得到这个回应: curl -X GET -I http://localhost:8080 HTTP/1.1 200 OK Server: nginx/1.4.6 (Ubuntu) Date: Wed, […]

如何在rpm安装过程中selectnginx版本

根据nginx.org关于如何通过.rpm安装nginx的说明,它说我应该这样做。 打开nginx.repo $ vi /etc/yum.repos.d/nginx.repo 粘贴下面的内容(对于CentOs7) [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=1 那么只需要yum install nginx 这工作,但它安装的主线版本,而不是稳定的。 截至目前我有1.8.0 [root@localhost ~]# nginx -v nginx version: nginx/1.8.0 所以,我的问题是,如何根据nginx.org安装当前在v1.6.3的稳定版本 2015-04-07 nginx-1.6.3 stable和nginx-1.7.12主线版本已经发布。

单个Nginx负载平衡器,用于2个不同的集群(web,api)

我想知道是否有可能使用单个Nginx服务器来负载均衡我的Web服务器和API服务器,如果两者都使用端口80.在这个设置中,将有5个服务器,1个Nginx和4个Apache服务器。 当访问web.example.com时,我希望Web服务器保持平衡。 同样的,我希望api服务器在api.example.com访问时保持平衡。 这是可能的还是我需要另一个nginx服务器?

Nginx和php-fpm的沟通问题

我有2个nginx服务器和4个专用的php-fpm服务器在上游configuration执行PHP 2个实例在上游我已经给每个php-fpm服务器的端口9000和9001 8个实例。 有时会发生什么情况nginx无法连接端口9000和9001的php-fpm,甚至当我从端口9000或9001的nginx到php-fpm服务器telnet时,它不能连接。 在nginx和php-fpm上应该启用什么types的日志来识别问题,以解决networking连接问题或服务器问题。 任何帮助将不胜感激。 谢谢

Nginx:如何使用uwsgi url服务器error_pages(404等)?

我知道可以在NGinx中使用error_page来服务静态文件,但是我想知道是否可以通过UWsgi提供的本地(插入式)Flask应用程序来服务URL。 这是NGinxconfiguration: server { listen 80; server_name www.myproject.com; access_log /var/log/nginx/myproject_frontend.access.log; error_log /var/log/nginx/myproject_frontend.error.log; # Something like : error_page 404 uwsgi_pass unix:/tmp/uwsgi_myproject.sock;/errors/404 location / { try_files $uri @yourapplication; } location @yourapplication { include uwsgi_params; uwsgi_pass unix:/tmp/uwsgi_myproject.sock; } } 这可能吗? 它会工作,而不是一个套接字,我会只允许本地(127.0.0.1)访问? 谢谢你的支持。