我在Ubuntu 14.04中有一个Nginx 1.4的服务器,它运行的是PHP5-fpm。 服务器在私有云服务器中有多个域和子域。 服务器从stream量中获得一致的点击量并且很多。 一切都很好,但Nginx经常返回404,而事实上并没有在实际的情况下,尝试之后,它返回的实际输出,而不是404。下面是我的一个从nginxconfiguration的服务器块的一个例子。 server { listen 80; #listen [::]:80; root /var/www/appfolder; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name domain-name; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to […]
考虑下面的nginxconfiguration。 我有两个节点js服务器分别在端口8008和9008上运行。 当我在8008取下服务器时,在access.log收到502错误。 我已经validation了9008上的服务器通过交换端口并重新加载configuration来工作。 为什么我会看到502错误? upstream backend { server localhost:8008 max_fails=1 fail_timeout=3s; server localhost:9008 backup; } server { listen 80; server_name app.domain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name app.domain.com; ssl_certificate ssl/chained.crt; ssl_certificate_key ssl/server.key; location / { proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto […]
我正在运行nginx版本:nginx / 1.10.2 我想调整我的默认configuration。 根据https://www.nginx.com/blog/tuning-nginx/我改变了操作系统中的somaxconn参数,并在nginx.conf中指定了相同的 所以我的nginx.conf看起来像 listen 80 backlog=16384; 但是,当我把backlog =放在nginx.conf中的时候,那么nginx不会以类似的错误开始 Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already […]
我已经写了一个NodeJS应用程序,它使用express和express-subdomain包来与域: api.localhost和localhost 。 我试图使用NGINX作为反向代理来处理对应用程序的请求,但是我的子域正在返回完整域的内容。 我有问题搞清楚是什么问题 – 有什么想法? 当我不使用NGINX和HTTPS时,它似乎能够正常工作; 但我希望这两个HTTPS没有购买通配符证书(现在我使用certbot,我认为需要一种方法来定义每个域的不同证书) 我的router.ts文件的router.ts应用程序: import * as express from 'express'; import * as subdomain from 'express-subdomain'; // See subdomain package import { UserRoutes } from './User'; import { AuthRoutes } from './Auth'; export class Router { static routeAPI(app) { const router = express.Router(); router.use((req, res, next) => { res.header('Access-Control-Allow-Origin', […]
运行时出现此错误: varnishlog -b -q'FetchError' – ObjHeader X-Frame-Options: SAMEORIGIN – ObjHeader Vary: Accept-Encoding – ObjHeader Content-Type: text/html; charset=UTF-8 – ObjHeader Content-Language: uk – ObjHeader Content-Encoding: gzip – Fetch_Body 4 eof – – Gzip Gunzip error: -3 (invalid code lengths set) – FetchError Invalid Gzip data: invalid code lengths set – Gzip GFE 0 20 80 80 […]
我有一些网站写在Laravel4和Nginx的networking服务器。 一切正常。 但是laravel应用程序有点慢,所以人们决定在另一个框架上重写它。 因为不能一个一个地改写所有的网站所以一部分做。 现在是testing新零件如何在实际负载下工作的时候了。 在那里我们面临的问题是: 如何指定使用另一个网站的位置特定部分的url? 例如,我们有:URL: http : //example.com/ * – 在主要网站路由在文件夹/无功/ www /网站和URL: http : //example.com/new/ *必须路由到网站在其他文件夹/ var / www / site / new_site / 怎么做? 我试过这个configuration: location /new { alias /var/www/site/new_site/; try_files $uri $uri/ @newsite; } location @newsite { fastcgi_pass backend; include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; } 但是这不是我所期望的。
我正在尝试用自定义模块构buildNGINX。 我克隆我想要使用的模块 。 然后我克隆NGINX 。 我改变目录到nginx/auto ,我尝试运行configuration脚本: sudo ./configure –add-module=/home/philip/projects/nginx-rtmp-module 我找回错误: ./configure: 10: .: Can't open auto/options 我在这里错过了一步吗?
我试图从NGINX中删除一个服务器,它可以正常工作: curl https://www.test.com/upstream_conf?upstream=servers\&id=5\&remove=1 但是为了部署,当我重新启动时,我需要这个完全相同的ID。 但它总是给服务器一个新的ID(最后一个ID +1)。 有没有办法通过API? 试了这个 curl https://www.test.com/upstream_conf?upstream=servers\&server=10.4.10.17\&add=1\&id=5 但它不工作。
我正在使用S3来存储xml文件并使用CloudFront来分发此文件。 我想使用nginx的proxy_passfind这个文件,而不用改变我的域名。 如www.mydomain.com/filename.xml该文件的S3 url是: https ://s3-ap-southeast-2.amazonaws.com/bucketname/bucket-sub-name/filename.xml CDNurl是https://dev.example.com/filename.xml如果我写下面的nginxconfiguration,它工作正常。 if($request_uri = "/filename.xml") { rewrite .* /bucketname/bucket-sub-name$request_uri break; proxy_pass https://s3-ap-southeast-2.amazonaws.com; } 但是,如果我改变像下面的nginxconfiguration,它给了我502坏的网关 if($request_uri = "/filename.xml"){ proxy_pass https://dev.example.com$request_uri; } 要么 if($request_uri = "/filename.xml"){ proxy_pass https://s3-ap-southeast-2.amazonaws.com/bucketname/bucket-sub-name$request_uri; } 有没有人可以解释为什么第一个工作和第二个和第三个部分不工作? 那是因为CDNconfiguration有什么问题吗? 那可以直接proxu_pass url吗?
是否有可能掩盖一些其他域名到我的域名内的HTML与Nginx,例如: <iframe src="https://example.com/embed/abcd" frameborder="0" width="640" height="450" scrolling="no"></iframe> 那么我想这样向我的用户展示 <iframe src="http://example2.com/embed/abcd" frameborder="0" width="640" height="450" scrolling="no"></iframe> 这可能与nginx有关吗? 我曾尝试通过使用nginx rewrite和proxy_pass但似乎不起作用。