我有多个在我的服务器上设置的nginx虚拟主机。 tershronalds.com运行的是vanilla wordpress 4.3,而staging.ninjawars.net正在运行一个自定义的PHP代码库。 两者都依赖于php5-fpm。 如果没有PHP错误或exception被触发,这两个网站似乎运作良好。 在tershronalds.com wordpress的情况下,有一些错误或例外,通常没有问题。 staging.ninjawars.net自定义PHP代码库使用auto_prepend_file来加载各种库: fastcgi_param PHP_VALUE "auto_prepend_file=/path/to/ninjawars/deploy/lib/base.inc.php \n session.cookie_domain=staging.ninjawars.net \n date.timezone=America/New_York \n default_charset=UTF-8 \n"; 但是,如果自定义php代码库出错或发生exception,nginx开始行为不端! 它开始共享虚拟主机之间的configuration,打破tershronalds.com WordPress的网站: 2015/09/04 13:37:58 [error] 13145#0: *17413 FastCGI sent in stderr: "PHP message: PHP Fatal error: Cannot redeclare validate_username() (previously declared in /path/to/ninjawars/deploy/lib/control/lib_auth.php:317) in /path/to/tersh/www/wp-includes/user.php on line 1792" while reading response header from upstream, client: […]
我有一个networking服务器背后的nginx和一切运作良好,除了一件事。 我试图确认一个亚马逊的SNS订阅,需要发布一些参数(与确认的url)到我的网站成为活跃之前。 我所有的尝试失败了,我认为这是用AWS比预期更长的时间…直到我打开nginx日志,看看是否有任何请求正在发送当我看到这个严重错误: [crit] 6#6: *13 SSL_do_handshake() failed (SSL: error:14076102:SSL routines:SSL23_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 54.239.98.103, server: 0.0.0.0:443 由于它很重要,它不会让请求去networking服务器,并确认我的SNS。 任何想法可能是什么原因呢? 另外,这里是我的nginx conf: worker_processes auto; error_log /dev/stderr info; user nobody nogroup; pid /tmp/nginx.pid; error_log /tmp/nginx.error.log; events { worker_connections 1024; accept_mutex off; } http { include mime.types; default_type application/octet-stream; access_log /dev/stdout; sendfile on; keepalive_timeout 65; gzip […]
我正在运行Ubuntu服务器。 这就是我所做的: 在/etc/security/limits.conf: * soft nofile 10240 * hard nofile 10240 并添加到/etc/pam.d/common-session: session required pam_limits.so 而nginx会自己configuration/etc/nginx/nginx.conf user www-data; worker_processes 1; #I have only 1 core pid /run/nginx.pid; events { worker_connections 10240; # multi_accept on; } worker_rlimit_nofile 10240; 但试图确认更改: root@ubuntu_ngix:~# ulimit -Hn 4096 root@ubuntu_ngix:~# ulimit -Sn 1024 我已经重新启动nginx,也是我的服务器,但仍然没有。 我在这里做错了什么? 我以www数据用户身份运行nginx。
我需要使用nginx将整个目录的内容redirect到另一个目录。 虽然我的configuration工作,但不幸的是也暴露了端口号。 这是我现在猜测一个副作用,因为特定域的入站stream量通过HAProxy ACL规则处理到8000端口,而URL本身是端口80。 这是我的nginx conf: server { listen 8000; port_in_redirect off; location ~* ^/data/dir1/(.*)$ { return 301 /data/dir2/$1; } … 它从URLredirect: domain.com/data/dir1 / … 至: domain.com:8000/data/dir2 / … 我怎么能摆脱URLredirect内的8000? 我有的tmp解决方法是把80redirect,但我担心,这将影响谷歌列出的url,因为它包括一个端口号。
我有以下情况:一个nginx为客户端提供静态文件。 对于请求,将在本地目录中search文件,如果找不到,则通过proxy_pass指令将请求转发到Amazon S3。 问题是,如果没有find文件,Amazon S3会返回HTTP 403,我想将该代码更改为客户端的404。 ( 作为一个方面说明,运行nginx的这台机器有权从S3中检索文件而没有任何凭据,并且工作正常 ) 我的configuration如下所示: user nobody; worker_processes auto; pid /run/nginx.pid; events { worker_connections 2048; multi_accept on; use epoll; } http { reset_timedout_connection on; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; gzip off; open_file_cache off; server { listen 8000 backlog=1000; server_name blablabla; # # Requests made to this server are in […]
我在我的NGINX服务器上遇到了一个奇怪的问题。 正如在Codex中所解释的,我把wordpress从我的根目录移到了一个子目录/ blog /。 它显示博客索引成功,但如果我想显示其他任何东西,如特定的职位或档案页面,它服务的根index.php 即使不存在的URL也作为根index.php 如果我删除根index.php它会返回一个404错误。 也许是由于我的nginx和fastcgi设置,但我真的没有任何线索: server { listen 80; listen [::]:80; root /var/www/html; index index.php index.html index.htm; client_max_body_size 10M; # Make site accessible from http://localhost/ server_name set $no_cache 0; if ($request_method = POST){set $no_cache 1;} if ($query_string != ""){set $no_cache 1;} if ($http_cookie = "PHPSESSID"){set $no_cache 1;} if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {set […]
我有一个集群负载平衡使用nginx与3后端HTTP服务器定义为上游服务器。 如果其中一个HTTP上游服务器引发HTTP 500错误,如何将nginxconfiguration为故障转移到群集中的下一个HTTP服务器?
我试图代理另一个Web服务器,在本地主机:20000,从Nginx。 这工作: location/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:20000 } 但是,如果我将其更改为: location /myApp { proxy_set_header.. 我只能加载index.html文件,所有其他的.css&.js 404。我可以在浏览器的头文件中看到,这些文件的请求是去mysite.com/jquery.js而不是mysite.com/myApp /jquery.js,所以我猜他们没有被代理,这就是为什么他们404。这些URL的path编码相对()。 我如何得到这个工作。 我无法更改代理index.html文件中的path。 谢谢 编辑。 后端web服务器是thttpd,它是古老的。 这会影响set_head主机吗? 对不起,我不太熟悉这个图层的工作原理。
在ubuntu 14.04的nginx / passenger / rails的EC2上有这个日志nginx: 应用程序31063 stderr: *错误* :不能执行/ usr / local / lib / ruby:权限被拒绝(13) App 31065 stderr:/etc/profile.d/rbenv.sh:line 3:rbenv:command not found nginx conf是: worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { passenger_root /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.18; passenger_ruby /usr/local/lib/ruby; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name teste.com; root […]
我希望任何人都可以帮助我或引导我正确的方向最近我搬到一个新的托pipe,并开始在我的nginx日志 2015/09/24 11:12:01 [notice] 6697#0: signal 10 (SIGUSR1) received, reopening logs 2015/09/24 11:12:01 [info] 6697#0: epoll_wait() failed (4: Interrupted system call) 2015/09/24 11:12:01 [notice] 6697#0: reopening logs 2015/09/24 11:12:01 [notice] 6693#0: signal 10 (SIGUSR1) received, reopening logs 2015/09/24 11:12:01 [notice] 6693#0: reopening logs 2015/09/24 11:12:01 [notice] 6694#0: signal 10 (SIGUSR1) received, reopening logs 2015/09/24 11:12:01 […]