Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
NGINX with Tomcat configuration
I am new to Nginx and I need your help,According to many forums I understood that all our static pages are stored in Nginx. When there is request comes I have to pass that request to tomcat for data and after response from tomcat response generated.Currently, I have just done that I request directly passed to tomcat an...
You can using proxy_pass mapping to your tomcat server port, for example : if your tomcat port is 8080, your conf/nginx.conf should be configured like this:... http { ... server { location / { proxy_pass http://127.0.0.1:8080; proxy_set_header X-Real-IP $remote_addr; } ...
Return a string using the Nginx container
I am using the Nginx container to host a SPA application in Kubernetes.Aside from the static files hosted for the SPA app, I also need to host the routes for health checks. So, the route/health/startupneeds to return the texthealthywhen a GET request is sent to it.I suppose I could just make a folder called "health" a...
Yes you can, in the configuration you are importing for the server, you can just do this:location /health/startup { add_header Content-Type text/plain; return 200 'healthy'; }
Nginx how to add extra server configuration to without modifying nginx.conf
I want to add this extra config to my nginx.conf:server { listen 0.0.0.0:8081; rewrite ^ https://$host$request_uri? redirect; }But as my app is deployed in a hosting service I don't want to modify the already presentnginx.conf. It can be problematic.Is there any way I can add this extra configuration without m...
There is no way you can add extra server configuration without modifyingnginx.conffirst. But good news is that you will have to modify nginx.conf only for once.Just add this line in yournginx.confinclude /etc/nginx/config.d/*.conf;You can name directory and path as per your choice. create directory and save your extra ...
Configuring HTTPS on Nginx and NodeJS
I'm using Nginx to publish static content on port 80 and a 433 redirect (with SSL) to the NodeJS. The configuration of Nginx is as follows:server { listen 443 ssl; ssl_certificate /opt/projetos/nodejs-project-ssl/vectortowns-cert.pem; ssl_certificate_key /opt/projetos/nodejs-project-ssl/vectortowns-key.pem...
Use Nginx (and Nginx only) for SSL, that's the standard. As you set, Nginx works as a reverse proxy so it will feed you program with local unencrypted data for the given encrypted data on port 443, so it won't work if you also use SSL on your node program
Remove php 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1
I installed php on ubuntu 14.04 with nginx but the version installed was php 5.5.9. Since I wanted to upgrade it to php 5.6 I fired the below commands:sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php5-5.6 sudo apt-get update sudo apt-get upgrade sudo apt-get install php5I got a mes...
To get rid of the deprecated message, you need to use different ppa: repository.You have to remove existing packages and the deprecated repository. Then, add the new repository and install the packages you need:# Remove old ppa: and its packages sudo add-apt-repository ppa:ondrej/php5-5.6 --remove --yes sudo apt-get --...
error 28105#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
I can't configNginxwithphp-fpmcorrectly. When I get any php script, I get Nginx404 Not founderror in browser:File not found.In my php-fpm logs I get:172.17.42.1 - 28/Apr/2015:09:15:15 +0000 "GET /index.php" 404for any php script call and in Nginx logs I get:[error] 28105#0: *1 FastCGI sent in stderr: "Primary script u...
Also, need to share files to thephp:fpmdocker container too. The answer is to run dockerphp:fpmimage with volume too:docker run -it -p 127.168.66.66:9000:9000 -v /var/www/html/:/var/www/html/ php:fpm
How can I set up an automatic authentication layer in nginx?
I'm building an ecosystem of applications under a common domain, with each application under a separate subdomain. I have built an authentication application for the ecosystem, but it requires each other application to be specially configured to use it. Is there a way to configure nginx to manage user sessions, possi...
Let me show you a common pattern for cross-application authentications you can use with Nginx:1) Build standalone service called auth_service, work independently from the web applications as required2) Each subdomain apps will have an individual location that proxies to the same authentication servicelocation = /auth {...
Sending extra header in nginx rewrite
Right now, I am migrating the domain of my app fromapp.example.comtoapp.newexample.comusing the followingnginxconfig:server { server_name app.example.com; location /app/ { rewrite ^/app/(.*)$ http://app.newexample.com/$1; } }I need to show-up a popup-banner to notify the user of the domain name migr...
The thing is that, when you "rewrite" into URI having protocol and hostname (that ishttp://app.newexample.com/in your case), Nginx issues fair HTTP redirect (I guess the code will be 301 aka "permanent redirect"). This leaves you only two mechanisms to transfer any information to the handler of new URL:cookieURL itself...
Accessing Django Admin over HTTPS behind Nginx
I've got django running in uwsgi behind nginx. When I try to accesshttps://site/admin/I get the expected login screen. Logging in via the form seems to succeed, however, I simply end up back at the login screen. Firebug shows a redirect to the plainhttp://site/admin/url which is then redirectec by nginx to the https ur...
Adding the following to nginx.conf fixed the issue for me.location / { ... include uwsgi_params; uwsgi_param HTTP_X_FORWARDED_PROTOCOL https; uwsgi_param UWSGI_SCHEME $scheme; }Along with adding the following to settings.py:SESSION_COOKIE_SECURE = True SECURE_PR...
How to properly diagnose a 500 error (Rails, Passenger, Nginx, Postgres)
I'm having a real tough time diagnosing a 500 error from my application running in production. I've had it working before, but after re-deploying via Capastrano I am unable to get it going.Here are the facts:The server is setup with nginx + passenger, and I'm using PostgreSQL.Static assets are working properly, as in I...
Okay, I figured this out. The app ran fine in development mode, so I knew something production-specific was screwing it up. I went into config/environments/production.rb and changes these settings:# Full error reports are disabled and caching is turned on config.consider_all_requests_local = false # changed from ...
what is the difference between apache/nginx/IIS
I have been a java web application developer,and now I work on .net framework.When I work in java web,we use the tomcat/jboss to deploy our application. I thought the tomcat/jboss is web server.When I work in asp.net, I use IIS to deploy the application,then I thought the IIS is another kind of web server.These days,I...
First things first: a "web server" is just a piece of software that serves content over the http(s) protocol. That's the minimum functionality. So you threw around a lot of additional features...JBOSS/Tomcat is not only a "web server"; a tomcat provides functionality to have a java application responding to requests se...
Configuration for Django, Apache and Nginx
I've setup my Django application on Apache+mod_wsgi. To serve the static files I'm using Nginx, as suggested on Django's project website.http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/Apache is running on port 8081 and nginx is on port 80. Now some people have suggested that my configuration is wrong and...
The django docs you linked to do not suggest you use apache as a reverse proxy. They simply suggest you use a separate web server, so I'd say the docs are not clear on that subject -- they are not suggesting anythingwrong.My initial answer was assuming you had nginx as a reverse proxy because port 80 is the HTTP port, ...
Is it possible to run HTTP/2 on NGINX port 443 without ssl?
I have Envoy Proxy handling SSL termination. Nginx (1.17.0 in a docker container, compiled--with-http_v2_module) is one of several upstream services. As a result, Nginx receives traffic on port 443 but does not use thesslmodule:server { listen 443; server_name example.com www.example.com; root /var/www/html...
Nginx only supports h2c (which is what HTTP/2 without HTTPS is called), so you can not connect using HTTP/1.1 and then upgrade.In fact if you try to connect using HTTP/1.1 then nginx will error asit doesn’t support HTTP/1.1 and HTTP/2 on the same port unless you are using HTTPS.So for curl you have to use this syntax t...
Nginx reverse proxy on unix socket for uvicorn not working
Files:# main.py: from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"}-# nginx.conf: events { worker_connections 128; } http{ server { listen 0.0.0.0:8080; location / { include uwsgi_params; uwsgi_pass unix:/tmp/uvi.soc...
You are using theuwsgimodule of nginx. Uvicorn exposes anasgiAPI. Therefore you should use a "reverse proxy" configuration instead of anuwsgiconfiguration.You can get more info on the uvicorn documentation:https://www.uvicorn.org/deployment/#running-behind-nginx(see theproxy_passline)
pgadmin4 wont work in specific location behind nginx
I got some trouble: pgadmin working perfect behind nginx in location /, but it wont work behind location /pgadmin Work great:location / { proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; ...
For versionpgAdmin 4 v3.0, until the issue is actually fixed, here's a quick command-linehackbased onthis.cat > quickfix.txt <<THE_END class ReverseProxied(object): def __init__(self, app): self.app = app def __call__(self, environ, start_response): script_name = environ.get("HTTP_X_SCRIPT_NAME"...
A same "Location" rule for multi "Server" block
I have to configure multi https website with a dedicated certificate for each website. It works fine like that.server { listen 443; server_name client1.localhost.eu; ssl on; ssl_certificate ...; ssl_certificate_key ...; root /var/www/client1; location ~ \.p...
Use include directive for such factorization:includeCreate file in the nginx config folder like /etc/nginx/conf.d/location_php.cnf (not .conf to avoid auto-loading by nginx)location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm-client2.sock; ...
connect() failed (111: Connection refused) while connecting to upstream
I am hosting my Rails app on Rackspace with nginx webserver.When calling any Rails API, I see this message in /var/log/nginx/error.log: *49 connect() failed (111: Connection refused) while connecting to upstream, client: 10.189.254.5, server: , request: "POST /api/v1/users/sign_in HTTP/1.1", upstream: "http://127.0.0....
Nginx is areverse proxy server- its role on your server is to accept HTTP requests and proxy them to another process on the same host. The "upstream" that the error message is talking about is referring to the bit in nginx's configuration (part of which is the/etc/nginx/sites-available/defaultfile) that tells it where ...
Django + uwsgi + nginx redirect to default page "Welcome to NGINX"
I'm a very beginner in python and django. However I'm trying to create a server to deploy my application. But when I want to access my app, I always get the default nginx page "Welcome to nginx".This server is on Ubuntu 12.04 (precise) I've installed nginx, python, django and uwsgi packages with apt. Next I've created ...
The domaindjango.pommesky.comdoesn't look like it's alive, so it's possible that Nginx is receiving requests with wrongHost:field in theHTTP request header.(sect. 14.23) So Nginx serves adefaultcatch-all page.You can disable thedefaultNginx site by removing the/etc/nginx/sites-enabled/defaultlink, and then restarting t...
Passenger NGINX module Failing
At one point I've had everything running fine on my system with NGINX, Rails, and Passenger.Yesterday I did a fresh install of Passenger, and nowpassenger-install-nginx-modulefails./.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/passenger-3.0.13/ext/nginx/../common/libpassenger_common.a /.rbenv/versions/1.9.3-p125...
I see NGINX has aticketfor this that has been closed, but the solution did not work for me.I did, however, get NGINX up and running again with Passenger by running a customized installation. It's obviously a compatibility issue with versions 2 and up.First I just pulled down the NGINX source (1.0.15).In my /usr/localwg...
phusion passenger not seeing environment variables?
We are running ubuntu servers with Nginx + Phusion Passenger for our rails 3.0x apps.I have an environment variable set in /etc/environment on the test machines:MC_TEST=trueIf I run a console (bundle exec rails c) and output ENV["MC_TEST"] I see 'true'. But, if I put that same code on a page ( <%= ENV["MC_TEST"] %> ) i...
Passenger fusion v4+ enables reading of environment variables directly from bashrc file. Make sure that bashrc lives in the home folder of the user under which passenger process is executed (in my case, it was ubuntu, for ec2 linux and nginx)Here is thedocumentationwhich goes into details of bashrc
Automatically update Vue site / PWA with new release
I have a Vue app that is used both in the browser and as a PWA. I would like to ensure users receive the latest version whenever updates have been pushed to the server.I am usingNginx,Djangoandvue-clialong with@vue/cli-plugin-pwa.Currently when Inpm run buildand then push the new version to the server, users get the ol...
In the end I found this excellent article which covers how to display a notification when an update is available. The user is then able to click the notification which updates the app.https://dev.to/drbragg/handling-service-worker-updates-in-your-vue-pwa-1pip
Kubernetes ingress-nginx - How can I disable listening on https if no TLS configured?
I'm using kubernetesingress-nginxand this is my Ingress spec.http://example.comworks fine as expected. But when I go tohttps://example.comit still works, but pointing to default-backend with Fake Ingress Controller certificate. How can I disable this behaviour? I want to disable listening on https at all on this partic...
Redirection is not involved in your problem.ingress-controller is listening on both port, 80 and 443. When you configure an ingress with only 80 port, if you reach the 443 port you are redirected to the default backend, which is expected behaviour.A solution is to add an other nginx-controller, that will only listen on...
How to use WebRTC to stream video to RTMP?
I am trying to build a service that streams your screen from a browser to clients (something like twitch).What I have accomplished is I have built a working nginx server with rtmp, I tested it using OBS. That works pretty well.And my question is how to stream a screen from a browser (not from OBS or other broadcasters)...
For RTSP<->WebRTC / RTMP<->WebRTC conversions, you need to run some kind of WebRTC gateway / media server software that works with all these formats/protocols and can transmux between all of them. Try Wowza / Unreal Media Server / Flashphoner.https://en.wikipedia.org/wiki/Comparison_of_streaming_media_systemsSo in your...
Difference between {R:1} and {C:1} on iis web.config file
ON my job I was asked to migrate a php application running on iis/azure into running via nginx and fpm over a GNU+Linux machine.Then on the process I encountered a file namedweb.configcontaining entries for example: Or So far I thought that an nginx mapping like that:^some_regex^ index.php?someaction=$1;Would...
here is youranswerBack-references to condition patterns are identified by{C:N}where N is from 0 to 9. Back-references to rule patterns are identified by{R:N}where N is from 0 to 9. Note that for both types of back-references,{R:0}and{C:0}, will contain the matched string. For more detailed info you can have a look on:I...
Configure nginx for two node apps, with one on a subdomain
IssueI'm trying to set up nginx so I can have my domain,domain.comrun by a node web app on port 3000, and the subdomaindev.domain.comrun by a second node web app on port 3001. When I run this configurationdomain.comis connected to the right port, butdev.domain.comjust gives a page that says the server can't be reached....
Above setup works fine. My issue was with DNS records - I added an A record directingdev.domain.comto the IP address of the server I'm running the node apps on.
How to configure Let's encrypt certificates for nginx inside a docker image?
I know how toconfigure let's encrypt for nginx. I'm having hard time configuring let's encrypt with nginx inside a docker image. Let's encrypt certificates are symlinked inetc/letsencrypt/livefolder and I don't have permission to view the real certificate files inside/etc/letsencrypt/archiveCan someone suggest a way ou...
If anyone having this problem, I've solved it by mounting the folders into docker container.I've mounted bothetc/letsencryptandetc/sslfolders into dockerDocker has-vflag to mount volumes. Don't forget to openport 443for the container.Based on how you mount it it's possible to enable https in docker container without ch...
nginx redirect multiple servers to SSL
I have this code. I just want each of the server_name in the list to redirect to its own name https. But, if I dohttp://beta.example.com, it redirects tohttps://api.example.com(or whatever the first item in the list is)server { listen 80; server_name api.example.com beta.example.com apibeta.example.c...
You should be able to use the$hostvariable instead:server { listen 80; server_name api.example.com beta.example.com apibeta.example.com nodebeta.example.com app.example.com; return 301 https://$host$request_uri; }
Nginx Block/Deny Access to multiple locations regex
I am using Nginx as a reverse proxy for my Apache instillation and as a security feature it blocks access to phpmyadmin, webalizer etc for everyone except localhost but using nginx it makes Apache think it is localhost so it displays it publicly for everyone. Order deny,allow Deny from all Allow from ::1 12...
As the apache regex has '^', we can put '^' to force matching from the start of the path too.location ~ ^/(xampp|security|phpmyadmin|licenses|webalizer|server-status|server-info) { proxy_pass http://127.0.0.1:8080$request_uri; .... allow/deny directives come here }[EDIT] The matched string inside the bracke...
How do I reload Unicorn without killing the master process?
I have a RubyOnRails project, and deployed it with Unicorn on nginx on an Ubuntu server.I need to restart Unicorn if I change one of configuration files, but it makes my site shut down when I kill Unicorn's master process and start it again withbundle exec.Is there any way to make Unicorn work with new files without ki...
In my capistrano deploy.rb I have:desc "Zero-downtime restart of Unicorn" task :restart, :except => { :no_release => true } do run "kill -s USR2 unicorn_pid" endThis is well documented in "Lighting fast, zero-downtime deployments with git, capistrano, nginx and Unicorn".
413 Request Entity Too Large - Elastic Beanstalk + Load Balancer + Node.js application
I have looked on all possible stackoverflow posts and have tried all the different aproaches. None worked. There seems also no official documentation on this. Everything works fine in my local app, and I can upload images of any size, but as soon as its deployed in my elastic beanstalk, I seem to have a limit of 1M per...
The probable reason why yourproxy.confis not being used is because you are using current version of EB, which runs onAmazon Linux 2(AL2). However, the proxy settings you are trying to use are for old version of EB running on AL1.For AL2, the nginx settings should be placed in.platformfolder, not in.ebextenationsas show...
NGINX read body from proxy_pass response
I have two servers:NGINX (it exchanges file id to file path)Golang (it accepts file id and return it's path)Ex:When browser client makes request tohttps://example.com/file?id=123, NGINX should proxy this request to Golang serverhttps://go.example.com/getpath?file_id=123, which will return the response to NGINX:{ data...
I assume you are software developer and your have full control over your application so there is no need to force square peg in a round hole here.Different kinds of reverse proxies supportESI(Edge Side Includes)technology which allow developer to replace different parts of responce body with content of static files or ...
Forward HTTPS traffic thru Nginx without SSL certificate
I want to use Nginx to expose my NodeJS server listening on port 443.I don't want to manage the SSL certificate with Nginx. I would rather do that on the NodeJS server using theSNICallbackoption ofhttps.createServer.How do I setup thenginx.confto support this?
You're looking for ssl pass-through. You'll set up your nginx to use TCP load balancing (even if you only have one server it's still thought of as load balancing) and ssl passthrough. Note that nginx will be unable to access any of the content and that you will lose almost all of the advantages of using a proxy other ...
Correct nginx configuration to prevent indexing of some folders
I'm using the followingNginxconfiguration to prevent the indexing of content in some of my folders when I use thex-robots taglocation ~ .*/(?:archive|filter|topic)/.* { add_header X-Robots-Tag "noindex, follow"; }The content remains indexed but I can't debug theNginxconfiguration.My questions: is the configur...
The configuration you've written is correct. I'd give one caveat (assuming your config is otherwise standard):It will only output the X-Robots-Tag when the result code is 200, 201, 204, 206, 301, 302, 303, 304, or 307 (e.g. content matches a disk file, a redirect is issued, etc.). So if you have an/archive/index.html, ...
How to test load balancing in nginx?
I done congfiguration in nginx for redirection and it works successfully. But in that i want load balancing :- for that i already createload-balancer.confas well as give server name into that file like :-upstream backend { # ip_hash; server 1.2.3.4; server 5.6.7.8; } server { listen 80; location / { ...
Create a log file for upstream to check request is going to which serverhttp { log_format upstreamlog '$server_name to: $upstream_addr {$request} ' 'upstream_response_time $upstream_response_time' ' request_time $request_time'; upstream backend { # ip_hash; server 1.2.3.4; server 5.6.7.8; } server ...
connect() failed (111: Connection refused) while connecting to upstream. Java (SparkJava) amazon Elastic
Trying to deploy my first app (Back-end). But I meet an error of the type 502 Bad Gateway.2016/05/03 14:46:14 [error] 2247#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.43.183, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myHost.eu-west...
From your logs:upstream: "http://127.0.0.1:5000/"I see, nginx is trying to connect to 5000 port on the same machine and it is refusing the connections. What is running on 5000 port? You may need to look into that.
Nginx single application config
I'm writing an AngularJS single page application using nginx.I just switched from apache to nginx, but I cant make my config file working. I'm trying to rewrite everything toindex.htmlto let Angular do the routing.Mynginx.confis as follow:server { index index.html; location / { expires -1; add_header Pragm...
You dont want nginx.conf in the project root and its not necessary. Also, you don't want direct changes to nginx.conf, you will instead want specific files for different websites in /etc/nginx/sites-available which you enable with alnin /etc/nginx/sites-enabled.As far as the config:server { root /var/www/mysite/; #or ...
Nginx try_files (folders + files) fallback
Given this folder structure:root folder + default + settings1.txt + settings2.txt ... + settingsN.txt + user00001 + settings1.txt ... ... + userN + settings1.txt ...And this example url:domain.com/user00009/settings1.txtOrdomain.com/xavi/so...
location ~ ^(/[^/]+)(/.+)$ { root ...; if (!-d "$document_root$1") { return 404; } try_files $1$2 /default$2 =404; }
Nginx returns 426
When I am accessing a Istio gatewayNodePortfrom the Nginx server usingcurl, I am getting response properly, like below:curl -v "http://52.66.195.124:30408/status/200" * Trying 52.66.195.124:30408... * Connected to 52.66.195.124 (52.66.195.124) port 30408 (#0) > GET /status/200 HTTP/1.1 > Host: 52.66.195.124:30408 > U...
HTTP 426 error meansupgrade required:The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.oranother info:The HTTP426 Upgrade Requiredclient error response code indicates that the server refuses to perform the request using t...
Load CSS and Js files with Nginx
I am trying to serve an Angular deployed site (I have a dist directory with the index.html file) in Nginx. In that directory I have:index.htmljs filescss filesassetsI don't have experience in Nginx, so I am trying to serve correctly this site. My configuration for that site is:server { listen 80; server_name s...
You are missing arootfor one of yourlocationblocks, but as they all share the sameroot, it should be moved to theservercontext anyway.You do not need both thetry_filesand theif...rewrite. The same functionality can be achieved usingtry_filesalone.The lastlocationblock is unnecessary as it uses the samerootaslocation /....
Connect failed: php_network_getaddresses: getaddrinfo failed: System error
Connect failed: php_network_getaddresses: getaddrinfo failed: System errorThe"System error"part really throws me off.I've been battling this error for a few months, it is very sporadic. It appears to be coming from my database connector.Restartingphp-fpmseems to alleviate the issue for ~24 hours until it starts actin...
after some digging, I think what our problem was is that our configuration did not have max_requests set, the children were never recycling. We did have process_idle_timeout set, but we had some scripts running on cron that were keeping the processes alive.so if for everybody else:// amount of requests it handles befor...
Streaming server issue with gunicorn and flask and Nginx
I am using gunicorn and flask for a web service. I am trying to get my head around running a streaming route (not sure if that is the correct terminology).my route looks like this:@app.route('/delay') def delay(): from time import sleep def delay_inner(): for i in range(10): sleep(5) ...
You need to turn off the nginx proxy buffering.location /delay { proxy_pass http://127.0.0.1:8080; proxy_buffering off; }and reload the confignginx -s reload
spring HATEOAS links issue for HTTP and HTTPS
I am usingSpring HATEOASin my web application. My application runs behind aNginxwebserver. I am sending following url with HTTPS headerGEThttps://national.usa.com/testapp-rest/api/user/654rtrtet-5grt-fgsdf-dfgs-765ytrtsdhshfgsh/newAuthenticationStatus Code:200 OK Response Headersview sourceAccess-Control-Allow-Headers:...
As you mentioned in the comments your application runs behind a webserver. In this case Nginx.You are using some sort oflinkTo(methodOn(MyController.class).myMethod(name)).withSelfRel());to generate links. In this case take a look atControllerLinkBuilder. As you can see in line 190 Spring HATEOAS builds a link based on...
nginx redirect all http to https with exceptions
I would like to redirect all http traffic to https with a handful of exceptions. Anything with /exception/ in the url I would like to keep on http.Have tried the following suggested byRedirect all http to https in nginx, except one filebut it's not working. The /exception/ urls will be passed from nginx to apache for s...
Nginx finds the longest matching location and processes it first, but your return at the end of the server block was being processed regardless. This will redirect everything but /exception/ which is passed upstream.server { listen 127.0.0.1:80; access_log off; location / { return 301 https://loca...
Detect if Rails is Running a Site
I am part of a team that manages a public facing cloud platform at my company. We have a large user base running VM's that face the internet. I would like to run an automated scan of our address space and see if anyone is running a Rails app so I can notify them to upgrade their version of Rails to avoid a critical sec...
Every Rails site has:meta content="authenticity_token" name="csrf-param'Or could have a submit button where thename="commit"At least that's what I have consistently seen.Header responses are not reliable, here are three from various Rails sites:Server:Apache/2.2.14 (Ubuntu) Server:nginx Server: thin 1.4.1 codename Chro...
How to write to log in python with nginx + uwsgi
I have a server running nginx + UWSGI + python. UWSGI is running as a daemon with the flag set:--daemonize /var/log/uwsgi.logwhich logs all application errors.I've noticed that on error if I use a python print statement it will write to the log but only on an error. The standard python logging library doesn't seem to a...
use logging.StreamHandler as logging handler
Serving remote static files with symfony3
I have a problem with my Nginx configuration. I have 2 servers, one with nginx and one with my webApp in symfony3. Here is my configuration :location /portal/mysite/ { set $frontRoot /srv/data/apps/mysite-portal-stag/current/web; set $sfApp app.php; # Change to app.php for prod or app_dev.php for dev roo...
Thetry_filesdirective automatically tries to find static files, and serve them as static, prior to giving up, and letting the request be served as a script.http://nginx.org/r/try_filesChecks the existence of files in the specified order and uses the first found file for request processing; the processing is performed i...
How nginx pick the configuration order?
In my /etc/nginx/nginx.conf file I have config. as:-user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main ...
For "how nginx processes configuration files", a simple way to look at it would be:reading of configuration starts with/etc/nginx/nginx.confdirectives are read from top to bottomincludeing a file inserts it at the location of theincludesimilar to the way the C preprocessor doesa setting has a scope, such ashttp,server,...
How to configure nginx to serve HTML files for viewing instead of downloading?
I want to configure nginx to server HTML files for viewing instead of downloading.server { listen 5000; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #} location = / { ...
location = /login { default_type "text/html"; alias /home/vagrant/own/base/assets/login.html; }I think the approach above is effective, there maybe other answers.
How to configure nginx to make ssh server via subdomain.domain.tld:80 available
I want to make the ssh server on port 22 available through a subdomain on port 80.I thought it should by something like this:server { listen ssh.domain.tld:80; server_name ssh.domain.tld; location / { proxy_pass http://localhost:22; } }But it won't work. nginx will accept ...
Since Nginx Version 1.9.0,NGINX support ngx_stream_core_module module, it should be enabled with the --with-stream. When stream module is enable they are possible to ssh protocol tcp proxystream { upstream ssh { server localhost:22; } server { listen 80; proxy_pass ssh; } }https://www.nginx.co...
NGINX brew install command not found
I do$ brew install nginxand get:==> Downloading http://nginx.org/download/nginx-1.2.2.tar.gz Already downloaded: /Library/Caches/Homebrew/nginx-1.2.2.tar.gz ==> Patching patching file conf/nginx.conf ==> ./configure --prefix=/usr/local/Cellar/nginx/1.2.2 --with-http_ssl_module --with-pcre --with-ipv6 --with-cc-...
run echo $PATH, does /usr/local/sbin appear? if not: Try sourcing your ~/.bashrc file and see if it appears: source ~/.bashrcrun echo $PATH again. It should apear.
Nginx rolling restart of Rails app with capistrano
For the life of me I can't figure out how to make this work properly.The problem is similar to what others have, such as:How to do a rolling restart of a cluster of mongrelsWe, however, are using Nginx/Passenger instead of Mongrel.The issue is that on a deploy if we use this standard :restart task:task :restart, :roles...
run "cd #{deploy_to}/current && echo 'ok' > public/lb.txt", :host => s.hostshould actually be:run "cd #{deploy_to}/current && echo 'ok' > public/lb.txt", :hosts => s.host
Set up https access to nginx docker container
I want to be able to access an nginx docker container via the https athttps://192.168.99.100. By now I have done the following:Dockerfile:FROM nginx COPY certs/nginx-selfsigned.crt /etc/ssl/certs/ COPY certs/nginx-selfsigned.key /etc/ssl/private/ COPY default-ssl.conf /etc/nginx/sites-available/default EXPOSE 443I h...
The reason for your error is because your copying the nginx SSL configuration to a folder nginx does not load by default. After changing this line in the Dockerfile -COPY default-ssl.conf /etc/nginx/sites-available/defaultTo this -COPY default-ssl.conf /etc/nginx/conf.d/default-ssl.confI'm able to reach Nginx with http...
docker compose oci runtime error, executable file not found in $PATH
I'm following this post:http://eric-price.net/blog/centralized-logging-docker-aws-elasticsearchThis is what my docker-compose.yml looks like :version: "2" services: fluentd: image: fluent/fluentd:latest ports: - "24224:24224" command: start.sh networks: - lognet nginx: image: ngin...
The command is executed inside the container- you are using a pulled fluentd container which does not have your start.sh file in it. You can eitherA. bind mount it into the container#docker-compose.yml fluentd: image: fluent/fluentd:latest volumes: - ./start.sh:/start.sh command: /start.shor B. bu...
How to set nginx reverse proxy?
Onlanding.example.com:10000have I a webserver that works fine, which is a Docker container that exposes port10000. Its IP is172.17.0.2.What I would like is having a nginx reverse proxy on port80, and send the visitor to different Docker containers depending on the URL they visit.server { listen 80; server_name ...
The server doesn't answer because it is not defined as an upstream.try this:upstream my_server { server 172.17.0.2:10000; } server { listen 80; server_name landing.example.com; location / { proxy_pass http://my_server; proxy_set_header Host $host; proxy_set_hea...
nginx.conf for a restful api
I'm currently developing a RESTful api as a bridge between my ios/web application and their shared database, and content.I found my way to implement RESTful api in PHP onthis blog.I started my development on my OVH Apache-based server. Unfortunately, they didn't provide oauth support on web hosting services and there i...
Thanks tothishtaccess to nginx.conf converter, and some tricks and tests I've made,here is the corresponding nginx.conf file.I hope it will help people. ;)EDIT: link to my configuration is dead, but the converter is still available. As long as you have a valid Apache configuration you're good to go.
Protect Jenkins with nginx http auth except callback url
I installed jenkins on my server and I want to protected it with nginx http auth so that requests to:http://my_domain.com:8080 http://ci.my_domain.comwill be protected except one location:http://ci.my_domain.com/job/my_job/buildneeded to trigger build. I am kinda new to nginx so I stuck with nginx config for that.upstr...
Finally I figured out how to solve this problem. At first we need to uncheck "Enable security" option at Manage Jenkins page. With security disabled we can trigger our jobs with requests likehttp://ci.your_domain.com/job/job_name/build.If you want to add token to trigger URL we need to Enable Security, choose "Project-...
configuring nginx to serve static json files
Switching to nginx for a site, one issue I'm having is serving up static json files.I added to the mime types:application/zip zip; ... application/json json; ...and restarted but it tried serving it up as a download (iehttp://domain.com/json-tmp/locations.json). What else ...
I know this post is quite old but adding application/json mime type to nginx configuration file plus restarting the server should work.When you request the json file try to debug the response header and check if the Content-Type header was successfully changed to application/json.
Refused to frame '' because it violates the following Content Security Policy directive
We use the Confluence Companion tool to edit files from Confluence locally (https://confluence.atlassian.com/doc/edit-files-170494553.html) but since the last update of that tool, it is no longer working. I found out that it is because of the CSP directive that we've set in NGINX, but no matter the changes i make; noth...
Confluence 7.3+ launches Companion with a custom protocol prefixed withatlassian-companion:. This is constructed using a hidden iframe to prevent the page from redirecting.Therefore, to resolve this issue, please addatlassian-companion:to yourdefault-srcorframe-srcexclusions in your Content Security Policy. For example...
Proxy pass remote_user with nginx
I have a firewall that is the SSL terminator and sets the remote_user header. This header should be passed onto an application, however we have an nginx proxy sitting in the middle.Browser over SSL -> Firewall proxy -> Nginx proxy -> AppI cannot for the life of me figure out how to pass the remote_user header to the Ap...
You need to use a combination ofproxy_pass_request_headers onandunderscores_in_headers onsince your header contains an underscore.underscores_in_headersneeds to be placed in your http block.See:http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headersOLD ANSWERYou are looking forproxy_pass_headerSe...
How to add websocket support to an ingress resource in Kubernetes on IBM Bluemix?
When the client tries to connect our ingress defined endpoint via awss://request, the app returns 400 bad request, which according to socket.io docs is due to missing headers removed by load balancing proxies like nginx.apiVersion: extensions/v1beta1 kind: Ingress metadata: name: my-ingress annotations: nginx.o...
Websockets is not currently supported, we are working on adding it and I will update here when it is available.Thank youEdit: Websocket support is available in all regions, the annotation for it is:annotations: ingress.bluemix.net/websocket-services: service-name
How can I apply consistent indentation and formatting to Nginx config files?
I have got this messy config for example:server { listen 80 default; server_name localhost; location / { proxy_method $foo; proxy_pass http://foobar:8080; } }and I would like to make it look like:server { listen 80 default; server_name localhost; location / { ...
There are a few formatters out there, such as:Nginx Formatter(python) by 1connect which has a nice locally runable tool, works very good!Nginx Formatter(python)at blindage.org , didnt try that one but it seems good by his example outputs.Nginx Beautifier(javascript) also available atnginxbeautifier.comas a tiny js tool...
What is www.conf?
I know whatphp.iniis for which can be found in/etc/php/7.0/fpmdirectoryI can't find documentation whatwww.confis designed for? It can be found in/etc/php/7.0/fpm/pool.d
Pool Directives are aPHP-FPM conventionwhere multiple "pools" of child processes can be started and have different configurations. The default name for the pool directives file iswww.conf.Take a look atthis linkfor more information and sample configurations.
Which prefix does NGINX use for "include"?
While I'm compiling NGINX, I get this message:nginx path prefix: "/tmp/app" nginx binary file: "/tmp/app/progs/nginx/sbin/nginx" nginx configuration prefix: "/tmp/app/progs" nginx configuration file: "/tmp/app/progs/nginx.conf"Does NGINX use thepath prefixor theconfiguration prefixforincludedirectiv...
The documentationsuggests that it's the "prefix path":–prefix=pathdefines a directory that will keep server files.This same directory will also be used for all relative pathsset by configure (except for paths to libraries sources) andin the nginx.conf configuration file. It is set to the/usr/local/nginxdirectory by def...
nginx with expires on javascript files (dynamically generated by PHP)
I have a problem withexpiresheaders on javascript files which are generated by PHP..The website has two types of javascript files. One part is static javascript files and one part is dynamically generated by PHP.conf without expires headersHere noexpiresheaders are added to the.jsfiles (All files returnHTTP 200)locatio...
For nginx, PHP is never Javascript. Nginx can't distinct between PHP which renders html and PHP which renders javascript (please correct me if I'm wrong).So the way to go would be either to setup a seperate folder with PHP files which generate all JS (code is not tested!):location ~ \normal_php/.php$ { include /va...
Updating Django App on server
I am relatively new to Python/Django and have successfully deployed my first app. I want to update it now with some new changes, but I am not sure what the proper process is. My setup is ubuntu/nginx/gunicorn/postgres.At the moment I am taking the following steps:Stop nginx: sudo service nginx stopStop gunicorn: sudo s...
One lazy (yet recommendedandprofessional) way of going about app updates is running automation script, likeFabricorAnsible.However, if you wish to proceed the manual way (which is tedious), you might do something like:Pull from gitRun migrationspython manage.py migrate(This should ensure changes you made locally to you...
proxy_cache_min_uses time window
nginx proxy has a directiveproxy_cache_min_usesbut I can't find what's the time window used or how to set one. Because if it doesn't use any time window and just waits for the requests to reach some counter then eventually all requests will do, if you keep nginx running for long enough.Or a relatively rare request woul...
proxy_cache_min_usesjust counts the number of requests after which the response from upstream will be cached.Requests are evicted from cache when they are not accessed within an expiration time or when the size of the cache exceeds a max value (using LRU algorithm). You can tune the proxy cache via theproxy_cache_pathd...
Django Nginx Gunicorn = 504 Timeout
I'm trying to publish a Django application on the production server using Nginx + Gunicorn. When I doing a simple stress test on the server (holding the F5 key for a minute) the server returns a504 Gateway Time-outerror. Why does this happen? This error only appears for the user when doing multiple concurrent request...
When you hold down F5:You've started hundreds of requests.Those requests have filled your gunicorn request queue.The request handlers have not been culled as soon as the connection drops.Your latest requests are stuck in the queue behind all the previous requests.Nginx times out.For everyone.Solutions:Set up rate-limit...
Nginx + FastCGI + PHP (php-fpm) not logging caught errors/warnings
FastCGI doesn't want to log PHP errors properly. Well, that's not entirely true: it logs errors fine, with a little fiddling; it just won't log anything else, such as warnings.The notorious FastCGI -> Nginx log bug isn't an issue, necessarily. Errors and warnings from php-fpm go straight to Nginx--but only if they're...
I use this directive in the pool configuration file for PHP-FPM:catch_workers_output = yes
uWSGI keepalive
Is it possible somehow to pass through the keepalive limitation of uwsgi? If not, what is the best way of persistent connection implementation. I'm using NGiNX + uWSGI (Python), and I want clients to have asynchronous updates from server.
UWSGI supports keep-alive via --http-keepalive option if you receive requests via http./tmp$ cat app.py def application(env, start_response): content = b"Hello World" start_response('200 OK', [ ('Content-Type','text/html'), ('Content-Length', str(len(content))), ]) return [content]Run wi...
How to replace nginx errors
Is it possible to replace 502 errors on nginx.conf (php-fpm problems), with 503?502 = bad gateway503 = server overloadednginx: 502googlebot: Hmmm, I don't like that... sorry but... penalized...nginx: 503googlebot: Hmmm, no problem, I will try again later...nginx: thank you for your willingness to understand
Make surefastcgi_intercept_errorsis set toon, and use theerror_pagedirective:location / { fastcgi_pass 127.0.0.1:9001; fastcgi_intercept_errors on; error_page 502 =503 /error_page.html; # ... }
Mono MVC 2 home route doesn't work
I'm trying to convert an ASP .NET MVC 2 app to run on nginx/mono 2.8. So far it seems to work quite well except that the default route doesn't work when the path is empty. I am proxying all requests through to the fastcgi server and I get served up with an ASP .NET 404 not found page.i.e. This doesn't workhttp://mysite...
I actually ran into the same problem and solved it (at least in my situation) by complete mistake...In thenginx walkthroughon the mono project's site, it says to enter these lines in your nginx.conf file:index index.html index.htm default.aspx Default.aspx; fastcgi_index Default.aspx;Well, I set this up in the exact sa...
Sinatra on Nginx configuration - what's wrong?
I followedthistutorial more or less... I installed the passenger gem, executed passenger-install-ginx-module, sucessfully installed nginx and inserted this into the config:server { listen 80; server_name localhost; root /home/admin/sintest/public; # <--- be sure to point to 'public'! passenger_enabled on; }In...
Make sure that the user nginx is running as (in most cases 'nobody' or 'www-data') has permission to read the contents of your home directory /home/admin.Also you can look into the nginx logs and read exactly what the error was.
Is Passenger Deprecated for Nginx versions above 1.14?
I updated nginx from version1.14to1.18 (Ubuntu)onUbuntu 18.04.Doing so appeared to break passenger. So I uninstalled and attempted to reinstall the Open Source Passenger version via thePassenger installation Ubuntu 18.04 instructions.I got to this line:sudo apt-get install -y libnginx-mod-http-passengerWhich throws th...
It is not deprecated, no. The problem is that the packaged module you are trying to install was made for an older Nginx version that is distributed through the system default repository. This appears in theinstallation guidethat you've mentioned:At this point we assume that you already have Nginx installed from yoursys...
How to get HTTPS on AKS without ingress
My problem is simple. I have an AKS deployment with a LoadBalancer service that needs to use HTTPS with a certificate.How do I do this?Everything I'm seeing online involves Ingress and nginx-ingress in particular.But my deployment is not a website, it's a Dropwizard service with a REST API on one port and an admin serv...
A sidecar container with nginx with the correct certificates (possible loaded off a Secret or a ConfigMap) will do the job without ingress.Thisseems to be a good example, usingnginx-ssl-proxy container.
Kubernetes Ingress Nginx loading resources 404
HyWe're trying to get our website working on kubernetes (running in a container using nginx). We use ingress to route to the site, here is our configuration:nginx-conf:server { listen 80; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html =404; } }Kub...
This is not a routing problem on nginx part, but the browser trying to access an absolute URI from the root of your domain. Use relative URIs (remove the leading slash):
Multiple SSL Certificates and HTTP/2 with Express.js
Scenario:I have an express.js server which serves variations of the same static landing page based on wherereq.headers.hostsays the user is coming from - think sort of like A/B testing.GET tulip.flower.comservespages/flower.com/tulip.htmlGET rose.flower.comservespages/flower.com/rose.htmlAt the same time, this one IP i...
Nginx can handle SSL termination nicely, and this will offload ssl processing power from your application servers.If you have a secure private network between your nginx and application servers I recommend offloading ssl via nginx reverse proxy. In this practice nginx will listen on ssl, (certificates will be managed o...
Use ExpressJS app via FastCGI
Just started deal with NodeJS web apps and have a fundamental question.Since i came from the PHP realm, i know PHP have abuilt-in HTTP serverbut no one actually use it and we used nginx and in the prehistoric projects Apache as HTTP server, when i came into ExpressJS i found that all examples talking about listening to...
You won't do mistakes like that ifyou lint your code,run under strict mode, and don't use global variables like that.Also in nodejs web applications you generally want to make the server stateless and keep all the data in the databases. This would also make it a more scalable architecture.In applications that are secur...
Nginx: return error 403 and display a message
I'd like nginx to return an error 403 if user-agent is MSIE 6 and to display a custom error message. I used this code and everything worked the first minutes. Then it just returned the error without the message! Don't know why... Here's the code (I tried to put ' instead of ", to have plain text without ' or ", still n...
Actually, your configuration should work. You can check it using curl:# curl -i -H "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1" http://localhost/i.php HTTP/1.1 403 Forbidden Server: nginx/1.3.6 Date: Wed, 26 Dec 2012 10:05:34 GMT Content-Type: application/octet-stream Content-Length: 62 Connection: k...
Nginx's speed, and how to replicate it
I'm interested in this from more than an academic standpoint rather than a practical standpoint; I don't plan on creating a production webserver to compete with nginx. What I'm wondering is how exactly nginx is so fast. The top google response for this isthisthread, but it merely links to a cryptic slideshow and a gene...
Turns out my little test server was quite competitive with nginx once I told it to read files in binary mode instead of list mode.I think a lot of the discussion in the rest of this thread may be confusing for someone unfamiliar with erlang and erlang server design. I didn't want to delete the thread since there is goo...
configure nginx in passenger 3.0.2 stand alone
In older passengers (3.0.0) it was possible to configure the standalone nginx passenger (passenger start). In the.passenger-Dir there was a complete nginx installation (3.0.0-x86_64-ruby1.9.2-macosx-10.6/nginx).In 3.0.2 there only is a sbin-dir. the config directory is missing. Where can I find the config files?
Fromhere:We do not plan on supporting this. Phusion Passenger Standalone is meant to be its own web server, designed to handle the most basic use cases very very well at the expense of customizability. That it happens to be using Nginx under the hood today is an implementation detail that the user should not bo...
Can I use Nginx Certbot to put ssl in an aws default ec2 domain?
I tried to put the command to get the certificate but it gave me this error: An unexpected error occurred: The server will not issue certificates for the identifier :: Error creating new order :: Cannot issue for "ec2-34-237-242-160.compute-1.amazonaws.com": The ACME server refuses to issue a certificate for this domai...
Let's Encrypt blocks Amazon AWS domains because the domain names are transient and are subject to change.https://community.letsencrypt.org/t/policy-forbids-issuing-for-name-on-amazon-ec2-domain/12692/4
connect() failed (113: Host is unreachable) while connecting to upstream nginx for aws
I know the this question is asked multiple times and not related to aws.2020/07/29 10:23:17 [error] 6#6: *37749 connect() failed (113: Host is unreachable) while connecting to upstream, client:I am facing this issue while I have deployed nginx in aws cloud.localtion configurationlocation /test { proxy_pass htt...
After long debugging, we found that nginx will cachetest-service.internalips. And aws will chang it's internal load balancer's ips.So nginx cached ips are no more exist. so we need to provide new ips.Solution:nginx has providedresolverdirectivelocation /test { resolver 10.0.0.2 127.0.0.1 valid=30s; ...
.well-known/acme-challenge nginx 404 error
I'm trying to verify a file upload for SSL certificate. The file needs to be.well-known/acme-challenge/fileI have successfully placed the file as above, but while accessing the same file from the webhttp://weburl.com/.well-known/acme-challenge/file, 404 error is coming up. When I place the same file in.well-known/the f...
You have to grant permissions for www-data user.sudo chown -R www-data:www-data .well-known
NGINX set cookie based on value of a header
I'm trying to get NGINX to check if a request headeruser_header_tokenis present. If it is not present, redirect to the login site. If it is present, set a cookie with the header's value. The cookie is empty when it is set currently instead of the$http_variable I'm trying to set it to. Does anyone see what I'm doing tha...
What kind of response are you getting? If there is an error in your response, you may need to add thealwaysflag or the header may not be added.http://nginx.org/en/docs/http/ngx_http_headers_module.htmlSyntax: add_header name value [always];If the always parameter is specified (1.7.5), the header field will be added ...
Nginx: Difference between deny all; and return 403;
Disregarding best practices, does usingreturn 403achieve the exact same effect asdeny all;? From the docs:Deny:Denies access for the specified network or address.Return:Stops processing and returns the specified code to a client.Does "denies access" mean the same as "stops processing and returns the specified code"? If...
deny allwill have the same consequence but leaves the possibilities of slip-ups:If you have auth_basic and/or allow in a parent block with a satisfy directive, requestssatisfyingthose criteria(s) will have access in an inheriting block that at face value is denying access. This is of no concern if you don't use this fe...
How to set umask for php5-fpm on Debian?
I'm runningphp5-fpmwithnginxconnected via port (not socket). It's stock Debian Jessie with all packages installed viaapt-get.I'm trying to change default umask for www-data user thatphp5-fpmis using from0022to0002to allow group write permissions. I've tried:editing/etc/init.d/php5-fpminit script and adding--umask 0002t...
I was able to set the umask forphp5-fpmservice by editing it'sunit.servicefile as suggestedhereandhere. The complete and working solution for Debian 8 is this:Manually edit/etc/systemd/system/multi-user.target.wants/php5-fpm.servicefile and addUMask=0002line inside[Service]section.Run commandsystemctl daemon-reloadRun ...
RoR 5.0.0 ActionCable wss WebSocket handshake: Unexpected response code: 301
Hello I'm trying to serve a simple chat using ror 5.0.0 beta (with puma) working on production mode (in localhost there are no problems).This is myNginxconfiguration:upstream websocket { server 127.0.0.1:28080; } server { listen 443; server_name mydomain; ssl_certificate ***/server.crt; ssl_certi...
Isolvedadding phusion passenger.nginx config is now :server{ listen 80; passenger_enabled on; passenger_app_env production; passenger_ruby /../ruby-2.3.0/ruby; root /path to application/public; client_max_body_size 4G; keepalive_timeout 10; [...] location /cable{ passenger_app_group_name websocket; ...
Reverse proxy from nginx to squid
Similar tothis, I am trying to host a squid proxy behind nginx:example.com- the main siterelay.example.com- the squid server.So far, when I try to use the squid proxy, it will complain about accessing an illegal page, for example, if I try to accesshttp://www.google.com, I get an Invalid URL error saying that the URL/h...
in nginx:proxy_pass http://@squid;in squid:http_port 3128 vhostand that's all you need for fix thishttps://i.stack.imgur.com/9FSB8.jpgerror
What is the difference between mod_wsgi and uwsgi?
There seems to be mod_wsgi module in Apache and uwsgi module in Nginx. And there also seems to be the wsgi protocol and uwsgi protocol.I have the following questions.Are mod_wsgi and uwsgi just different implementations to provide WSGI capabilities to the Python web developer?Is there a mod_wsgi for Nginx?Does uwsgi al...
They are just 2 different ways of running WSGI applications.Have you tried googling formod_wsgi nginx?Any wsgi compliant server has that entry point, that's what the wsgi specification requires.Yes, but that's only howuwsgicommunicates with Nginx. Withmod_wsgithe Python part is run from within Nginx, withuwsgiyou run a...
What does the "shared memory zone" mean in nginx?
According to the nginx documentation, theproxy_cache_pathdirective has a parameter calledkeys_zone. The documentation also refers a concept of "shared memory zone".In addition, all active keys and information about data are stored in a shared memory zone, whose name and size are configured by the keys_zone parameter. O...
A shared memory zone is a general term. Within the context of Nginx, a shared memory zone is defined so that worker processes can share stuff, for example, counters when you want to apply access limits.In case you're not familiar with worker processes, check this image.
Reverse proxying HTTP/2 from h2 to h2c
We have a java web server which is able to serve content over h2c (HTTP/2 clear text)We would like to reverse proxy connections established using h2 (i.e. standard HTTP/2 over SSL) to the java server in h2c.Enabling HTTP/2 on nginx is simple enough and handling incoming h2 connections works fine.How do we tell nginx to...
HAProxydoes support that.HAProxy can offload TLS and forward to a backend that speaksh2c.Details on how to setup this configuration are available inthis blog post.
.NET 6.0: new Blazor project throws Websocket error
I am running currently a webserver with ASP.NET Core 3.1 and a Blazor project. Recently when upgrading to .NET 6.0 I encountered (even with a blank Blazor project) some problems with a websocket error message in the browser only when deployed on my webserver (see message below).Locally (on Windows 11 x64, VS 22 Preview...
Here is the solution described again, maybe a little bit more convenient:To fix this problem, I changed in the site-configuration (/etc/nginx/sites-available) of nginx the following variables:proxy_set_header Connection $connection_upgrade;toproxy_set_header Connection $http_connection;For me this solved the problem.
How to make socket.io work properly with pm2 cluster mode?
I have been looking at various solutions around but when I put it all together, it looks very confusing.I am trying to implement pm2 cluster mode for my application which has socket.io implementation. Now, I understand the concept that statelessness is required in order to make my app work properly in cluster mode. And...
I've got thesolution!!! And it is working perfectly fine for me! Thanks to @elad and contributors. I've done some extensive amount of testing(more than 2 MONTHS!) and never had a problem. I'll not disrespect the author by explaining what the snippet does as it has already been described enough, line-by-line.It took me ...
puma: puma.sock No such file or directory
I used ansible script for server setup:playbook.ymlGemfileAnd when I deployed my application to server, I see this in nginx/error.log:2016/09/30 20:43:07 [crit] 1352#0: *1 connect() to unix:/home/deploy/applications/spa_backend/shared/tmp/sockets/puma.sock failed (2: No such file or directory) while connecting to upstr...
Capfile:require 'capistrano/puma'it helped me
Nginx unknown directive "proxy_pass"
I'm having a problem with nginx configuration.When I set the configuration like this:server { server_name redmine; listen 80; location / { proxy_pass http://172.16.0.70:33000; } }I get this error nginx: [emerg] unknown directive "proxy_pass".My nginx version is nginx/1...
Seems that modulengx_http_proxy_moduleis not installedRunnginx -Vto view how nginx is configured. If it is configured with option--without-http_proxy_modulethan nginx doesn't have proxy module and should be recompiled.
Corrupt image when extract from zip
I trying download a zip file using curl from one virtual host to another, in a same server. Zip file contains *.php and *.jpg files.The problem is:sometimes JPG files get corrupt, like this:Here is my code :$out = fopen(ABSPATH.'/templates/default.zip','w+'); $ch = curl_init(); curl_setopt($ch, CURLOPT_FILE, $out); ...
Finally i found what is the problem.I'm using Nginx web server, when i change nginx config files:sendfile on;becamesendfile off;My image not corrupt anymore. So its not php or curl problem. Interesting article:http://technosophos.com/node/172
How to securely have many to many users on virtual hosts
I currently setup a single user on my virtual host like this:sudo useradd -d /website/ -m user -s /usr/bin/rssh sudo chown root:root /website/ -R #Don't get why I need this part but doesn't work without! sudo chmod 755 /website/ sudo chown -R user:www-data /website/public_html sudo chmod 755 /website/public_htmlThis ...
You can create a new group for each virtual host and add www-data and other granted users to this. Then set that group as the owner of your files (chown). With specifying an appropriate permission (like 775) you will be there.
What is the difference between static and dynamic modules in nginx? [duplicate]
What is the difference between static and shared libraries?I use Eclipse and there are several project types including Static Libraries and Shared Libraries? Does one have an advantage over the other?
Shared libraries are .so (or in Windows .dll, or in OS X .dylib) files. All the code relating to the library is in this file, and it is referenced by programs using it at run-time. A program using a shared library only makes reference to the code that it uses in the shared library.Static libraries are .a (or in Windows...
Cannot spawn application
I have rvm, passenger, ruby 1.9.3, nginx but I now get this errorCannot spawn application '/path/to/my/app': Could not read from the spawn server: Connection reset by peer (104)I havepassenger_rootset to the output ofpassenger-config --rootandruby-1.9.3-p125forpassenger_rubyI did have to dorvmsudo passenger-install-ngi...
This is happening most likely because your passenger user does not have permissions to run your application or your application itself is not starting up properly.
PHP-FPM status page is blank after nginx update from 1.2.1 to 1.9.2
I've been using Nginx 1.2.1 for a while now, and because of security issues, I decided to upgrade to 1.9.2.Problem is : php-fpm status page is now serving me a fully blank page.HTTP response code says : 200 ok, but content = 0 bytesWhat I tried :Checking Nginx user / group : it's www:www (as it was before) Checking Php...
Try this:location ~ ^/(php_status|ping)$ { # access_log off; allow 127.0.0.1; allow MY_IP_ADRESS; deny all; include fastcgi_params; # This is important fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/var/run/php5-fpm....