Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
WebSocket connection to 'ws://.../socket.io/' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
I am using nginx and proxying to my app that uses socket.io on node.js for the websocket connection.I get the error above when accessing the app through the domain.I have configured nginx according tohttps://github.com/socketio/socket.io/issues/1942to ensure that websockets are properly proxied to the node.js backend.M...
Turns out there was another reverse proxy in front of my server that I had no control of. Changed my server set up to be directly internet facing and it works as expected.
How to use try_files with 2 or more roots
I have looked hi and low and found no such implementation and am wondering if what I am trying is even possible. I have 3 relative paths that serve up static content:Path1: /usr/local/www/style1/static/... Path2: /usr/local/www/style2/static/... Path3: /usr/local/www/style3/static/...The 3 different roots are static u...
You could use a common root and try the three directories in thetry_filesstatement:location /static { root /usr/local/www; try_files /style1$uri /style2$uri /style3$uri =404; }
index.php as a parameter in the url of laravel website
I discovered that any laravel website is accessible with index.php as a parameter.This is a big problem, index.php in url parameter breaks all images. Look at a real example to understand what I mean:http://www.example.com/main-thing/sightseeinghttp://www.example.com/index.php/main-thing/sightseeingGooglebot read some ...
The problem could be fixed withnginx rewrite rules. Using the bellow rule redirect all urls withindex.phpparameter to theoriginal laravel route urllocation /index.php { rewrite ^/index.php(.*)$ http://$server_name$1; }Also I've put the follow to therobots.txtDisallow: /*index.php*
Unexpected token < with React Router & Nginx
Router configuration:const routes = [ { path: '/', component: Layout, onEnter: sessionFilter, indexRoute: { component: ActivityIndex, onEnter: sessionFilter }, childRoutes: [ { path: 'login', ...
I think the problem insrcpath of your JS file in script tag.Instead of, use:
Can't stop Gitlab's built-in Nginx
I'm using Gitlabs latest Omnibus-package on an EC2 Ubuntu machine.To refresh my SSL certificate (issued via Let's Encrypt) I need to stop Gitlab's Nginx so Let's Encrypt can verify that I possess the domain. Therefore I hitsudo gitlab-ctl stop.Thesudo gitlab-ctl statusafterwards is:down: gitlab-workhorse: 325s, normall...
For completeness sake what I ended up doing three years ago was what @user8215365 suggested. Simply invokingsudo gitlab-ctl stop nginxdid the trick.
Nginx Access Log To Kinesis
I am looking for a scalable solution. Nginx will server a pixel (1x1 gif) with a query string to an html page. This query string will be in the nginx access logs. I need to stream, or send this data to Amazon kinesis so that we can then process it later. I have done some reading about Logstash, Fluentd, Ect. Is anyone ...
This is definitely possible withFluentd. Amazon published its own plugin for AWS Kinesis. Fluentd has a feature to tail the nginx logs. Please check the URLs below.http://docs.fluentd.org/articles/kinesis-streamhttp://docs.fluentd.org/articles/in_tailhttps://github.com/awslabs/aws-fluent-plugin-kinesis
Any way to run byebug under passenger + nginx?
I developed a simple rails app which works in development environment under WEBrick. However, when I move to production environment it doesn't work. I fixed trivial errors relating to assets and things. However, some things just don't work. It would be extremely helpful to be able to see what is going on interactively ...
Passenger author here. Byebug integration is available in Passenger Enterprise:https://www.phusionpassenger.com/library/admin/nginx/debugging_console/ruby/
Nginx not returning custom error pages from if expression
It's my CDN and conf file contain "few lines".The situation is really strange:In configuration i haveerror_page 403 = /e403; error_page 404 = /e404;andlocation =/e403 { default_type text/html; return 403 "somehtml403"; } location =/e404 { default_type text/html; return 404 "somehtml404"; }Same time i ha...
I can replicate the problem when the$ifstatements are directly inside theserverblock, but it works correctly when they are inside a top-level location block. This worked for me:location / { if ($args !~ ^$){ return 404; } if ($request ~* (^.*\?.*$)){ return 404; } }Of course, if you have other location ...
Rails app migrating to AWS Elastic Beanstalk :: Bad Gateway (502)
So I'm migrating from Heroku to AWS Elastic Beanstalk and testing out the waters. I'm following this documentation:AWS Docs :: Deploy Rails app to AWSHowever after following the documentation I keep receiving a Bad Gateway 502 (error).Here's the specs of my app:Rails 4.1.8Ruby 2.1.7Server PumaSo I checked my/log/nginx...
Got it.In my 'production.rb' I had a force_ssl setting and I didn't set up SSL yet since I was just starting out.
AngularJS $http.post() to another port at the same machine
I have an AngularJS app hosted in nginx server at localhost and Rest service hosted in Weblogic at localhost:7001.I'm trying to do this post inside of Angular part:$http.post('localhost:7001/testApp/user/login', { username: username, password: password }) .success(function (response) { callb...
You should specify the protocol scheme (http,https, ...) in the URL:$http.post('http://localhost:7001/testApp/user/login', { username: username, password: password }) .success(function (response) { callback(response); });
nginx - ungraceful worker termination after timeout
I plan to use nginx for proxying websockets. When performing nginx reload / HUP , I understand that nginx waits for the old worker processes to stop processing all requests. In websocket connection however, this may not happen for long time as the connection is persistent. Is there an option / roadmap to forceibly kill...
Unless you have either solution: proxy_read_timeout 1d or a ping message to keep connection alive, Nginx closes connections in 60sec otherwise. This default value was chosen by a reason.See what Nginx core developersays:There is proxy_read_timeout (http://nginx.org/r/proxy_read_timeout) which as well applies to WebSo...
How to modify $uri to part of uri from request_uri in nginx?
Suppose the value of $request_uri is /a/b/c . The current value of $uri is /index.php . Is this possible to change my $uri to /b/c .I have tried this, which doesn't seem to be working,if ($request_uri ~* /a/(.*)/(.*)){ set $uri /$1/$2; }But this gives error ofduplicate "uri" variable. I also tried,if ($request_uri ~*...
I managed to do it fromhere.It basically needed two rewrites.rewrite ^ $request_uri; rewrite /.*/(.*)/(.*) /$1/$2;The first rewrite modifies uri from/index.php -> /a/b/c.The second rewrite modifies uri from/a/b/c -> /b/c.
Not able to access Server-Sent-Events over Mobile 3g Network
I am having an issue with Server Sent events. My endpoint is not available on mobile 3G network.One observation I have is that a https endpoint like the one below which is available on my mobile network.https://s-dal5-nss-32.firebaseio.com/s1.json?ns=iot-switch&sse=trueBut the same endpoint when proxy passed using an n...
I suspect the mobile network is forcing use of an HTTP proxy that tries to buffer files before forwarding them to the browser. Buffering will make SSE messages wait in the buffer.With SSE there are a few tricks to work around such proxies:Close the connection on the server after sending a message. Proxies will observe ...
How do I set up Nginx rewrite rules in a config file generated from PuPHPet?
Example from "config.yaml" file:locations: ... some_location_root: location: / try_files: - $uri - '@rwr' some_location_rewrite: location: '@rwr' rewrite: '^(.*) /index.php?_controller=$1 last' ...
I found the solution here:https://github.com/jfryman/puppet-nginx/blob/master/spec/defines/resource_location_spec.rbrewrite: '^(.*) /index.php?_controller=$1 last'Should look like:rewrite_rules: ['^(.*) /index.php?_controller=$1 last']
Nginx, Unicorn and Rails = 502 Bad Gateway
Im trying to setup Nginx, Unicorn and Rails application to work together. Nginx and Nnicorn are running, I checked that using ps command.But when trying to access my page Ive got 502 Bad GatewayNginx error log has line:2015/03/18 19:53:26 [error] 14319#0: *1 connect() to unix:/var/sockets/unicorn.mypage.sock failed (...
I solved the problem.It was because of my unicorn server started in development environment, not in production. Unicorn was trying to connect to development database, but credentials for the dev db in database.yml were missing. After I started unicorn in production env everything connected well.
Websites hosted on Amazon S3 loading very slowly
I have an application which is a static website builder.Users can create their websites and publish them to their custom domains.I am using Amazon S3 to host these sites and a proxy servernginxto route the requests to the S3 bucket hosting sites. I am facing a load time issue.As S3 specifically is not associated ...
S3 HTTPS access from a different region is extremely slow especially TLS handshake. To solve the problem we invented Nginx S3 proxy which can be find over the web. S3 is the best as origin source but not as a transport endpoint.By the way try to avoid your "folder" as a subdomain but specify only S3 regional(!) endpoin...
Have nginx call an external script (passing request info) while serving static file?
I'm setting up download logging on a server that hosts podcast recordings. We just want to easily log into MySQL the files downloaded with the timestamp and requesting IP address.As these files average at least 150MB, I figured using readfile() would be a bad idea (don't want PHP running the entire time the file is dow...
Yes, you can usehttp://wiki.nginx.org/HttpLuaModulelocation /file { content_by_lua 'os.execute("php cli.php ',ngx.var.remote_addr,'")'; }Not sure about the syntax passing IP but smth like this should work. You can also parse log file
How to get the port number of client request with AWS ELB using TCP and Nginx on server
While using HTTP/HTTPS as load balancer protocol we get the requested origin protocol (i.e. it is HTTP or HTTPS) fromx-forwarded-protocolheader. Now, using this header in nginx configuration it can be determined that whether the originating call was from HTTP or HTTPS and action could be performed accordingly.But if t...
You have a couple of options, at least:Option 1 is not to send both types of traffic to the same port on the instances. Instead, configure the application to listen on an additional port, such as 81 or 8080, and send the SSL-originating traffic there. Then use the port where the traffic arrives at the instance, to di...
Http basic auth with nginx on different port
I've got a website with a reverse front-end proxy in which my app listens on port 3000. I've got another app that sits on 3001 which is part of the same directory that serves the contents for the site on port 3000.What I want to do.Anyone going tomydomain.com:3001would be prompted forauth_basiccredentials. Anyone going...
You need to create differentserverformydomain.com:3001andmydomain.comupstream app_tools { server 127.0.0.1:3000; keepalive 64; } server { root /var/www/example; listen 0.0.0.0:80; server_name mydomain.com; access_log /var/log/nginx/app_example.log; location / { pr...
How to map URL to port and modified URL?
How do I map www.somesite.com/api(.*) to www.somesite.com/$1:9000? (I need to map /api to Play framework application running @ port 9000)I did the following:$HTTP["url"] =~ "^/api" { proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 9000 ) ) ) }This gets me to somesite.com/api:9000 when I go to somesi...
It is easily accomplished using Nginx:location /api/ { rewrite ^/api(/.*)$ $1 break; proxy_pass http://localhost:9000; }
Rails Internationalization: Setting the Locale from the Domain Name
I'm trying to implement internationalization on my rails app. Here's part of my application controllerbefore_action :set_locale def set_locale I18n.locale = extract_locale_from_tld || I18n.default_locale end def extract_locale_from_tld parsed_locale = request.host.split('.').last I18n.available_locales.include?...
your question is not very structured, i will try giving some hints never the less.if you want to have a look at a working example for locales and domains have a look atthe onruby project. it's a multitenant application where each tenant can configure his own domains and default locales.this is the way that it is implem...
Setting expires for dokuwiki lib directory on nginx stops processing .php files
I'm trying install DocuWiki script on nginx web server. Documentation says that I need to put following directive at nginx config file:location ^~ /lib/ { expires 30d; }When I try to add this, nginx stops sending .php files from lib directory to php-fpm, and send it to me like octet-streams for download. How can I c...
Here is the working configuration:location ~ ^/lib.*\.(gif|png|ico|jpg)$ { expires 30d; }
Sitecore with DMS vs caching server - how do you handle it?
We're planning to introduce DMS to our customer's Sitecore installation. It's a rather popular site in our country and we have to use proxy caching server (it's Nginx in this case) to make it high-traffic-proof.However, as far as we know, it's not possible to use all the DMS features with caching proxy enabled - for ex...
You might try moving away from your proxy caching for some pages, or even all.There's no reason not to use a CDN for static assets and media library assets, so stick with thatLeverage Sitecore's built-in html cache for sublayouts/renderings - there are quite a few options for cachingUse Sitecore's Debug feature to trac...
Nginx Change Request from PUT to POST
I'm using nginx for a PHP REST API that I'm working on. To be fully REST-ful, I'm usingPUT/DELETErequests where appropriate. However, PHP doesn't parse the post body onPUTrequests - which I need for this particular scenario.I had considered parsing it myself, but a) I'd rather let PHP do it in C as it's considerably fa...
Nginx only informs FastCGI of the request method viaREQUEST_METHODparam. So you may simply override the value and report anything you want to PHP. You'll have to declare another variable in your Nginx configuration, let's name it$fcgi_method, based on the original request method:map $request_method $fcgi_method { def...
Throttling upload and download speed optionally either in Django or in nginx
I need to throttle upload/download speed based on whether a user is logged in or not for my application. I'm using nginx and Django. Is there a way for me to do this?
This is the job of a load balancer instead of django or nginx.You can setup two zones with nginx and limit the bandwidth on one and not on the other. You can direct logged in users to the unlimited zone on nginx and anon users to the limited zone.This module lets you limit on a per-ip basis:https://github.com/trbs/Ngin...
How to configure nginx for Amazon ec2
I saw example configurations ofnginx, most of them use example.com as aserver_nameanduwsgi_passsimilar tounix:/var/www/run/blog.sock;or in combination with ip/port address. but what should I use in case of amazon ec2 instance, since it has long public name, ip is private and if I restart my instance it gets different p...
Theserver_namedirective is useful in cases where you want to host different sites on the same server, and handling them differently depending on the "Host" header field (ex: mysite1.com => a PHP website, mysite2.com => a django website,...) It's actually a virtual server (see also [the server directive])1.Fromthis arti...
104: Connection reset by peer: nginx + rainbows + over 1 mb uploads
I am running ThreadPool rainbows + nginx (unix socket)On large file uploads I am getting the following in nginx error log (nothing in the application log):readv() failed (104: Connection reset by peer) while reading upstreamThe browser receives response:413 Request Entity Too LargeWhy does this happen?"client_max_body_...
Turns out Rainbows had a configuration option calledclient_max_body_sizethat defaulted to 1 MB The option isdocumented hereIf this options is on, Rainbows will413to large requests silently. You might not know it's breaking unless you run something in front of it.Rainbows! do # let nginx handle max body size client_...
nginx fastcgi configuration for CGI::Application app
I am trying to get a C::A app work in nginx fastcgi environment (debian 6.0) and using spawn-fcgi.C::A route is configured using$self->mode_param( path_info=> 1, param => 'rm' );the problem is that whatever C::A app urls (example.com/cities,example.com/profile/99etc ) I am requesting, it always displays the homepage w...
I ended up solving the problem with a workaround in my C::A app. And I am documenting it here.So I didn't managed to have nginx pass along thePATH_INFOdown to my C::A app. To work around this, I set thePATH_INFOwith the value ofREQUEST_URIin my C::A app so it picks up the correct runmode.Also, nginx isn't passingQUERY_...
aws, django, unicorn and s3 - do I need nginx then?
I'm building app in django which I want to deploy on aws ec2 server. The app will run on gunicorn, and I want to place static files on s3. So my question is - do I need to use nginx at all?Is there any other benefit of using nginx beside serving static files?Arek
Putting nginx in the front of your stack not only allows you to route static content requests to your s3 storage but also give you the ability to do things like caching your django requests and lower the hits in your app and database. You can set up fine grain cache policies and have more control of exactly where reque...
Right place for Sequel DB connection while working on Phusion Passenger with nginx
I have test app written on ruby, using Sinatra+Sequel.config.ru:require './main' run Sinatra::ApplicationExample code:require 'sinatra' require 'haml' require 'sequel' DB=Sequel.connect('oracle://test:test@test') class Tarification < Sequel::Model(DB[:test_table]) end get '/' do haml :index endEverything was al...
This issue is documented inAppendix C.3of the Phusion Passenger manual. The usual method is to hook into the post-fork callback and re-establish the connection there.
nginx gzip_static won't create the gz file that doesn't exist automatically?
I'm just curious...nginx will detect the gz files in the same dir,if it does not exists,it will use on-the-fly gzip and return a response(if gzip on)so...when we turn gzip_static on,why nginx not to create a gz file with the output gzipped response?it's about trunked encoding or something else?So do I really need to wr...
You're right, as far as i can tell the two modules (gzip and gzip_static) don't really interact. Anything compressed on the fly by gzip will possibly be cached for a short period of time, but will not be saved for gzip_static. A bash script to automatically update the .gz files is a good idea, and if you're using sourc...
session_name breaks my site?
After reading through the PHP manual, I addedsession_name('mysite');to my code to ensure that collisions between sessions won't happen if I will run multiple apps in the future.Unfortunately thesession_name()-function call it kills my site completely . A fatal error is thrown (which appears in the error logs, but doesn...
As pointed out in the comments on thesession_name doc page, there are some issues w/ session_name that can cause your site to break:Make sure that you callsession_namebefore anything else, includingsession_startMake sure there are no periods in your session name (i.e.: don't use "mysite.com" as your session name)
Proxying HTTPS requests with sc-server
I don't seem to be able to proxy an https (SSL) request with sc-server. The server keeps saying REDIRECTING TO, but I get no results whatsoever, because the request gets canceledI hope there is some configuration possible.
There is an option for HTTPSproxy '/path', :to => 'server', :https => true
Can I host node.js and Django in one server?
I only have one VPS hosting and using nginx for Django web application. Now, I prepare to start new app with Node.js and can I host on current Server ? I think, Node.js is running the own http server and it can conflict with nginx server.
You can host multiple http servers on single VPS. Conflict will happen only if both, nginx and node.js, are bound to the same port. For example if your nginx web server is listening on port 80, then your node.js http server should listen on other than 80, lets say port 8080. You can also set upreverse proxy(in case you...
How to detect support for .htaccess in PHP on Apache server (and other servers)
For security reasons, I need to check if a directory is not readable by a client,i.e.that the Apache server supports the.htaccess(noAllowOverride Nonein the apache configuration files). This is very important as I have recently discovered that a LOT of products and framework are not checking this (including Zend and Sy...
You could useSetEnvIfin htaccess to set a variable, and then access it from within PHP. That will tell you if htaccess is being used (and the SetEnvIf module is running). But it won't tell you much more - it won't tell you if mod_rewrite is available, for example. To tell what modules are running, you could check the o...
Monitor Multiple Pylons Application
Are there any tools that I can run on my server to monitor multiple Pylons applications?I need to monitor the number of requests each application receives, how much memory each application is using, how much of the cpu is being used and other stats similar to those. I need to see the stats for each individual Pylons ap...
You probably want to use something like Zenoss.There is some specific nginx integration graphs here:http://community.zenoss.org/docs/DOC-7441
How to customize AccessDenied page of MinIO?
When the expiration date of MinIO links passes, It responds to an XML like this: AccessDenied Request has expired key-of-the-resource bucket-name /path-to/teh-resource 16FC78B1C6185XC7 5d405266-91b9-XXXX-ae27-c48694f203d5 Is there any way to customize this page by some sort of configuration inside the MinIO? I didn't f...
Assuming your 403 error returns with theContent-Typeheader being set totext/xml, you can transform this XML response to the HTML with the nginx usingXSL Transformations. To do it you'll need theXSLT module, and you should be aware this module is not built by default, it should be installed additionally as a dynamic mod...
The Streamlit app stops with "Please wait... " and then stops
ProblemThe app started by runningstreamlit run main.pywill displayhttp://IP_ADDRESS:8501is displayed correctly, buthttp://DOMAIN_NAMEstops with "Please wait... " and stops.EnvironmentDomain name already resolved with Route53Deploy Streamlit App on EC2 (Amazon Linux) and runStreamlit run main.pyon TmuxUse Nginx to conve...
Try the following conf:server { listen 80 default_server; server_name MY_DOMAIN_NAME; location / { proxy_pass http://127.0.0.1:8501/; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; pro...
Mirror requests from cloudrun service to other cloudrun service
I'm currently working on a project where we are using Google Cloud. Within the Cloud we are usingCloudRunto provide our services. One of these services is rather complex and has many different configuration options. To validate how these configurations affect the quality of the results and also to evaluate the quality ...
If your Cloud Run service are internally accessible (ingress control set to internal only), you need to perform your request from your VPC.Therefore, as you perfectly did, you plugged a serverless VPC connector on your NGINX service.The set up is correct. Now, why it works when you route ALL the egress traffic and not ...
keycloak dynamic client registration registration_client_uri docker hostname override
I have successfully created a client inside Keycloak using Dynamic Client RegistrationThe response body contains:"registration_client_uri":"https://127.0.0.1:8443/auth/realms...",This is because Keycloak is installed with Docker, and is fronted by NginX. I want to replace the IP address/port with the actual public host...
Configure env variablePROXY_ADDRESS_FORWARDING=true, because Keycloak is running behind Nginx reverse proxy -https://hub.docker.com/r/jboss/keycloak/Enabling proxy address forwardingWhen running Keycloak behind a proxy, you will need to enable proxy address forwarding.docker run -e PROXY_ADDRESS_FORWARDING=true jboss/k...
How can I set up a reverse proxy for the Janus REST api and socket api in Nginx?
I have a Janus Gateway which exposes a REST api on port 8088. The web socket transport is also enabled on my janus server on port 8188. I have an Nginx reverse proxy set up for https traffic to reach my Janus server. How do I add wss support to my Nginx reverse proxy? Here is my config file "janusserver5.example.com"...
By default, the Janus REST api is at the /janus endpoint. To allow Nginx to proxy for the web socket and REST interfaces, create a location entry for /janus that passes to http://yourip:8088/janus and a second one for / that passes to http://yourip:8188.server { server_name janusserver5.example.com; location /janus ...
How to find out the errors behind a lot of non-2xx or 3xx responses when load testing nginx reverse proxy with wrk
We are doing some test with NGINX as reverse proxy in front of two NGINX sample web servers. The tool being used in our tests iswrk. The web servers' configuration are very simple. Each of them has a static page (similar to default welcome page) and the NGINX proxy is directing traffic in a round robin fashion. The aim...
After some research, I was able to track this down withtcpdumpon the proxy node like below :After running wrk on the proxy, I ran tcpdump like below :tcpdump -i ens192 port 80 -nnAnd the result - though quite big - had some interesting insights :10:53:33.317363 IP x.x.x.x.80 > y.y.y.y.28375: Flags [P.], seq 389527:3898...
$ssl_early_data from nginx: should the application use it somehow?
I'm preparing to turn on nginxssl_early_datato enable RTT-0 with TLS 1.3.I understand that, if I don't do it right, replay attacks become possible. I understand that, to prevent this, you need to also use$ssl_early_dataRequests sent within early data are subject to replay attacks. To protect against such attacks at the...
You are correct that this header itself doesn't do anything, you need additional logic in your PHP application.In my case I'm using a fastcgi variable rather than a header:fastcgi_param TLS_EARLY_DATA $ssl_early_data;Then in PHP you need to perform a check for any request that is at risk for a replay attack:if ($_...
Docker compose error: nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:21
Trying to run nginx and web application via docker composedockerfileFROM node:12.16.2 as build RUN mkdir /app COPY package*.json ./ RUN npm install COPY . /app RUN npm run-script build COPY --from=build /app/build /var/www/roundmap.app EXPOSE 3000nginx config defauls.confserver { listen 80; listen 443 ssl; l...
In yourdefault.confreplacehttps://app:3000byhttp://app:3000as SSL termination is happening at Nginx itself, app is still using http.Update yourdocker-compose.yamlUsedepends_oninstead oflinks, it has deprecated.version: "3.8" services: app: build: roundmap/ container_name: app command: [ "nod...
How to cleanly stop containers from restarting Kubernetes
I want to create a nginx container that copies the content of my local machine /home/git/html into container /usr/share/nginx/html. However I cannot use Volumes and Mountpath, as my kubernetes cluster has 2 nodes. I decided instead to copy the content from my github account. I then created this dockerfile:FROM nginx CM...
You need to useRUNto perform commands when build a docker image, as mentioned in @tgogos comment. See therefer.You can try something like that:FROM nginx RUN apt-get update && \ apt-get install git RUN rm -rf /usr/share/nginx/html && \ git clone https://github.com/Sonlis/kubernetes/html /usr/share/nginx/html C...
nginx returns index.html content for all Angular files (including scripts)
I have set up a solution of an Angular (v9) application that is being built as a Docker image (with nginx as webserver) and deployed to Kubernetes. Everything works, except that for each request, both for the root application itself as well as its javascript files I receive the content of the index.html.My nginx config...
Well, as it turns out, it had nothing to do with nginx. The ingress element was configured incorrectly which rewrote every request to "/" and thus every request returned the default page (= index.html).In more detail, I had the following configuration in spec.rules (note the last lines)http: paths: - backend: ...
Visiting Any URI other than Root Resulting in 404 - nginx
I have a URL in the form ofwww.example.com, and am using nginx as the web server. When I go towww.example.com, the site works fine, however whenever I go towww.example.com/anyUri, I receive a 404. Here is the location element in my sites-available file:location ~*/(.*) { try_files $uri $uri/ = $404 ; }The website i...
Thisnginx.conffile is what I have been using - works like a charm for me.server { listen 80 default_server; listen [::]:80 default_server; root /your/web/root/path/nginx/html; index index.html; location / { # Adds support for HTML5 history mode try_files $uri $uri/ /index.html; # -or- # try...
Why try_files directive missing slash between root and filename?
I'm trying to set up Nginx to work as reverse proxy, but also handle single static page (greeting) by its own:root /usr/share/project/; location = / { try_files index.html =404; }This config always return 404. When I tried to figure out what exactly happens I rewrite try_files directive to make it fail:try_files in...
rootcan optionally take a trailing/- it doesn't matter and it is ignored.Thefileelements of atry_filesstatement (as with all URIs in Nginx) require a leading/. Seethis documentfor details.For example:root /usr/share/project; location = / { try_files /index.html =404; } location / { proxy_pass ...; }This works b...
Configuring Nginx and Gunicorn for DRF, Django and React Frontend
I have an application whose frontend is in React and the back-end is in Django with API's developed using DRF for the front-end. Now I am using Nginx as the web server along with Gunicorn. The following is my Nginx conf file in sites-available:server { listen 8000; server_name localhost; location = /favicon....
I suspect the issue is that Django is rejecting the API requests with a 400 response because of a mis-matchingHostheader. Those ajax requests are probably using127.0.0.1for theirHostheader, whereas you're initiating the main page usinglocalhost.You should tell Nginx to set the header in the location configuration for/n...
Nginx configuration for multiple static sites on same server instance
I have three static sites. I am using Vue 2 and running build for each folder.I want to host all three static files on the same server instance. Right now I don't have domain so i want to host on server's IP itself.I have folder in html/www folderfirst_folder second_folder third_folderAll the above three folders have i...
The pathname of the requested file is constructed by concatenating the value ofrootdirective with the URI. So you can only userootwith subfolders if (for example)second_pathandsecond_folderis actually the same name. Seethis documentfor details.For example:location /foo { root /path/to/root; }The URI/foo/index.htmli...
How to add .conf files to Pycharm
I am running a Django Project in PyCharm and deploying it to EC2 in AWS. The guide tells me to use nginx I have to create a file callednginx_someName.confhowever no matter how much I try I can't get create a.conffile and write in it. I tried to download Scala to Pycharm using the question belowIntelliJ IDEA plugin to f...
Click this button as shown on the screenshot:
Nginx config overwrites during beanstalk deployment
I tried changing nginx config usingAttempt 1.ebextensions/000_nginx.configcontainer_commands: 01_reload_nginx: command: "sudo echo 'underscores_in_headers on;' >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf"andAttempt 2.ebextensions/000_nginx.configfiles: "/tmp/proxy.conf": mode: "000644" own...
I had a similar issue before. It might be because you are zipping and uploading the whole project folder instead of just the project folder contents
Django Channels Along with uWSGI
I currently, Django rest api which is developed using docker, nginx, uWSGI, redis, Django & Angular.I am adding couple of websocket endpoints, I would like to keep the existing architecture and keep serving http requests via uWSGI & nginx. And use Django channels (with nginx) for web-socket connections.Is that possible...
Yes, just make sure paths in yoururls.pydo not overlap with routing from yourCHANNELS_LAYERCHANNEL_LAYERS = { "default": { # ... "ROUTING": "websockets.routing.channel_routing", }, }
nginx proxy_pass to all pages
So I am using nginx to reverse proxy to another server. This wasn't serving static files, until I linked them in the location. The location block is super long, but looks similar to the code below. I'm sure that I'm doing this the wrong way, but it works, it's just tedious to write all the paths. I'm wondering if there...
You should use following codelocation / { # First attempt to serve request as file, then # as directory, then fall back to proxy try_files $uri $uri/ @proxy; } location @proxy { proxy_pass www.example.com; }
Audio mp3 stream from static server NGINX
I have my web application which has many audio files. I have kept these files on my Nginx server.On my HTML page, I am usingaudio tag. My question is when my HTML page loads on the web browser then do all the audio files will get downloaded at the same time? Or when the user plays particular audio file, then only that ...
A given media file will only get downloaded after you have clicked on a linkYou can confirm this yourself by getting onto your page in question then hit F12 or ctrl-shift-i in your browser (firefox/chrome/opera) to open up your developer tools then hit the Network tab which will display network traffic ... once there d...
Docker + Gunicorn + Nginx + Django: redirect non-www to www on AWS Route 53
I have a Docker + Gunicorn + Nginx + Django setup on AWS EC2 and Route 53. Right now I want to redirect mydomain.com to www.mydomain.com.Is it appropriate to do a redirect in a Nginx configuration? Or are there are better solutions.Here is docker-compose-yml, using gunicorn to start the Django server.version: '2' ser...
Yes, it's appropriate to do these kinds of redirects in the webserver. If it's https your certificate needs to cover both domains.
How to configure Elixir, NGINX, Websockets on server
I'm setting up a server with a Phoenix app that will use websockets. Locally websocket work but I have problems with setting it up on my staging server. Can someone help me with setting up websockets on my server. I have nginx configured like this:map $http_upgrade $connection_upgrade { default upgrade; '' clos...
The above configuration works. The issue on my side was with using the wrong nginx config file that had the old settings.
Does Azure App Service for Linux support http2?
SSL configuration is handled upstream on Azure App Service.So running an App Service as Docker container and configuring Nginx for server { listen 443 ssl h2; } is not necessary and in fact, will not render a webpage.How do I modify the configuration on Azure App Service for Linux to run as http2 protocol when SSL w/ c...
This feature now exists for both Linux and Windows and is in the same section of the Azure Portal for Web App Services.Go to your Web App ServiceGo to SettingsGo to ConfigurationSelect the tab for General SettingsBeneath Platform Settings, choose the "2.0" from the Http version drop down.See image for details.
nginx maintenance page for Docker based Rails app
I think I have a chicken-and-egg situation:My Rails app is Docker based and I have several images for nginx, Rails, a Resque worker, Redis and MySQL.My current implementation of deployment is (simplistically):docker-compose build docker-compose down ... compile assets ... migrate docker-compose upWhich works great, but...
This is a:NGINX maintenance page example for docker-composeJust keep nginx in a separate container in the same docker-compose.yml and deploy as this:docker-compose up -d --build --force-recreate your-app-serviceAdd some logic to put the maintenance page in nginx. The nginx service won't be touched by compose.Use someth...
Domain without ssl certificate redirecting to different ssl domain
I have two domains set up on a Digital Ocean droplet (with nginx). I've installed a SSL certificate in one of them (domain1) and everything is fine with that one. The second domain (domain2), does not require a SSL certificate but if I try to accesshttps://domain2is showing me the content of domain1 and giving me a cer...
nginxalways has adefault server, the one that is used if theserver_namedoes not match. If you only have one server block withlisten 443, then that is the implicit default server for allhttpsconnections irrespective of server name.You will need to set up an explicitcatch-allserver forhttpsconnections, or addlisten 443 s...
NGINX + phpFPM load balancer and sessions
i have one question, i am usingnginxandPHPFPM. I am using loadbalancer for2 phpfpm servers.To keep sessions from both phpfpm servers synced i used memcached. But when i use memcached i see thatpage is slowing down.When i usefiles as sessions save typeweb is runing faster, but sessions are not synced imediately (i guess...
The speed increase you're probably seeing here in PHP using NFS over memcached is adeceptiveone by nature. PHP session storage defaults to lock acquisition on a first-come-first-served basis. Which means that two concurrent requests made to PHP for the same session will cause the first request to lock the session until...
Block a specific port in Nginx
I have the following config:server { listen 80; server_name my_server.com; location / { proxy_pass http://localhost:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; prox...
It's better do at network level. For unix:iptables -A INPUT ! -s 127.0.0.1 -p tcp -m tcp --dport 8080 -j DROPSeehttps://serverfault.com/a/248864
Nginx PHP-FPM and curl hangs subsequent browser to server requests
I have php-fpm & nginx stack installed on my server.I'm running a JS app which fires an AJAX request that internally connects to a third party service using curl. This service takes a long time to respond say approximately 150s.Now, When i connect to the same page on another browser tab, it doesn't even return the java...
The issue was due to the PHP session lock. When i used to make a certain request, PHP used to lock the session file and would release only after the request was completed.To avoid this, you may usesession_write_close(). In my case, I implemented redis session.Problem solved!!!
Nginx/SSI independent fragment caching
I'm trying to set up a basic working Nginx+SSI example:Nginx config (just the relevant parts, for brevity):ssi on; proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:20m max_size=20m inactive=60m use_temp_path=off; server { listen 80; server_name localhost; location / { proxy_cache my_cache; ...
There is a problem in your config: you have SSI enabled in both servers, due tossi on;defined at http{} level. This results in SSI directives being expanded in the second server{}. The response as cached in the first server doesn't have any SSI directives in it (there are already expanded), and hence it stays the sam...
redirect all traffic for a certain domain using nginx
I'm currently playing around with nginx and am trying to redirect all traffic for e.g. firstdomain.org to seconddomain.org This is working fine with a simple redirect but I now also want it to hand on the URI, the scheme and the subdomain.E.g.http(s)://firstdomain.org/redirects tohttp(s)://seconddomain.org/,http(s)://f...
You can simplify by capturing the.in$sub:server { listen 80; listen 443 ssl; server_name ~^(?\w+\.)?firstdomain\.org$; ssl_certificate /path/to/certificate; ssl_certificate_key /path/to/certificatekety; return 301 "$scheme://${sub}seconddomain.org$request_uri"; }
Request hangs for nginx reverse proxy to an ASP.NET 5 web application on docker
I am trying to get nginx, ASP.NET 5, Docker and Docker Compose working together on my development environment but I cannot see it working so far.Thisis the state where I am now and let me briefly explain here as well.I have the following docker-compose.yml file:webapp: build: . dockerfile: docker-webapp.dockerfile ...
This is a known bug in Kestrel RC1:https://github.com/aspnet/KestrelHttpServer/issues/341You can work around it by forcingConnection: keep-alive:proxy_set_header Connection keep-alive;
errorhandler in flask and nginx server
I am using the following errorhandler in my flask app@app.errorhandler(413) def error413(e): return render_template('error413.html'), 413which shows an error page if error 413 happens (filesize too large). This works fine on my localhost, but on the server I get the nginx 413 error page instead.413 Request Entity T...
By default, nginx catch HTTP error codes. It is a good thing, for security purposes.It is possible to disable this behaviour, you can setuwsgi_intercept_errors off.http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_intercept_errorsYou can use custom static error pages, served by nginx. Example:error_page 41...
Nginx config for meteor
My question is how do I get Nginx to forward a domain (www.example.com) to a meteor app on the same server without ssl.Here's the details: I'm trying to use Nginx to host an app made by meteor on my own server. I've checked a ton of different config files that I've found online (most of which are dated) but I can't see...
The problem was a trailing backslash in theproxy_passdirective. It should've beenproxy_pass http://default;. Thanks toanatolyfor pointing that out.UPDATE:Nginx documentationis a bit confused, but highlights the difference between proxy_pass with/without URI:A request URI is passed to the server as follows:If the proxy_...
Nginx Plus not streaming HLS
I have installed Nginx Plus and configured HLS for streaming. While requesting them3u8file I'm getting the error:2015/09/29 13:32:34 [error] 5814#5814: *1 open() "/usr/video/hls/CODECS="avc1.42e00a,mp4a.40.2"" failed (2: No such file or directory)Them3u8file has the following contents:#EXTM3U #EXT-X-STREAM-INF:PROGRAM-...
In order to dynamically create thetssegments from a static file like anmp4the filename and extension must be present in them3u8playlist filename:myvideo_high.mp4.m3u8formyvideo_high.mp4For:myvideo_high.m3u8it assumes the segments already exist.TheServing Media with NGINX Pluswhitepaper shows an example for a manually c...
Using nginx to map rails applications
I'd like to use nginx in order to map all my rails apps on port 80.Currently, I have 3 rails apps running on port 3000 3001 and 3002 and I'd like to use nginx on port 80 to map them so :http://127.0.0.1/app1 => 127.0.0.1:3000 http://127.0.0.1/app2 => 127.0.0.1:3001 http://127.0.0.1/app3 => 127.0.0.1:3002Here's what I d...
AddActionController::Base.relative_url_root = "/app1"to the end of yourconfig/environment.rbof app1 (similarly for other two apps). This will make Rails add proper prefix to URLs.If you don't want to mess with Rails config, you probably could force Nginx to go through all of your assets folder until it finds the one it...
Virtualenv: How to make a custom Python include shared by multicomponents hosted by uWSGI
I have a somewhat intricate project setup consisting of several components that work together. Each component is a separate Python project that is hosted as a uWSGI application behind an Nginx proxy. The components interact with each other and with the outside world through the proxy.I noticed myself about to cut-and-p...
I solved the problem quite easily by symlinking the package of interest in .env/lib/python2.7/site-packages. I originally tried to symlink the entire project folder but that didn't work as it couldn't find the package.It seems that my uWSGI/Nginx just follows the virtualenv's version of pythonpath, so whatever I config...
Why getting empty CSS files in Production?
I had put many css files in the fileactive_admin.css.scss:// Active Admin's got SASS! @import "active_admin/mixins"; @import "active_admin/base"; @import "admin/plugins/*"; @import "admin/calendar"; @import "jquery-ui.css"; @import "admin/jquery.datepick.css";But the files"jquery-ui.css"and"admin/jquery.datepick.css"ar...
Get rid of the file extensions in your@importdeclarations. It should be:@import "jquery-ui"; @import "admin/jquery.datepick";
msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)
I get an error onTASK: nginx container:failed: [localhost] => {"changed": false, "failed": true} msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),) FATAL: all hosts have already failed -- abortingWhen play nextAnsibleplaybook:--- - name: Play hosts: localhost v...
You should install docker:- name: install docker shell: curl -sSL https://get.docker.com/ | sh args: creates: /usr/bin/dockerAnd you should check that it works:- name: Wait for the Docker server to start action: raw docker version register: docker_version until: docker_version.stdout.find("Client") != -1...
Nginx PHP set_time_limit() not working
I would like to increase timeout of one php site on nginx so I don't get "504 Gateway timeout". I've tried set_time_limit but it doesn't work. I've found some solutions which are based on modification of configuration files (e.g.Prevent nginx 504 Gateway timeout using PHP set_time_limit()). However I shouldn't modify t...
First, you have to edit your Nginx configuration files to change fastcgi_read_timeout. There is no getting around that, you have to change that setting.I'm not sure why you say "I shouldn't modify these files in my case". I think your reason might be that you want to change the timeout for one of your websites, but n...
Execute code to switch light on with PHP
I would like to execute a program using PHP, a piece of code that will use an RF transmitter to switch in my lamp.This is achieved from the command line by:action 63 A onIt is just a C program someone wrote to control the GPIO pins on my raspberry pi. So I make an index.phpIt does nothing while:Gives me the default tex...
I solved it. The answer was easy, indeed the user "http" was not allowed to execute things from the wiringpi library which the C-program needed to run.In the end I simply did:chmod +s action(This sets modifies the executable (called "action") to always run with root privileges.) ...and the code ran as expected with the...
configuring nginx server to store the static images and html
I want to configure the nginx server in my windows7 PC.For storing images and html files. I followed up the following steps: 1.I downloaded the nginx-1.2.9 and unziped into c:\ filder. 2. created one folder "data" and within 'data" folder created another two folders say "WWW" and "images". 3.Keeping a...
You have commented the configuration data.First remove all the # from your configuration file.Then use the below code inside the server {}location / { root data/www; } location /images/ { root data; }Note- the location of the static file inside your nginx root folder should be the (root+location) data and the ...
How can I add basic auth to an nginx configuration with rewrite
I have the following nginx configuration I would like to add basic authentication to this configuration to this.upstream phpfcgi { server 127.0.0.1:7777; # server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket } server{ listen 80; server_name qu.abc.com; root /home/qu/website/current/web...
It would sound to me like you want to have basic auth enabled for the whole server, and not just a singlelocation. The waylocations work, is that only one applies at a time, hence if you specify an auth policy in a singlelocation, but it does arewriteto some otherlocation, then the otherlocationwill not be subject to ...
How to dynamically load HTTP routing into NGINX from your webframework?
I've been following theWeb Frameworks Benchmarkand have noticed that a number of web framework suffer from the same performance penalty, that being they do HTTP routingwithinthe framework itself and not leverage the highly performant HTTP server of NGINX to do routing.For example, in theFlaskpython framework, you might...
I don't know a ready to use library. But it seems pretty easy to write a script, which generates an Nginx config file from application's routes (for example, during application setup). This file can be included into main configuration of server using "include" command of Nginx config:server { listen 80; server_...
Sinatra: Hot Code Pushes In Production?
When I push new code from my Sinatra application to my production server, I am currently triggering a restart of passenger by touchingtmp/restart.txt, which loads the new changes. The problem is that the site is essentially down for about 10 seconds during this process.How can I setup my server so that I can completel...
What you're looking for is rolling restarts. Phusion Passenger Enterprise supports this:http://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerRollingRestarts
Using Nginx to block IP's behind proxy
I'm running a Nginx 1.2.4 webserver here, and I'm behind a proxy of my hoster to prevent ddos attacks. The downside of being behind this proxy is that I need to get the REAL IP information from an extra header. In PHP it works great by doing$_SERVER[HTTP_X_REAL_IP]for example.Now before I was behind this proxy of my ho...
I solved it.Had to add:set_real_ip_from 0.0.0.0;Where IP0.0.0.0being the proxy
How do I setup multiple rails applications for development?
For the site I am currently working on we have 2 Rails 3.2 projects. One project is basically an API, and the other is a web front end. In order to develop on the web front end I need to have the API project running. I've tried using theforemanandsubcontractorgems to manage this but it doesn't seem to work. Both pr...
tmuxinator allows you to easily configure a tmux session that can be launched with a single command containing any number of windows (tabs) and executes commands in each window (like starting a server). Just configure it to load the appropriate gemset for the appropriate rails server.https://github.com/aziz/tmuxinator
ELB, RDS mysql, EC2, NGINX where to look next for concurrency performance issues
The setup: EC2 servers autoscaling behind ELB, connecting to RDS mysql database, all static files served from cloudfront.I'm running nginx as the web server on the EC2 servers, keepalive set to 20, worker processes 4, . Codeigniter is the backend and using codeigniter sessions.I've been running lots of benchmarks to at...
Okay. Well this is a very broad subject as you know. But I will try and help.The ELB is generally not very good at burst scaling. After speaking with Amazon engineers about this, I figured out they actually won't scale the ELB on bursts because it is not possible. You need to have consistent load over time to get the E...
How to access event machine websockets through Thin/nginx?
I have an event-machine websocket application (using theem-websocketgem) and it runs fine. The problem is that I need to deploy it using port 80 through nginx (can't compile it with tcp proxy module). Is it possible to use a simple nginx proxy_pass pointing to a thin server and have the thin server to pass the requests...
From what I understand you can't proxy websocket traffic with a proxy_pass.Since web sockets are done over HTTP 1.1 connections (where the handshake and upgrade are completed), your backend needs to support HTTP 1.1, and from what I have researched, they break the HTTP 1.0 spec...I've seen some people try to do the sam...
how to configure nginx for long poll (and php)
I'm creating a simple chat app. Have installed nginx on Ubuntu 11.10, with PHP via fast-cgi. To get a feel for performance, I made a simple PHP file that sleeps 10 seconds then reports the time. Calling this with several browser instances (different browsers, different machines) the response becomes sluggish after abou...
The push stream module will technically do what you want it to do -- set up a url in which you can push updates to that in turn can be polled by a pubsub in your client side code.In order to install the push stream module, you need to get the latest source of nginx, get the source for that module, compile that, then re...
What is the best way to upload files to another domain from a browser? [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened,visit the help ...
I don't have a server to use to stand in for SomeServer for me to test out my suggestions, but I'll give it a shot anyway. If I'm wrong, then I guess you'll just have touse Flash (sample code from VK).How about using an iFrame to upload the file toSomeServer, receive the JSON response, and then usepostMessageto pass t...
nginx rewrite rule not working?
rewrite ^/index\.asp /index.php last; rewrite ^/index\.asp\?boardid=([0-9]+)$ /forum-$1-1.html last; rewrite ^/index\.asp\?boardid=([0-9]+)(.*)$ /forum-$1-1.html last; rewrite ^/index_([0-9]+)(.*)$ /forum-$1-1.html last; rewrite ^/dispbbs\.asp\?boardID=([0-9]+)&ID=([0-9]+)$ /thread-$2-1-1.html last;I have try out rewri...
You cannot match arguments inrewriterules, they may include paths only. The reasons are simple: suppose arguments may have another order; suppose there can be additional arguments you did not take into account (e.g. keywords from Google).So your rules should be rewritten in a way to match path at the first and then che...
Lookup on 192.168.65.5:53: no such host
I try to run nginx in docker and connect it to one service in docker as well. Another service is running without docker and use this nginx too. My docker-compose:version: "3.9" services: nginx: restart: always image: nginx volumes: - ./config/nginx.conf:/etc/nginx/nginx.conf:ro ports: - "...
Updating Docker to the latest Apple Silicon Preview release fixed it for me.Here
After the first reload: "nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory)"
Using Salt I applied states that install and run NGINX (1.14.0-0ubuntu1.7) as a service. Service's status is active butsystemctl reload nginxkeeps failing thus an updated config cannot be applied.Full logs:systemd[1]: nginx.service: Can't open PID file /run/nginx.pid (yet?) after reload: No such file or directory syste...
I believe that the main problem in this case is the fact that the NGINX service had been started initially before the needed/etc/nginx/nginx.confwas placed. In my opinion, this order causes NGINX searches the PID file defined in the nginx.conf but the PID location policy was different during the start thus the PID file...
docker-entrypoint exec nginx not found
I'm not sure what I'm doing is correct so fix me if I'm mistaken.This is my dockerfile:FROM nginx:latest RUN apt update && apt install build-essential libpcre3 libpcre3-dev libssl-dev libnginx-mod-rtmp -yI'm trying to addrtmp moduleto my nginx.I'm trying to run the image with the command below:docker run --rm --name m...
There is already an nginx image with rtmp module installed:docker pull tiangolo/nginx-rtmpHow to use:https://hub.docker.com/r/tiangolo/nginx-rtmp/Now for your problem, if you go to the official nginx docker image repository inhttps://github.com/nginxinc/docker-nginx, line 38 is:exec "$@"So what does that do?More inform...
Application Load Balancer having problems with CORS
I am running into a CORS problem which says that I'm unable to load my webpage due to the following:"Access to fetch at 'ALB Load balancer dns address:port' from origin 'ALB Load balancer dns address' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an op...
You can configure your apigateway with cors headers, methods and url. You just need to edit the configurations (to add new) and after that you can redeploy your apigateway configurations. (changes are only visible after deploy from api gateway).If you save, it only saves your current configuration state but it does not...
How to deploy dotnet core application on Ubuntu server with Nginx server?
I have a dotnet core application built on dotnet core 3.1 and when I tried to deploy the same in ubuntu 18.04 server by following the steps given in thisdocbut not able to access the app on port 80 (accessing through public IP)Here is the Nginx updated configurationand dotnet application is running with port 5000 and ...
The problem was IISexpress port access issue.By default, the IISexpress does not allow the external network to access the port and this access needs an explicit configuration.If you are facing the same problem, you can find the code snippet and other details here.Accessing IISExpress for an asp.net core API via IP
nginx error -client closed connection while waiting for request, client: x.x.x.x, server: 0.0.0.0:80
server { listen 80; server_name xx.cn; index index.php index.html index.htm; root /data/www_deploy/xx/backend/web; location ~* /\. { deny all; } location / { try_files $uri /index.php?$args; } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0....
This often happens if the index.php (or any other script) you are calling does not exit correctly, for example throwing an exception.Have a look at the error.log
What is the command to execute command line arguments with NGINX Ingress Controller?
I feel like I'm missing something pretty basic here, but can't find what I'm looking for.Referring to the NGINX Ingress Controller documentation regardingcommand line argumentshow exactly would you use these? Are you calling a command on the nginx-ingress-controller pod with these arguments? If so, what is the command ...
Command line arguments are accepted by the Ingress controller executable.This can be set in container spec of thenginx-ingress-controllerDeployment manifest.List of annotation document :https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.mdCommand line argument docume...
gke nginx ingress create additional load balancer
I have a set of services that i want to expose as an ingress load balancer. I select nginx to be the ingress because of the ability to force http to https redirects.Having an ingress config likeapiVersion: extensions/v1beta1 kind: Ingress metadata: name: api-https annotations: nginx.ingress.kubernetes.io/ssl-re...
On GCP GKE the gcp ingress controller its enabled by default and will be always lead to a new LB in any ingress definition even if the .class its specified.https://github.com/kubernetes/ingress-nginx/issues/3703So to fix it we should remove the gcp ingress controller from the cluster as mention onhttps://github.com/kub...
How to customize nginx config on Node.js Elastic Beanstalk
I'm new to AWS EBS. I'm trying to modify etc/nginx/nginx.conf. I just wanted to add a line inhttp{ underscores_in_headers on; }and I'm able to change by accessing the instance with IP using putty. But the problem is that when auto scaling scales the environment with new IP then the linehttp{ underscores_in_headers on; ...
Step 1 To edit the configuration in AWS ElasticBean of nginx you need to add the configuration file in .ebextensionsto this add folder .ebextensions/nginx/ create proxy.config filefiles: /etc/nginx/conf.d/proxy.conf: mode: "000644" owner: root group: root content: | underscores_in_headers on;it ...
nginx upstream subdomain on the same server
I am configuring Nginx load balance with Nginx upstream module, configuration as follow:upstream load { server loadapi.example.com; server loadapi.anotherdomain.com down; } server { listen 80; server_name api.example.com; location / { proxy_pass http://load; # proxy_set_header X-Fo...
nginxuses theHostheader to determine whichserverblock to use to process a request.When the request passes through theproxy_pass http://load;statement, theHostheader is set to the valueloadby default.To makenginxchoose theserverblock containing theserver_name loadapi.example.com;statement, it either needs to be thedefau...
Simulate invalid HTTP request
I need to simulate malformed HTTP requests to my server for testing purposes - I have aclientErrorhandler in my Node.js server and want to create a functional test it.For example:curl "https://myhost/endpoint?term=one two"will trigger this handler (due to the not encoded space between wordsoneandtwo)I'm struggling to f...
The solution was to use thetlslibrary:const tls = require('tls'); const options = { port: 443, host: 'myhost' }; const socket = tls.connect(options, () => { console.log('connected to', socket.remoteAddress); socket.write('GET /endpoint?term=one two HTTP/1.1\r\n' + 'Host: myhost\r\n' + '...
Several requests at the same time bad SQL results
I am faced with an unknown problem, I created a PHP API (Slim framework + Slim PDO) connected to Mysql. I use Nginx as an HTTP server. The API use a "device-id" header to recognize the client (An android application). The concern is that recently an update of the android application makes that at the launch of this one...
If device_id field is supposed to be unique in the table, then add anunique indexfor it.Then you'll be able to run a mysql query ON DUPLICATE KEY, likeINSERT INTO users (...) VALUES(:device_id, :ip, ...) ON DUPLICATE KEY UPDATE ip = values(ip) , ...I don't know if it's possible to run such a query with Slim-PDO, but at...
Nginx configuration for allow ip is not working deny all is working fine
i create a new conf file to block all public ip to access and give only one public ip address(office public IP) to access. but when i try to access its shows the "403 Forbidden nginx"upstream backend_solr { ip_hash; server ip_address:port; } server { listen 80; server_name www.exa...
deny allwas not working for me because the traffic was being forwarded internally through a proxy.Here is what ended up working for me:upstream backend_solr { ip_hash; server ip_address:port; } server { listen 80; server_name www.example.com; index /example/admin.html; charset utf-8; a...
Using preference _local in elasticsearch
I am currently tuning elasticsearch for search api. The specification are:2 Nodes single cluster with single index on a VM (2 cores 2GB of RAM)5 shards1 replicationload balanced using nginxWhen I test it using Jmeter using Nginx it get throughput about ~220 req/s but when I specify the?preference=_localit can get to ~3...
Using_localpreference in this scenario is fine, since you have two nodes and one replica for your indices, which means each node has exactly the same data.Preference_localwill run the query you are sending to a node,on that particular node's data. If that node doesn't have the data that needs to be queried will send th...