Articles of nginx

Nginx上的Windows XP无效证书

我将我的SSL网站和证书从Apache迁移到Nginx,从那一刻起,所有的Windows XP客户端都不能识别SSL证书(这是Trustico颁发的通配符证书)。 以前的Apache服务器上的旧configuration是这样的: SSLEngine on SSLCertificateFile /etc/apache2/ssl/*_mysite.com.crt SSLCertificateKeyFile /etc/apache2/ssl/*_mysite.com.key SSLCertificateChainFile /etc/apache2/ssl/*_mysite.com.ca-bundle 而Nginx服务器上的新configuration是这样的: ssl on; ssl_certificate /etc/nginx/ssl/*_mysite.com.crt ssl_certificate_key /etc/nginx/ssl/*_mysite.com.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; ssl_prefer_server_ciphers on; Nginx不支持SSLCertificateChainFile参数,所以我读了我需要在* _mysite.com.crt下添加* _mysite.com.ca-bundle文件。 此后,除Windows XP之外的其他操作系统运行良好,但Windows XP仍然识别出错误的证书(它返回“证书错误”消息)。 我无法解决这个问题,你能帮我吗?

安装nginx&hhvm后无法运行apache

我在我的本地ubuntu机器上运行了Apache2,并在本地安装了nginx&hhvm,以便进行debugging。 我现在想像以前那样切换回Apache2,之前我已经运行了PHP5-FPM的Apache&NGINX,并且可以通过运行下面的代码来切换它们: sudo service nginx stop sudo service apache2 restart 现在,当我尝试访问我的Magento应用程序时,出现以下错误 /var/www/app/Mage.php was not found 我可以看到默认的Ubuntu Apache页面,当我去http:// localhost / 我试过跑步 ~:$ sudo service nginx stop ~:$ sudo service hhvm stop ~:$ sudo service apache2 restart * Restarting web server apache2 [ OK ] ~:$ sudo service php5-fpm restart stop: Unknown instance: php5-fpm start/running, process 12258 […]

随机(不是全部)页面上的502错误

几个星期前,我在Google网站pipe理员工具中注意到,我的一些url正在返回502。 一个这样的URL是http://www.sau.com.au/forums/topic/437438-around-the-bay-wrap-up/ 这个URL返回任何桌面皮肤的502,但在手机上(不同的皮肤) 请注意,它会很快返回502,这对我意味着这不是执行或某种forms的超时。 除此之外,网站上的所有其他url都可以。 唯一的日志条目是帮助这一个; 2015/06/29 09:33:39 [error] 19650#0:* 4431763上游过早closuresFastCGI stdout,同时从上游读取响应头,客户端:94.228.34.203,server:sau.com.au,请求:“GET /上传:“fastcgi:// unix:/var/run/php-fpm/php-fpm.sock:”,主机:“437438-around-the-bay-wrap-up / HTTP / 1.1” www.sau.com.au“,推荐人:” http://www.sau.com.au/forums/forum/100-victoria/ “ 我也重新启动了没有帮助的APC。 它只有1.5%的碎片。 我找不到任何限制条目。 该服务器是相当高的,所以PHP有很多的内存,请求大小,也很长的超时。 我尝试了以下,我阅读但没有差异。 fastcgi_buffer_size 10240k; fastcgi_buffers 4 10240k; 我不愿意做任何大的改变,因为这只是在一些页面上。 一个线程build议更新PHP到5.5。 我不知道现在去哪里寻求进一步的帮助。 我的下一步应该是什么? 一些信息; nginx version: nginx/1.6.2 PHP 5.3.3 (fpm-fcgi) (built: Oct 30 2014 20:14:56) 更新1 PHP错误日志没有写入它。 错误logging是启用,但; php_admin_value[error_log] = /var/log/php-fpm/www-error.log php_admin_flag[log_errors] = […]

我怎么能把snort放在nginx服务器的前面

我想防止对我的nginx服务器的攻击。 如何通过snort将请求代理到nginx服务器。 NFQueue的是一个解决scheme。我能够传递数据包snort使用以下规则 sudo snort -Q –daq nfq –daq-var –daq-var queue=1 -c /etc/snort/snort.conf 现在我已经创build了队列 sudo /usr/sbin/iptables -t nat -I PREROUTING -j NFQUEUE –queue-num 1 sudo /usr/sbin/iptables -I FORWARD -j NFQUEUE –queue-num 1 这是足够的,否则我们需要做一些除此之外的其他事情。 Nginx运行在与snort相同的系统中。

Nginx的。 在同一个端口上configuration两个站点

我正在尝试在我的服务器上添加一个维基媒体网站,该服务器上已经有另一个网站(不使用PHP)。 我想把它放在不同的文件夹,如www.hostname.com/wiki,但它有两个不同的conf文件,以避免混合的东西将是美好的。 目前我正试图把这个维基媒体网站放在不同的港口,81号,还有一些问题。 我的nginx.conf如下所示: 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 /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; keepalive_timeout 65; index index.html index.htm index.php; include […]

Nginx的:autoindex不工作

你好,我正在按照指南https://www.youtube.com/watch?v=7QXnk8emzOU和完全一样,我已经检查了其他类似的问题,如nginx的autoindex不工作和nginx的autoindex的问题 。 nginx的configuration文件: server { listen 80; #says to listen on standard port server_name _; #the default server location / { #location is the root of the site root /test/a/; #root is located at /test/a/ index index.htm; #index is for autocomplete autoindex on; #this way files will be autoindexed } } html文件位于/test/a ,一个是/test/a/index.htm ,另一个是/test/a/outdex.htm 。 […]

Nginx proxy_pass故障转移到一个url而不是服务器

我有一个端点通过Symfony请求我的数据库: api.domain.com:80/item/123 当请求这个端点时,Ngninx将代理把它传递给一个nodejs服务器,它能够从memcache中获取这个项目: 127.0.0.1:8000/item/123 如果在memcache中找不到该项目,则从另一个PHP端点获取: api.domain.com:80/item/db/123 它运行良好,但我不知道如何pipe理nodejs失败。 如果nodejs不再响应,我想忽略proxy_pass或使用第二个endpoind(/ item / db / 123)。 我的Nginxconfiguration是: upstream itemFromNodeJs { server 127.0.0.1:8000; } server { listen 80; server_name api.domain.com 127.0.0.1; location ~*\/item\/([0-9]+)$ { proxy_pass http://itemFromNodeJs; } 我试图添加一个备份服务器到上游: upstream itemFromNodeJs { server 127.0.0.1:8000; server 127.0.0.1:80; } 当然,它不能工作:当nodejsclosures时无限循环。 我唯一的解决办法是创build一个特定的服务器来从数据库获取数据: upstream itemFromNodeJs { server 127.0.0.1:8000; server 127.0.0.1:9000; } 但是我必须复制整个服务器:它远非优雅。 任何其他的想法?

Nginx“重写或内部redirect周期,而内部redirect到”/index.html“

所以这里是我的问题:我试图访问每个文件都有同样的问题。 它总是把我发回index.html或显示我500服务器错误。 错误日志给我:“重写或内部redirect周期,而内部redirect到”/index.html“ 这是我的configuration: server { listen 80; root /var/www; index index.php index.html index.htm; server_name _; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www; } # pass the PHP scripts to FastCGI server listening on the php-fpm socket location ~ […]

nginx垃圾邮件404错误

我的服务器被多个XXX域垃圾邮件,我的日志中有很多404错误,我无法find解决scheme来阻止。 2015/07/31 09:13:20 [error] 7070#0: *610 open() "/var/www/domain/mobile/www/www-sexvideo-shifuni.html" failed (2: No such file or directory), client: 162.158.252.53, server: m.domain.com, request: "GET /www-sexvideo-shifuni.html HTTP/1.1", host: "www.sextoysnmore.com" 正如你可以看到我有这些错误logging每秒.. 我试图把一个文件与糟糕的查阅者: map $http_referer $bad_referer { hostnames; default 0; # Put regexes for undesired referers here "~sextoysnmore.org" 1; } 和 if ($bad_referer) { return 444; } 但总是有垃圾邮件从这个域..或其他.. 任何人都有解决scheme? 谢谢 ;)

nginx – 只提供后端或404,没有静态文件的根

我试图用后端(在这种情况下uwsgi为烧瓶)提供所有请求,如果后端没有这样的path,nginx应该返回404。 不知何故,我只能使用后端来接pipe try_files $uri @uwsgi; 但这样,您可以访问根目录中的所有文件。 我不想在根目录中提供所有文件。 我也试过这个: try_files @uwsgi =404; 但是,即使path在我的烧瓶应用程序中定义,我也会得到一个404。 更多的上下文:Ubuntu 14.04,nginx 1.4.6 location @uwsgi { include uwsgi_params; uwsgi_pass unix:$document_root/myapp.sock; } location / { try_files $uri @uwsgi; } location /static/ { try_files $uri =404; } 烧瓶的应用程序是这样的: @app.route('/test') def hello_world(): return 'Hello World!' 所以当我访问example.com/test时,我想让烧瓶后端处理这个问题。 但我不希望nginx提供根目录中的所有文件。