有没有办法更改错误日志文件名称。 无论我在做什么,当请求得到处理时,我都会将错误日志写入默认文件名“error.log”。 我有一个全局的,只有一个错误日志configuration在主要情况下: user npcache; worker_processes 2; error_log /opt/logs/nginx/error1.log notice; pid /opt/logs/nginx/nginx.pid; events { worker_connections 1024; multi_accept on; } http { error_log /opt/logs/nginx/error.log notice; include ./mime.types; default_type application/octet-stream; #Access log configuration log_format main '"$remote_addr" "$host" "$http_host" ["$time_local"]' '"$request" $status $body_bytes_sent "$http_referer"'; access_log /opt/logs/nginx/access.log main; . . . } 通过这个configuration,我将错误日志写入/opt/logs/nginx/error.log而不是“error1.log”。 我在configuration中丢失了什么? 我发现这个问题与http上下文中的第二个错误日志有关,而这个错误日志是顶级的。 谢谢
我安装了Cockpit CMS,并且使用这个conf文件,我想要共享或访问的文件或子网站的每个实际文件夹都被解释为404页,我猜是因为这个部分: location / { try_files $uri /index.php$uri?$args; } 然后我需要指定每个链接和文件夹来启用访问。 这是有点约束。 你有避免这个问题的想法吗? server { listen 443 ssl; … server_name site.com; root /var/sites/_site.com/www; index index.php index.html; location / { try_files $uri /index.php$uri?$args; } location /cockpit { try_files $uri $uri/ /cockpit/index.php; } # Enable PHP with path_info location ~ ^(.+\.php)($|/) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(.+?\.php)(/.*)$; […]
我打算问主要的SO板,但是认为这个地方会更合适。 我想在我的主网站上使用cloudflare,然后使用nginx来反向代理一个目录到我的websocket游戏服务器。 NGINX服务器块 : location /Fonzy/ { proxy_pass http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } 上游区块 : upstream websocket { least_conn; server GAMESERVERIPHERE:9300; } 我的问题是,由于cloudflare网站将是一个不同于我的游戏服务器的服务器,上游仍然工作? 还是上游块服务器必须是本地地址? 我很好奇的原因是因为我想从cloudflare中获得“保护”,但是仍然希望隐藏我的游戏服务器(或者我应该说是反向代理)。
我是AWS新手,我有一个t2微型实例。 我只用它来用nginx来托pipe一个静态的网站。 真正奇怪的是公共ipaddress(我用于SSH)和eth0 ip地址不一样。 因此,当我在URL中使用我的ssh public ipaddress时,httpstream量没有到达服务器。 我没有使用任何习惯性的安全组织。 现在一切都是默认的。 当公网地址与eth0地址不同时,如何获得httpstream量到服务器? 或者我如何获得httpstream量到达我的服务器? nginx日志显示不能访问。
所以基本上我必须代理通过Web服务器的根@ / 但应用程序托pipe在 /ui 当他们没有手动input/ ui时,他们就会出现在服务器的主页上,这是静态的,没有被使用。 我想最初让Nginx把你移到domain.com/ui当你键入domain.com,然后基本上做它通常做的事,代理应用程序。
我已经在WordPress中设置了caching的nginx。 我正在使用https://wordpress.org/plugins/nginx-helper/ ,但似乎login页面正在被caching,当它不应该(因此显示login栏)。 一些没有login的访问者(也没有任何cookies /浏览器caching)正在看到login栏(如果他们点击栏内的任何东西,它会将其redirect到login页面)。 另外,当我单击WordPress中的清除cachingbutton时,页面仍然被提供并显示为XCache HIT …真正清除的唯一方法是使用rm -rf /dev/shm/nginx 。 我确实安装了以下模块: nginx version: nginx/1.8.0 built with OpenSSL 1.0.1f 6 Jan 2014 TLS SNI support enabled configure arguments: –with-cc-opt='-g -O2 -fstack-protector –param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' –with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' –prefix=/usr/share/nginx –conf-path=/etc/nginx/nginx.conf –http-log-path=/var/log/nginx/access.log –error-log-path=/var/log/nginx/error.log –lock-path=/var/lock/nginx.lock –pid-path=/run/nginx.pid –http-client-body-temp-path=/var/lib/nginx/body –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-proxy-temp-path=/var/lib/nginx/proxy –http-scgi-temp-path=/var/lib/nginx/scgi –http-uwsgi-temp-path=/var/lib/nginx/uwsgi –with-debug –with-pcre-jit –with-ipv6 –with-http_ssl_module –with-http_stub_status_module –with-http_realip_module –with-http_auth_request_module […]
我们有几个SEO页面,如: http://www.example.com/PageOne.html 我们在configuration中redirect如下: location = /PageOne.html { rewrite ^/(.*) /seo.php?id=1 last; } 问题是如果用户通过键入以下内容访问此页面: http://www.example.com/pageone.html 显示“找不到页面”错误。 有大约500多个SEO页面。 如何写nginx的规则忽略区分大小写的url? 我想为所有url的通用解决scheme。
我如何告诉Nginx基于传入的url将请求传递给不同的应用程序? 例如,mybudgetapp.com和myshoppingapp.com都指向我的服务器,其中应用程序(8001,8002)和Nginx(80)都在运行。 当用户访问mybudgetapp.com时,他们应该从8001上运行的应用程序获得响应。当用户访问myshoppingapp.com时,他们应该从8002上运行的应用程序获得响应。 这是一个接近我想要的例子: location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8001; } 我一直在阅读这个文档,但是术语却把我抛弃了。 http://nginx.org/en/docs/http/ngx_http_proxy_module.html Nginx是否是正确的工具,或者Apache会更适合?
我们正在用nginx提供一个web应用程序。 它将所有通过https传递给监听本地主机的服务器进行代理。 现在我想让nginx充当代理并从s3服务我们的css文件。 因为我想根据主机名来查询不同的文件(当总是提供相同的html内容时),所以不能直接从s3提供文件 这种情况下最好的做法是什么?
如果我使用的是Amazon的Elastic Load Balancer for Rails应用程序,那么是否需要在应用程序和ELB之间放置一个Nginx反向代理?