我的nginx有一个error_page设置,会向PHP页面抛出500个错误。 我希望显示/logging导致此错误页面显示的任何PHP错误。 当我说显示,我的意思是显示在浏览器根据用户的凭据。 澄清:我想检索有关在PHP中发生的确切的错误的具体细节,不只是有一个错误。 这可能使用PHP5-FPM和nginx ?
我想在我的osx开发机器上configurationnginx(通过macports安装)。 我试图将代理本地主机:12346 /交易到一个websocket连接,可以在远程机器上的/ trade在端口12346上使用。 我正在使用下面的nginx.conf文件。 它在SSL SECTION被注释掉的时候有效,但是nginx在未注释的时候不能正常启动。 我已经在其他问题和答案这里,从其他网站build模conf文件。 我已经尝试了20种不同的方式,但只要取消注释任何SSL相关的行,nginx就不会启动。 worker_processes 1; events { worker_connections 20; } error_log /opt/local/etc/nginx/debug.log debug; http { include mime.types; default_type application/octet-stream; # # Some default configuration. # sendfile on; tcp_nopush on; keepalive_timeout 65; # # A list with load balancing backends hashed on IP for sticky load balancing. # upstream backend […]
我想在NGINX服务器块中从httpredirect到https。 在一篇相关的文章中,我尝试在下面的NGINXconfiguration文件中添加另一个服务器模块,但是得到了一个“冲突的服务器名称”警告,因为(大概) server_name的值不包括协议前缀: server { listen 80; listen 443 ssl; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; server_name sub.domain.co.uk; return 302 https://sub.domain.co.uk$request_uri; } server { listen 443 ssl; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; server_name sub.domain.co.uk; location / { root /home/saves/webapps/html/; index index.html; } location /api/ { […] } }
我需要基于文件扩展名和查询stringproxy_pass静态资产(.js .css)。 例如: domain.com/foo.css – 转到upstream1 domain.com/foo.css?V=1234 – 转到upstream2 原因是我有一个3服务器设置 – 路由器,应用程序服务器和静态服务器。 我想任何请求干净的urldomain.com/foo.cs去上游1(我的静态服务器configuration)。 以及任何具有查询stringurl domain.com/foo.css?V=1234的请求转到upstream2(我的应用程序服务器被configuration)。 也许可以使用http://wiki.nginx.org/HttpLuaModule完成? 谢谢!
我有sh脚本重新启动nginx,如下所示: #!/bin/sh -e set -e error_exit() { d=$(date '+%D %T :: ') echo "$d Error: $*" >&2 exit 1 } if ! sudo service nginx reload then # Exit with error error_exit "Could not reload nginx" fi echo "Deployment Done!" 但我的问题是脚本继续执行事件,如Reloading nginx configuration nginx [fail]并达到Deployment Done! 回声。 似乎情况总是true 。 那么,如果nginx重装失败,我怎么能停止执行bash脚本呢?
下面是我的负载平衡configuration。我的其他服务器包含基于nginx独angular兽的应用程序设置。 当我尝试以上configuration图像不加载。 我总共有三个服务器1负载平衡和其他2个应用程序。 有人可以帮我弄这个吗。 我完全感到震惊。 upstream backend { server ws1.10.10.1.1 fail_timeout=10; server ws2.10.10.1.2 fail_timeout=5; } server { listen 80; client_max_body_size 2G; server_name staging.xxxx.com; include /etc/nginx/mime.types; default_type application/octet-stream; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X_FORWARDED_PROTO $scheme; proxy_set_header Host $host; proxy_connect_timeout 3; proxy_read_timeout 60; proxy_send_timeout 60; proxy_redirect false; proxy_max_temp_file_size 0; if (!-f $request_filename) { proxy_pass http://backend; […]
我有一个专用的CentOS Web服务器(与Plesk 12),我正在尝试禁用SSL 3。 我到处都试图禁用SSL 3,并试图在其他post中详细应用此修复程序,但是当我重新testing(使用https://www.ssllabs.com/ssltest/analyze.html?d )服务器时,它仍显示SSL 3可用。 我去过我的服务器供应商,他们一点都没帮忙。 有人能指出我正确的方向吗? 我的/etc/nginx/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 /var/run/nginx.pid; events { worker_connections 1024; } http { include 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; […]
是否有可能限制在Nginx的身份validation到一个特定的用户名? 即我有多个子域,并希望限制该子域只有1个用户。 所有用户都在1 .htpassword文件。 在Apache中,你可以这样做: AuthType Basic AuthName "Restricted Files" AuthBasicProvider file AuthUserFile /usr/local/apache/passwd/passwords Require user rbowen 但是我一直无法在Nginx中find类似的方法。 这是我目前的Nginx设置。 我在每个服务器{}块中为每个用户提供了其中的一个。 auth_basic "Restricted"; auth_basic_user_file /usr/local/apache/passwd/passwords;
我为Nginx创build了映射规则以避免caching。 但是它不起作用nocache_map.conf(包含在http部分。 map $http_x_requested_with $nocache { default 0; XMLHttpRequest 1; } map $http_cookie $nocache { default 0; SESS 1; PHPSESSID 1; ~*wordpress_[a-zA-Z0-9-].* 1; comment_author 1; wp-postpass 1; _mcnc 1; } map $request_uri $nocache { default 0; ~*\/wp-admin\/.* 1; ~*\/wp-[a-zA-Z0-9-]+\.php 1; ~*\/feed\/.* 1; ~*\/administrator\/.* 1; } map $http_user_agent $nocache { default 0; ~*android|ip(hone|od)|windows\s+(?:ce|phone) 1; ~*symbian|sonyericsson|samsung|lg|blackberry 1; […]
这是我在nginx_conf文件中的服务器块: 我正在使用cloud66,所以我可以从我的仪表板进行编辑。 这不断打破。 我怀疑这是因为我的条件和声明。 我正在尝试将以下url转到以下url: http://subdomain.domain.com/notes.php并将其路由到/ dashboard将其路由到http://domain.com/dashboard http://subdomain.domain.com/contact-us.php并将其路由到/ dashboard将其路由到http://domain.com/contact-us/new http://subdomain.domain.com/help.php并将其路由到/ dashboard将其路由到http://domain.com/faq server { … # redirect old routes on subdomain server_name ~^www\.(?<domain>.+)$; if ($host ~ "^(.*)$domain") { set $subd $1; if $1 = 'notes.php'{ rewrite ^(.*) /dashboard permanent; } if $1 = 'contact-us.php'{ rewrite ^(.*) /contact-us/new permanent; } if $1 = 'help.php'{ rewrite ^(.*) /faq […]