Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
What is the correct way to leave gunicorn running?
I want to make a Flask+Nginx+Gunicorn deployment. I have Nginx setup and running and I run gunicorn as described in the docs:gunicorn app:appBut when I logout of the server the gunicorn process exits? What is the correct way to make sure it stay running for Nginx to connect to, and restarts if it crashes?
I'd look into something likeSupervisor.Very useful tutorial can be found herehttps://www.codingforentrepreneurs.com/blog/hello-linux-setup-gunicorn-and-supervisor/
How do I redirect HTTPS to HTTP on NGINX?
Is there a way to redirect HTTPS requests to HTTP by adding a rule in the domain's vhost file?
Why is something like that useful? At first look I wasn't sure if it could be done. But it presented an interesting question.You might try putting a redirect statement in your config file and restarting your server. Two possibilities might happen:The server will issue the redirect - what you seem to want.The server wil...
docker compose override a ports property instead of merging it
My docker compose configs look like this:docker-compose.ymlversion: '3.5' services: nginx: ports: - 8080:8080docker-compose.prod.ymlversion: '3.5' services: nginx: ports: - 80:80Now, when I run command:docker-compose -f docker-compose.yml -f docker-compose.prod.yml upth...
This behaviour is documented athttps://docs.docker.com/compose/extends/#adding-and-overriding-configurationFor the multi-value optionsports,expose,external_links,dns,dns_search, andtmpfs, Compose concatenates both sets of valuesSince theportswill be the concatenation of the ports in all your compose files, I would sugg...
jQuery Upload Progress and AJAX file upload
It seems like I have not clearly communicated my problem. I need to send a file (using AJAX) and I need to get the upload progress of the file using theNginx HttpUploadProgressModule. I need a good solution to this problem. I have tried with the jquery.uploadprogress plugin, but I am finding myself having to rewrite mu...
Uploading files is actually possible with AJAX these days. Yes, AJAX, not some crappy AJAX wannabes like swf or java.This example might help you out:https://webblocks.nl/tests/ajax/file-drag-drop.html(It also includes the drag/drop interface but that's easily ignored.)Basically what it comes down to is this: (demo:http...
How to debug "FastCGI sent in stderr: Primary script unknown while reading response header from upstream" and find the actual error message?
SO has many articles mentioning this error code:FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream...That probably means that this error message is more or less useless.The message is telling us that the FastCGI handler doesn't like whatever it was sent for some reason. The pr...
To answer your question:in php-fpm.d/www.conf file:set the access.log entry:access.log = /var/log/$pool.access.logrestart php-fpm service.try to access your pagecat /var/log/www.access.log, you will see access logs like:- - 10/Nov/2016:19:02:11 +0000 "GET /app.php" 404 - - 10/Nov/2016:19:02:37 +0000 "GET /app.php" 40...
Serving two sites from one server with Nginx
I have a Rails app up and running on my server and now I'd like to add another one.I want Nginx to check what the request is for and split traffic based on domain nameBoth sites have their own nginx.conf symlinked into sites-enabled, but I get an error starting nginxStarting nginx: nginx: [emerg] duplicate listen optio...
The documentation says:The default_server parameter, if present, will cause the server to become the default server for the specified address:port pair.It's also obvious, there can be only onedefaultserver.And it is also says:A listen directive can have several additional parameters specific to socket-related system ca...
Nginx location "not equal to" regex
How do I set alocationcondition in Nginx that responds to anything that isn't equal to the listed locations?I tried:location !~/(dir1|file2\.php) { rewrite ^/(.*) http://example.com/$1 permanent; }But it doesn't trigger the redirect. It simply handles the requested URI using the rules in the rest of the server conf...
According tonginxdocumentationthere is no syntax for NOT matching a regular expression. Instead, match the target regular expression and assign an empty block, then use location / to match anything elseSo you could define something likelocation ~ (dir1|file2\.php) { # empty } location / { rewrite ^/(.*) http:...
worker_connections are not enough
I am trying accesskibanaapplication deployed innginx,but getting belowURL :-http://127.0.0.1/kibana-3.1.22015/02/01 23:05:05 [alert] 3919#0: *766 768 worker_connections are not enough while connecting to upstream, client: 127.0.0.1, server: , request: "GET /kibana-3.1.2 HTTP/1.0", upstream: "http://127.0.0.1:80/kibana-...
Not quite enough info to say definitively, but based on the config you've provided, it looks like you have loop. You're proxying the requests to localhost:80, but NGINX is most likely listening on port 80. So, NGINX is connecting to itself over and over, hence the errors about too many open files.Also, Kibana doesn't h...
"Incomplete response received from application" from nginx / passenger
I tried to deploy my rails app on nginx and ubuntu via capistrano like the tutorial on the pagehttps://gorails.com/deploy/ubuntu/14.04. but at the end i get an error message:Incomplete response received from applicationin my browser. this is probably an error from passenger, but how can i figure out what to do?
Your rails_env production don't have required set up,probably missing secret_key_base.Open/etc/nginx/sites-available/defaultand change the rails_env to development:rails_env production; to rails_env development;If the app is loading it's not a passenger issue.Production Solution:Enter your app rootrun:rake secr...
What benefit is added by using Gunicorn + Nginx + Flask? [duplicate]
This question already has answers here:Are a WSGI server and HTTP server required to serve a Flask app?(3 answers)Closed5 years ago.I see people are running setups like Nginx + Gunicorn + Flask.Can someone explain what is the benefit of having Gunicorn in front of Flask? Why not just run Flask alone? Doesn't it consume...
I think you may be confused, Flask is not aweb server, it is a framework and needs some sort of web server, such as Gunicorn, Nginx or Apache, to accept HTTP requests which it will then operate on. The reason why people run Nginx and Gunicorn together is that in addition to being a web server, Nginx can also proxy con...
What does [::] mean in my nginx config file
I was looking at my nginx config file I noticed two this.server { listen 80 default_server; listen [::]:80 default_server; index index.html; }I understand this partlisten 80 default_server;it tells nginx to listen on port 80 and set that as the "default_server" but I do not understand the second line.liste...
It is for the IPv6 configsfrom the nginxdocsIPv6 addresses (0.7.36) are specified in square brackets: listen [::]:8000; listen [::1];
How can I list all vhosts in nginx
Is there a command that will list all vhosts or servers running under nginx on CentOS? I would like to pipe the results to a text file for reporting purposes.I'm looking for something similar to this command that I use for Apache:apachectl -S 2>&1 | grep 'port 80'
Update:Thanks to @Putnik for pointing out an easier way (but I prefer only listing sites-enabled):grep server_name /etc/nginx/sites-enabled/* -RiIOld Post:Try something like this:find /etc/nginx/sites-enabled/ -type f -print0 | xargs -0 egrep '^(\s|\t)*server_name'
nginx.conf redirect multiple conditions
I want to redirect requests on two conditions using Nginx.This doesn't work:if ($host = 'domain.example' || $host = 'domain2.example'){ rewrite ^/(.*)$ http://www.domain.example/$1 permanent; }What is the correct way to do this?
I had this same problem before. Because Nginx can't do complex conditions or nested if statements, you need to evaluate over 2 different expressions.set a variable to some binary value then enable if either condition is true in 2 different if statements:set $my_var 0; if ($host = 'domain.example') { set $my_var 1; } ...
In production, Apache + mod_wsgi or Nginx + mod_wsgi?
What to use for a medium to large python WSGI application, Apache + mod_wsgi or Nginx + mod_wsgi?Which combination will need more memory and CPU time?Which one is faster?Which is known for being more stable than the other?I am also thinking to use CherryPy's WSGI server but I hear it's not very suitable for a very high...
For nginx/mod_wsgi, ensure you read:http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.htmlBecause of how nginx is an event driven system underneath, it has behavioural characteristics which are detrimental to blocking applications such as is the case with WSGI based applications. Worse case scenar...
When to restart and not reload Nginx?
When is it necessary to restart nginx and reload will not suffice?Does it make a difference if an extension likepassengeris used?Should the service be restarted if it consumes too much memory. Any other reasons for restarting Nginx, particularly after a configuration change either in an extension or a Nginx core config...
Reloading nginx is safer than restarting because before old process will be terminated, new configuration file is parsed and whole process is aborted if there are any problems with it.On the other hand when you restart nginx you might encounter situation in which nginx will stop, and won't start back again, because of ...
How to install NGINX on AWS EC2 Linux 2 [closed]
Closed.This question does not meetStack Overflow guidelines. It is not currently accepting answers.This question does not appear to be abouta specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic onanother Stack Exchange site, ...
I'd personally use Amazon's own repo.The version provided by the Amazon repo is relatively old (1.12.2at the time of writing). To see what versions the Amazon repo has access to runamazon-linux-extras list | grep nginxIf you'd like a later version, consider EPEL.In regards to the config, your best bet is to explicitly ...
How to set index.html as root file in Nginx?
How to set index.html for the domain name e.g.https://www.example.com/- leads user to index.html in root directory.I've tried different things like:server { # some configs location = / { index index.html; fastcgi_index index.html; } or location / { index index.html;...
The answer is to place the root dir to the location directives:root /srv/www/ducklington.org/public_html;
Why am I getting infinite redirect loop with force_ssl in my Rails app?
I want to have my API controller use SSL, so I added another listen directive to my nginx.confupstream unicorn { server unix:/tmp/unicorn.foo.sock fail_timeout=0; } server { listen 80 default deferred; listen 443 ssl default; ssl_certificate /etc/ssl/certs/foo.crt; ssl_certificate_key /etc/ssl/private/foo.ke...
You're not forwarding any information about whether this request was an HTTPS-terminated request or not. Normally, in a server, the "ssl on;" directive will set these headers, but you're using a combined block.Rack (and force_ssl) determines SSL by:If the request came in on port 443 (this is likely not being passed bac...
Custom Bad Gateway Page with Nginx
Is it possible to serve a custom "Bad Gateway" error page in Nginx?Similar to having custom 404 pages.
It's similar to setting up the custom 404 pages. Here's what I've got.#site-wide error pages error_page 404 /404.html; error_page 500 502 503 504 /500.html;
nginx: use environment variables
I have the following scenario: I have an env variable$SOME_IPdefined and want to use it in a nginx block. Referring to thenginx documentationI use theenvdirective in thenginx.conffile like the following:user www-data; worker_processes 4; pid /run/nginx.pid; env SOME_IP;Now I want to use the variable for aproxy_pass. I...
The correct usage would be$SOME_IP_from_env, but environment variables set from nginx.conf cannot be used in server, location or http blocks.You can use environment variables if you use theopenresty bundle, which includes Lua.
How can I run both nginx and Apache together on Ubuntu?
I want to configure both Apache and nginx to run together on Ubuntu because I want to develop on both nginx and Apache. I have read that I have to edit the configuration on Apache or nginx to make one of them run on another port rather than 80.Which files should I edit in Nginx to make it run through another port?
go to/etc/nginx/sites-availablethen modify the host file which should listen to a different port (if you didn't change anything here you will find adefaultfile, enter to change it)in the file changelisten: 80to the port you want to listen todon't forget to reload the service:service nginx reload
How to restart nginx on OS X
I'm usingnginxon OS X 10.8. Freshly installednginxbut can't find a way to restart nginx exceptkill nginx_pidsaykill 64116. Wondering if there are better ways to restartnginx.Found some methods on Google and SO but didn't work:nginx -s restart sudo fuser -k 80/tcp ; sudo /etc/init.d/nginx restartThe error message forng...
What is your nginx pid file location? This is specified in the configuration file, default paths specified compile-time in the config script. You can search for it as such:find / -name nginx.pid 2>/dev/null(must issue while nginx is running)Solution:sudo mkdir -p /usr/local/var/run/ ln -s /current/path/to/pid/file /usr...
How do I access a server on localhost with nginx docker container?
I'm trying to use a dockerized version of nginx as a proxy server for my node (ExpressJS) application. Without any configuration to nginx and publishing port 80 for the container, I am able to see the default nginx landing page. So I know that much is working.Now I can mount my sites-enabled directory that contains the...
You can get your current IP address as shownhere:ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}'Then you can use the--add-hostflag withdocker run:docker run --add-host localnode:$(ifconfig en0 | grep inet | grep -v inet6 | awk '{print \$2}') ...In yourproxypassuselocalnodeinstead oflocalhost.
How do I set up phpMyAdmin on a Laravel Homestead box?
I installed it by runningsudo apt-get install phpymyadminand then runningsudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/htmlandsudo service nginx restartbut it's not working.Note: I didn't select any of the apache2 or lighttpd options when installing.
Option 1:This will install the latest version of PhpMyAdmin from a shell script I've written. You are welcome to check it outon Github.Run the following command from your code/projects directory:curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | bashOption 2:This will install PhpMyAdmin (not the la...
Enable GZIP for CSS and JS files on NGINX server for Magento
I need to enable gzip compression on nginx server. As I have observed from firfox firebug NET tools, I have found that html file are gzip compressed. But Not the javascript files and CSS files.I have already checkMime.typesand nginx configuration file/etc/nginx/ngnix.confand not found any issue. still not able to see ...
This is an working config that I currently use in production.http://pastie.org/10870547gzip on; gzip_disable "msie6"; gzip_comp_level 6; gzip_min_length 1100; gzip_buffers 16 8k; gzip_proxied any; gzip_types text/plain text/css text/js text/xml text/javascript application/javascript applica...
Upstream too big - nginx + codeigniter
I am getting this error from Nginx, but can't seem to figure it out! I am using codeigniter and am using the database for sessions. So I'm wondering how the header can ever be too big. Is there anyway to check what the header is? or potentially see what I can do to fix this error?Let me know if you need me to put up an...
Add this to yourhttp {}of thenginx.conffile normally located at/etc/nginx/nginx.conf:proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k;Then add this to your php location block, this will be located in your vhost file look for the block that begins withlocation ~ .php$ {fastcgi_buffer_size...
How to remove both .php and .html extensions from url using NGINX?
I want my nginx make display all url's clean.http://www.mydomain.com/indexhtml.htmlashttp://www.mydomain.com/indexhtmlhttp://www.mydomain.com/indexphp.phpashttp://www.mydomain.com/indexphpWith some research I've made the first case to work. It`s done by following configuration:location / { root html; index i...
From what I've researched, if you append your /etc/nginx/conf.d/domain.tld.conf file to include:location / { try_files $uri $uri.html $uri/ @extensionless-php; index index.html index.htm index.php; } location ~ \.php$ { try_files $uri =404; } location @extensionless-php { rewrite ^(.*)$ $1.php last; }...
correct configuration for nginx to localhost?
I just installed nginx and php fastcgi about an hour ago, and after reading examples of a quick starting configuration, and the nginx documentation etc, I just cant get it to work.No matter what I change or try, I always only get the "Welcome to Nginx!" screen on "localhost/..." - I cant even call a simple index.htmlMy...
Fundamentally you hadn't declare location which is what nginx uses to bind URL with resources.server { listen 80; server_name localhost; access_log logs/localhost.access.log main; location / { root /var/www/board/public; index in...
What does the deferred option mean in NGINXs listen directive?
I've seen example NGINX configurations with the "deferred" option added to the listen directiveserver { listen 80 default deferred; ... }I can't work out what it does (and whether or not I should use it) and the documentation doesn't make too much sense to medeferred -- indicates to use that postponed accept(2) o...
TCP_DEFER_ACCEPT can help boost performance by reducing the amount of preliminary formalities that happen between the server and client.You can read more about itHERE.
How does Nginx handle HTTP requests?
I understand thread driven that Apache uses: every connection opens up a thread and when the response is sent, the thread is closed, releasing the resources for other threads).But I don't get the event driven design that Nginx uses. I've read some basics about event driven design .. but I don't understand how this is u...
Nginx uses theReactorpattern. Basically, it's single-threaded (but can fork several processes to utilize multiple cores). The main event loop waits for the OS to signal a readiness event - e.g. that data is available to read from a socket, at which point it is read into a buffer and processed. The single thread can ver...
Nginx - Customizing 404 page
Nginx+PHP (on fastCGI) works great for me. When I enter a path to a PHP file which doesn't exist, instead of getting the default 404 error page (which comes for any invalid .html file), I simply get a "No input file specified.".How can I customize this 404 error page?
You use the error_page property in the nginxconfig.For example, if you intend to set the 404 error page to/404.html, useerror_page 404 /404.html;Setting the 500 error page to/500.htmlis just as easy as:error_page 500 /500.html;
Dockerized nginx is not starting
I have tried following some tutorials and documentation on dockerizing my web server, but I am having trouble getting the service to run via the docker run command.This is my Dockerfile:FROM ubuntu:trusty #Update and install stuff RUN apt-get update RUN apt-get install -y python-software-properties aptitude screen hto...
As of now, the official nginx image uses this to run nginx (seethe Dockerfile):CMD ["nginx", "-g", "daemon off;"]In my case, this was enough to get it to start properly. There are tutorials online suggesting more awkward ways of accomplishing this but the above seems quite clean.
Dynamic proxy_pass to $var with nginx 1.0
I am trying to proxy a request to different targets depending on an environment variable. My approach was to put the target url into the custom variable $target and give this to proxy_pass.But using a variable with proxy_pass doesn't seem to work. This simple config leads to a "502 Bad Gateway" response from nginx.serv...
I've recently stumbled upon this need myself and have found that in order to use variables in a proxy_pass destination you need to set a resolver as your error.log would most probably contain something likeno resolver defined to resolve ...The solution in my case was to setup the following using a local DNS for DNS res...
How do you hide .git project directories?
Now that I have nginx setup I need to be able to hide my.gitdirectories. What kind of rewrite would I need to stop prying eyes? And where in theserver {}orhttp {}block would it go?
http { server { location ~ /\.git { deny all; } } }Thislocationdirective will deny access to any.gitdirectory in any subdirectory.Note:This location block must be before your main location block, so that it can be evaluated first.
React Router BrowserRouter leads to "404 Not Found - nginx " error when going to subpage directly without through a home-page click
I am using React Router for routing for a multi-page website. When trying to go to a sub page directlyhttps://test0809.herokuapp.com/signinyou'd get a "404 Not Found -nginx" error (To be able to see this problem you might need to go to this link in Incognito mode so there's no cache). All the links work fine if you go ...
The problem is that nginx doesn't know what to do with/signin. You need to change your nginx config (usually in/etc/nginx/conf.d/) to serve yourindex.htmlregardless of the route. Here is a sample nginx config that might help:server { listen 80 default_server; server_name /var/www/example.com; root /var/www/examp...
"How to fix 'Error: must either provide a name or specify --generate-name' in Helm"
How to fixError: must either provide a name or specify --generate-namein HelmCreated sample helm chart name as mychart and written the deployment.yaml, service.yaml, ingress.yaml with nginx service. After that running the command like $ helm install mychartservice.yamlapiVersion: v1 kind: Service metadata: name: ngin...
just to add--generate-nameat the end ofhelmcommand
How to configure additional modules to nginx after installation?
I have installed Nginx in our redhat machine using rpm. Now we want to add nginx-rtmp module, but inorder to add new module as per the document i need to build it by downloading the tar ball. Does it mean that i have to remove the rpm and install it as per the document.Ref:https://github.com/arut/nginx-rtmp-module/wiki...
Unlike Apache, all modules, including the 3rd party modules, are going to be compiled into nginx. So every time you want to add a new module, you have to recompile nginx.So yes, you have to install it as per the document. There is no much value of keeping 2 nginx runtimes on the same server any way. So you may also wan...
How to run Nginx docker container with custom config?
I have a Dockerfile and custom Nginx configuration file (in the same directory with Dockerfile) as follows:Dockerfile:FROM nginx COPY nginx.conf /etc/nginx/nginx.confnginx.conffile:upstream myapp1 { least_conn; server http://example.com:81; server http://example.com:82; server h...
As mentioned in theNGiNX documentation,upstreamis supposed to be defined in anhttpcontext.As mentioned innginxunkown directive “upstream”:When that file is included normally bynginx.conf, it is included already inside thehttpcontext:http { include /etc/nginx/sites-enabled/*; }You either need to use-c /etc/nginx/nginx...
ERR_CONTENT_LENGTH_MISMATCH on nginx and proxy on Chrome when loading large files
I'm getting the following error on my chrome console:GET http://localhost/grunt/vendor/angular/angular.js net::ERR_CONTENT_LENGTH_MISMATCHThis only happens when a simultaneous requests are shot towards nginx e.g. when the browsers cache is empty and the whole app loads. Loading the resource above as a single requests s...
It seems that under pressure, nginx tried to pullangular.jsfrom its cache and couldn't due to permission issues. Here's what solved this issue:root@amac-2:/usr/local/var/run/nginx $ chown -R _www:admin proxy_temp_www:adminmight be different in your case, depending which user owns the nginx process. See more information...
Nginx location matches
What is the difference between:location = /abc {}andlocaton ~ /abc {}
location = /abc {}matches the exact uri/abclocation ~ /abcis a regex match on the uri, meaning any uri containing/abc, you probably want:location ~ ^/abcfor the uri begining with/abcinstead
what is worker_processes and worker_connections in Nginx?
Please help me understand whatworker_processesandworker_connectionsare in Nginx and what is the relation between them. I have looked underNginx directivesit says:worker_processesA worker process is a single-threaded process.If Nginx is doing CPU-intensive work such as SSL or gzipping and you have 2 or more CPUs/cores, ...
worker_connections is the number of simultaneous connections; so they are simply stating how to calculate, for example:you are only running 1 process with 512 connections, you will only be able to serve 512 clients.If 2 processes with 512 connections each, you will be able to handle 2x512=1024 clients.The number of con...
NGINX - Return 301 vs Rewrite
I useNGINXin my dedicated server.I've a question about thereturnandrewrite 301.Rewrite 301:rewrite ^ http://xxx.xxxxx.net/xx-xxx/$request_uri? permanent;Return 301:location ~ redirect-this/?$ { return 301 http://xxx.xxxxx.net/xx-xxx/redirect-this$1; }All redirects work correctly. But..Which is the most effective me...
As stated in thenginx pitfallsyou should use server blocks andreturnstatements as they're way faster than evaluating RegEx vialocationblocks.Since you're forcing the rewrite rule to send a 301 there's no difference when it comes to SEO, btw..
Issue using certbot with nginx
I'm actually working on a webapp, I useReactjsfor the frontend andGolangfor the backend. Those 2 programs are hosted separately on 2 VMs onGoogle-Compute-Engine. I want to serve my app throughhttpsso I choose to useNginxfor serving the frontend in production. Firstly I made my config file forNginx:#version: nginx/1.14....
I was trying to create Let's Encrypt certificate using certbot for my sub-domain and had the following issue.Command:ubuntu@localhost:~$ certbot --nginx -d my_subdomain.website.com -d my_subdomain2.website.comIssue:The requested Nginx plugin does not appear to be installedSolution:Ubuntu 20+ubuntu@localhost:~$ sudo apt...
Could not create work tree dir 'example.com'.: Permission denied
I have got a virtual private server with nginx Virtual Hosts setup (Server Blocks).I've installed Git and got my ssh keys authenticated with GitHub.I have my website running in~/var/www/example.com/public_html/I tried to run:git clone[email protected]:example/example.co.uk.gitto pull my files on GitHub to the /public_h...
I think you don't have your permissions set up correctly for /var/www Change the ownership of the folder.sudo chown -R $USER /var/www
nginx ./configure error ubuntu 12.04
after downloading and trying to configure nginx when um executing the command ./configure um getting this error./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the...
You have to install pcre3:apt-get install libpcre3 libpcre3-devThe library is required for regular expressions support in the location directive and for the ngx_http_rewrite_module module.http://nginx.org/en/docs/install.html
Ubuntu Server Installing PHP 7 WITHOUT Apache
I'm trying to get my server re-setup as a Lemp stackThe issue I am now running into is installing PHP 7withoutApache, since nGinx will be my webserver.So, I've addedppa:ondrej/php. ranapt-get update, and tried to install just php7.0 viaapt-get install php7.0--nodepsflag does not work, as I am on Ubuntu 15.10And I am pr...
If you just requestphp7.0, it'll install Apache as default. Doapt-get install php7.0-fpmand it'll install as FPM instead, leaving something like nginx up to you.
What is the purpose of using nginx with gunicorn? [duplicate]
This question already has answers here:Are a WSGI server and HTTP server required to serve a Flask app?(3 answers)Closed5 years ago.I want to use gunicorn for a REST API application with Flask/Python. What is the purpose of adding nginx here to gunicorn? The gunicorn site recommends using gunicorn with nginx.
Nginx has some web server functionality (e.g., serving static pages; SSL handling) that gunicorn does not, whereas gunicorn implements WSGI (which nginx does not).... Wait, why do we need two servers? Think of Gunicorn as the application web server that will be running behind nginx – the front- facing web server. Gunic...
Celery Flower Security in Production
I am looking to use Flower (https://github.com/mher/flower) to monitor my Celery tasks in place of the django-admin as reccomended in their docs (http://docs.celeryproject.org/en/latest/userguide/monitoring.html#flower-real-time-celery-web-monitor). However, because I am new to this I am a little confused about the way...
You can run flower with --auth flag, which will authenticate using a particular google email:celery flower[email protected]Edit 1:New version of Flower requires couple more flags and a registered OAuth2 Client withGoogle Developer Console:celery flower \[email protected]\ --oauth2_key="client_id" \ --oauth2_sec...
nginx not serving my error_page
I have a Sinatra application hosted with Unicorn, and nginx in front of it. When the Sinatra application errors out (returns 500), I'd like to serve a static page, rather than the default "Internal Server Error". I have the following nginx configuration:server { listen 80 default; server_name *.example.com; root ...
error_pagehandles errors that are generated by nginx. By default, nginx will return whatever the proxy server returns regardless of http status code.What you're looking for isproxy_intercept_errorsThis directive decides if nginx will intercept responses with HTTP status codes of 400 and higher.By default all response...
Nginx uwsgi (104: Connection reset by peer) while reading response header from upstream
Environment is Nginx + uwsgi.Getting a 502 bad gateway error from Nginx on certain GET requests. Seems to be related to the length of the URL. In our particular case, it was a long list of GET parameters. Shorten the GET parameters and no 502 error.From the nginx/error.log[error] 22113#0: *1 recv() failed (104: Connect...
After spending a lot of time on this, I finally figured it out. There are many references to Nginx and connection reset by peer. Most of them seemed to be related to PHP. I couldn't find an answer that was specific to Nginx and uwsgi.I finally found a reference to fastcgi and a 502 bad gateway error (https://support.pl...
How to redirect on the same port from http to https with nginx reverse proxy
I use reverse proxy with Nginx and I want to force the request into HTTPS, so if a user wants to access the url with http, he will be automatically redirected to HTTPS.I'm also using a non-standard port.Here is my nginx reverse proxy config:server { listen 8001 ssl; ssl_certificate /home/xxx/server.crt; ss...
Found something that is working well :server { listen 8001 ssl; ssl_certificate /home/xxx/server.crt; ssl_certificate_key /home/xxx/server.key; error_page 497 301 =307 https://$host:$server_port$request_uri; location /{ proxy_pass http://localhost:8000; p...
NGINX error log format documentation
I want to parse NGINX error logs. However, there seems to be no documentation at all, concerning the used log format. While the meaning of some fields like the data is pretty obvious, some are not at all. In addition, I cannot be sure that my parser is complete if I do not have a documentation of all the possible field...
From readingsrc/core/ngx_log.cI guess the general error log format seems to beYYYY/MM/DD HH:MM:SS [LEVEL] PID#TID: *CID MESSAGEWithPIDandTIDbeing the logging process and thread id andCIDa number identifying a (probably proxied) connection, probably a counter. The*CIDpart is optional.
What is the purpose of NGINX and Gunicorn running in parallel?
A lot of Django app deployments over Amazon's EC2 use HTTP servers NGINX and Gunicorn.I was wondering what they actually do and why both are used in parallel. What is the purpose of running them both in parallel?
They aren't used in parallel. NGINX is areverse proxy. It's first in line. It accepts incoming connections and decides where they should go next. It also (usually) serves static media such as CSS, JS and images. It can also do other things such as encryption via SSL, caching etc.Gunicorn is the next layer and is anappl...
Docker nginx reverse proxy gives "502 Bad Gateway"
I'm trying to have a docker container with nginx work as reverse proxy to other docker containers and I keep getting "Bad Gateway" on locations other other than the base location '/'.I have the following server block:server { listen 80; location / { proxy_pass "http://game2048:8080"; } location /game { ...
I fixed it! I set the server name in different server blocks in nginx config. Remember to use docker port, not host port.server { listen 80; server_name game2048; location / { proxy_pass "http://game2048:8080"; } } server { listen 80; server_name game; location / { # Remember to refer to doc...
How to extract some value from cookie in nginx
I am new to Nginx and hope to get some help.I want to extract certain data (certain fields set by my PHP scripts) from browser cookie in nginx so that I can log it. If possible, I want to do this just by modifying nginx configuration.Any pointer/help would be greatly appreciated.
You can access cookie values by using the$cookie_COOKIE_NAME_GOES_HEREvariable.SeeNginx Documentation
How can I check that the nginx gzip_static module is working?
How can I check that nginx is serving the .gz version of static files, if they exist?I compiled nginx with the gzip static module, but I don't see any mention of the .gz version being served in my logs. (I have minified global.js and global.css files with .gz versions of them in the same directory).The relevant part of...
Use strace. First, you need to detect PID of nginx process:# ps ax | grep nginx 25043 ? Ss 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf 25044 ? S 0:02 nginx: worker processOk, so 25044 is the worker process. Now, we trace it:# strace -p 25044 2>&1 | grep gz open("/var/www/c...
How to restart Nginx in Ubuntu or other linux servers [closed]
Closed.This question does not meetStack Overflow guidelines. It is not currently accepting answers.This question does not appear to be abouta specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic onanother Stack Exchange site, ...
File probably is there:/usr/local/nginx/sbin/nginxto be sure You can do:ps aux | grep nginxTo kill process:sudo killall nginxAnd start again:/usr/local/nginx/sbin/nginx
How to fix nginx throws 400 bad request headers on any header testing tools?
I have my site which is using nginx, and testing site with header testing tools e.g.http://www.webconfs.com/http-header-check.phpbut every time it says 400 bad request below is the out put from the tool. Though all my pages load perfectly fine in browser and when I see in chrome console it says status code 200OK.HTTP/...
As stated by Maxim Dounin inthe comments above:When nginx returns 400 (Bad Request) it will log the reason into error log, at "info" level. Hence an obvious way to find out what's going on is to configureerror_logto log messages at "info" level and take a look into error log when testing.
How to get Gunicorn to use Python 3 instead of Python 2 (502 Bad Gateway)
I'm trying to get Gunicorn to use Python3 for a Django app I want to make. I'm using Digital Ocean's Django image to get started. It comes with Django, Gunicorn, and Nginx installed and configured. The default Django project that comes with this image seems to work fine for Python 2.I'veapt-get'ed these packages.python...
It's probably easier to start afresh. Tutorial athttps://www.digitalocean.com/community/articles/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn.I got it running on a fresh ubuntu 14.04 droplet. Install python3 and django and then simply follow the tutorial. Didn't do the postgres or virtualenv bit...
Redirect subdomain to port [nginx/flask]
I know that this is a common question, and there are answers for the same, but the reason I ask this question is because I do not know how to approach the solution. Depending on the way I decide to do it, the solution I can pick changes. Anyways,I have an AWS EC2 instance. My DNS is handled by Route53 and I own example...
You could add a virtual host for app.example.com that listens on port 80 then proxy pass all requests to flask:server { listen 80; server_name app.example.com; location / { proxy_pass http://localhost:8142; } }
How to write a Nginx module? [closed]
Closed.This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meetStack Overflow guidelines. It is not currently accepting answers.We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-si...
Quoting from the documentation:Evan Miller has written the definitiveguide to Nginx module development. But some parts of it are a little out of date. You've been warned.A github search turned up theNginx Development Kit. It seems to be more up to date.From my own personal experience,Evan Miller's guidewas of a gr...
Nginx multiple server blocks listening to same port
I want to runwww.example.comandapi.example.comon same port80.This is what I have. All my googles ping lead to the below code. But, this is not working.server { listen 80 default_server; # listen [::]:80 default_server ipv6only=on; root /var/www/example.com/html/example/app; index index.ht...
Create separately two files (you don't have to, but it will be much clearer) in/etc/nginx/sites-available/www.example.comand/etc/nginx/sites-available/api.example.comThe api.example.com file's content:server { listen 80; server_name api.example.com; root /var/www/api.example.com/html/example/app...
variable capture in Nginx location matching
Let's say I have a URL like this:www.example.com/a/b/sth, and I write a location block in Nginx config:location ^~ /a/b/(?[a-zA-Z]+) { # use variable $myvar here if ($myvar = "sth") { ... } }I hope to be able to use variable$myvarcaptured from the URLinsidethe block, however, Nginx keeps telling me this variabl...
As Stefano Fratini correctly pointed out in his answer, yourlocationdeclaration has an error: for regular expressions you should use~alone, not^~.Named captures are a feature of PCRE and they have different syntax available in different versions. For the syntax you use?you must have PCRE 7.0 at least.Please see the ext...
uWSGI, Flask, sqlalchemy, and postgres: SSL error: decryption failed or bad record mac
I'm trying to setup an application webserver using uWSGI + Nginx, which runs a Flask application using SQLAlchemy to communicate to a Postgres database.When I make requests to the webserver, every other response will be a 500 error.The error is:Traceback (most recent call last): File "/var/env/argos/lib/python3.3/sit...
The issue ended up being uwsgi's forking.When working with multiple processes with a master process, uwsgi initializes the application in the master process and then copies the application over to each worker process. The problem is if you open a database connection when initializing your application, you then have mul...
How can I rewrite this nginx "if" statement?
For example, I want to do this:if ($http_user_agent ~ "MSIE 6.0" || $http_user_agent ~ "MSIE 7.0" (etc, etc)) { rewrite ^ ${ROOT_ROOT}ancient/ last; break; }instead of this:if ($http_user_agent ~ "MSIE 6.0") { rewrite ^ ${ROOT_ROOT}ancient/ last; break; } if ($http_user_agent ~ "MSIE 7.0") { rewrite ^...
Edit:As Alexey Ten didn't add a new answer, I'll edit mine to give his better answer in this case.if ($http_user_agent ~ "MSIE [67]\.")Original answer:Nginx doesn't allow multiple or nested if statements however you can do this :set $test 0; if ($http_user_agent ~ "MSIE 6\.0") { set $test 1; } if ($http_user_agent ~ ...
Deploy single page application Angular: 404 Not Found nginx
I Have an Angular application. I run the commandng build --prod --aotto generate thedistfolder. In the dist folder I created a file namedStaticfilethen I uploaded the dist folder topivotal.iowith the following commands:cf push name-app --no-startcf start name-appThe app runs well. I have a nav bar, so when I change the...
I finally found the answer: After I generated thedistfolder.I created a file calledStaticfileand put it in the dist folderI openedStaticfile& I added this linepushstate: enabledpushstate enabled keeps browser-visible URLs clean for client-side JavaScript apps that serve multiple routes. For example, pushstate routing a...
413 Request Entity Too Large
I use nginX/1.6 and laravel when i posted data to server i get this error 413 Request Entity Too Large. i tried many solutions as bellow1- set client_max_body_size 100m; in server and location and http in nginx.conf. 2- set upload_max_filesize = 100m in php.ini 3- set post_max_size = 100m in php.iniAfter restarting php...
Add ‘client_max_body_size xxM’ inside the http section in /etc/nginx/nginx.conf, where xx is the size (in megabytes) that you want to allow.http { client_max_body_size 20M; }
Jetty, Tomcat, Nginx, Geronimo, Glassfish: I'm confused
As someone new to the Java EE ecosystem, I'm confused with these products which share a tremendous amount of keywords. And half of them come from Apache software foundation.Can someone address me with a brief distinctive explanation for each of them?
Jetty and Tomcat are web-containers, while Geronimo, Glassfish and JBoss support the whole J2EE stack (more or less). And, tataaa, they use/include Tomcat or Jetty for web-containers. The most important part of a fullblown J2EE server besides the web-container used to be theEJB-container allowing for deployment of EJBs...
remove default nginx welcome page when access directly from ip address
At my ubuntu server, I install nginx and setup virtual host using this article.https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3The virtual host's domain name is like www.example.com. When I go to www.example.com, I can see my application's index page...
I think when you first set up nginx it comes with adefaultvirtual host. Did you try removing that? Did you try deleting the symlink? A third option would be to add adeny all;on the location/of the default virtual host.I am not exactly sure if that will work and I cannot test it right now. If the above does not work, tr...
How to record reverse proxy upstream server serving request in Nginx log?
We use Nginx as a reverse proxy with this setup:upstream frontends { server 127.0.0.1:8000; server 127.0.0.1:8001; server 127.0.0.1:8002; [...] } server { location / { proxy_pass http://frontends; [...] } [...] }As part of the access log, I woul...
Use$upstream_addrand you will get, for example,127.0.0.1:8000orunix:/home/my_user/www/my_site/tmp/.unicorn.sock
nginx files upload streaming with proxy_pass
I configured nginx as reverse proxy to my node.js application for file uploads with proxy_pass directive. It works, but my problem is that nginx waits for the whole file body to be uploaded before passing it to the upstream. This causes problems for me, because I want to track upload progress at my application. Any ide...
There is no way to (at least as of now). Full request will be always buffered before nginx will start sending it to an upstream. To track uploaded files you may tryupload progressmodule.Update: in nginx 1.7.11 theproxy_request_bufferingdirective is available, which allows to disable buffering of a request body. It sh...
restart nginx container when upstream servers is updated
I want to add/remove servers in my nginx running inside a docker containerI use ADD command in Dockerfile to add my nginx.conf to /etc/nginx dir.# Copy a configuration file from the current directory ADD nginx.conf /etc/nginx/then in my running nginx container that have a conf like this# List of application servers ups...
restarting the container is not advisable when you initialize Docker Swarm because it may remove the nginx service. So if you need an alternative asidedocker restart; You can go inside the container and just runnginx -s reloadFor example, in docker env, if you have the container namednginxdocker exec nginx -s reload
run nginx as windows service
I am trying to run nginx (reverse proxy) as a windows service so that it's possible to proxy a request even when a user is not connected.I searched a lot around and foundwinswthat should create a service from an .exe file (such as nginx).i found many tutorials online saying to create an xml file as following nginx ngin...
Just stumbled here and managed to get things working with this free open source alternative:https://nssm.cc/It basically is just a GUI to help you create a service. Steps I used:Download NGinx (http://nginx.org/en/download.html) and uzip to C:\foobar\nginxDownload nssm (https://nssm.cc/)Run "nssm install nginx" from t...
django : Serving static files through nginx
I'm using apache+mod_wsgi for django.And all css/js/images are served throughnginx.For some odd reason, when others/friends/colleagues try accessing the site, jquery/css is not getting loaded for them, hence the page looks jumbled up.My html files use code like this - My nginx configuration insites-availableis like thi...
server_namemust match hostname inlink/scriptURLs. Either declare your configuration as default for this interface:port pair (listen 8000 default)Nginx must listen on the interface where your host's IP is bound (seems ok in your case)
Nginx static files location block not working when added to nginx.conf?
I'm having some trouble defining a rule to cache my static files. I've found this solution:location ~* \.(ico|js|css|png|gif|jpe?g)$ { expires 7d; }which actually looks like what I need. The problem is, if I include this code into my NGINX.conf, no static files are delivered anymore and my site is blank. Any ideas/hi...
Put this before your other location block:location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { expires 30d; add_header Vary Accept-Encoding; access_log off; }That should work.You could also use this:## All static files will be served directly. location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|e...
What's the better approach: serving static files with Express or nginx?
I'm building a Node.js applications and I'm using nginx as a reverse proxy. My application has some static files I need to serve and a Socket.io server.I know that I can serve static files directly with Express (using express.static middleware). Also I can point nginx directly to the directory where my static files are...
for development:express, mainly because of flexibility it provides... you can change your static location and structure very easily during developmentfor production:nginx, because its much much faster. Node/express are good for executing logic, but for serving raw content... nothing can beat nginx. You also get additio...
docker restart container failed: "already in use", but there's no more docker image
I first got my nginx docker image:docker pull nginxThen I started it:docker run -d -p 80:80 --name webserver nginxThen I stopped it:docker stop webserverThen I tried to restart it:$docker run -d -p 80:80 --name webserver nginx docker: Error response from daemon: Conflict. The container name "/webserver" is already in u...
It is becauseyou have used--nameswitch.container is stopped and not removedYou find it stoppeddocker ps -aYou can simply start it using below command:docker start webserverEDIT: AlternativesIf you want to start the container with below command each time,docker run -d -p 80:80 --name webserver nginxthen use one of the f...
nginx fails to load ssl certificate
I have to add ssl (https) for a website, I was given a SSL.CSR and a SSL.KEY file. I 'dos2unix'ed them (because they have trailing ^M) and copied them to the server(CSR -> mywebsite.crt, KEY -> mywebsite.key). I did the following modification to nginx.conf:@@ -60,8 +60,13 @@ } server { - listen ...
You should never share your private key. You should consider the key you posted here compromised and generate a new key and signing request.You have a certificate request and not an actual signed certificate. You provide the request ('CSR') to the signing party. They use that request to create a signed certificate ('CR...
django- nginx: [emerg] open() "/etc/nginx/proxy_params" failed (2: No such file or directory) in /etc/nginx/sites-enabled/myproject:11
I try to deploy a django project with Nginx and Gunicorn withthis tutorial. i did all to-dos but, when i create/etc/nginx/sites-available/myprojectfile with below code:server { listen 80; server_name server_domain_or_IP; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/...
You're getting the path wrong forproxy_params99% of the time (From my experience), the default location for theproxy_paramsfile is/etc/nginx/proxy_paramsbut that doesn't seem to be the same for you.Theproxy_paramsfile contains the following:proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; prox...
Nginx still try to open default error log file even though I set nginx config file while reloading
The below is my nginx configuration file located in/etc/nginx/nginx.confuser Foo; worker_processes 1; error_log /home/Foo/log/nginx/error.log; pid /home/Foo/run/nginx.pid; events { worker_connections 1024; use epoll; } http { access_log /home/Foo/log/nginx/access.log; server { listen 80; ...
Check the permissions on the directory /home/Foo/log/nginx/. It must be writable by nginx. Set permissions like so:sudo chmod 766 /home/Foo/log/nginx
nginx: redirect everything from http to https, except one url-pattern
I have a website which should only be reachable over HTTPS except one URL-pattern (because I have on some pages http-iframe's and I would like to avoid security warnings)E.g. this pages should be redirected to https: http://example.com http://example.com/a/this-is-an-article http://example.com/v/this-is-a-video This p...
If the iframe pages are always in the same directory, simple prefix locations could be used.server { listen 443; location /l/ { # redirect https iframe requests to http server return 301 http://$server_name$request_uri; } # ... } server { listen 80; location / { # the default locati...
Nginx not following symlinks
I have installed nginx on Ubuntu 12.04. However, nginx does not seem to follow symlinks. I understand that there is a config change required for this but I am not able to find where to make the change. Any help appreciated.
Have a look at the following config option fromnginx docs:Syntax:disable_symlinks off; disable_symlinks on | if_not_owner [from=part];Default: disable_symlinks off;Context: http, server, locationThis directive appeared in version 1.1.15.
Nginx invalid URL prefix
I have a really basic nginx setup which is failing for some reason;server { listen 80; server_name librestock.com; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/david/StockSearch/stocksearch; } location / { include proxy_params; ...
You need the http:// prefix on your unix: path, as in:proxy_pass http://unix:/home/david/StockSearch/stocksearch/stocksearch.sock;Seehttp://nginx.org/en/docs/http/ngx_http_proxy_module.html
How to test nginx subdomains on localhost
I want to test nginx subdomains before uploading config to the server. Can i test it on localhost? I tryserver { listen 80; server_name localhost; location / { proxy_pass http://localhost:8080; } } server { listen 80; server_name sub.localhost; location / { p...
Yes, add '127.0.0.1 sub.localhost' to your hosts file. That sub has to be resolved somehow. That should work.Then once you're ready to go to the net, yes, add an a or cname record for the subdomain sub.When I use proxy_pass I also include the proxy.conf from nginx.http://wiki.nginx.org/HttpProxyModule
Is it possible to specify custom error log format on Nginx?
I can specify custom log format foraccess_logon Nginx, but it doesn't work forerror_log.Is there anyway to achieve this?
You can't specify your own format, but in nginx build-in several level's of error_log-ing.Syntax:error_log file [ debug | info | notice | warn | error | crit ]Default:${prefix}/logs/error.logSpecifies the file where server (and fastcgi) errors are logged.Default values for the error level:in the main section - errorin ...
invalid number of arguments in "ssl_certificate_key" directive in /etc/nginx/sites-enabled/defaul
I have got my EV SSL Certificate. I am following tutorials on how to use my certificate with NGINX on UbuntuWhen I am trying to restart my nginx, I get:**invalid number of arguments in "ssl_certificate_key" directive in /etc/nginx/sites-enabled/defaultWhat I did so far:sudo nano /etc/nginx/sites-enabled/default ups...
It looks like you may be missing a semicolon at the end of thessl_certificate_keyline.
How to compile Lua scripts into a single executable, while still gaining the fast LuaJIT compiler?
How can I compile myLuascripts into a single executable file, while also gaining the super fast performance benefits ofLuaJIT?Background:My Lua scripts are for a web application I created (e.g. to hosthttp://example.com)My current technology stack is NGINX (web server), Lua/LuaJIT (language to retrieve dynamic content)...
Translate all of the Lua source code files to object files and put them in a static library:for f in *.lua; do luajit -b $f `basename $f .lua`.o done ar rcus libmyluafiles.a *.oThen link thelibmyluafiles.alibrary into your main program using-Wl,--whole-archive -lmyluafiles -Wl,--no-whole-archive -Wl,-E.This line fo...
How to make nginx redirect based on the value of a header?
I'm hosting a website behind a Cloudflare proxy, which means that all requests to my server are over port 80, even though Cloudflare handles HTTP (port 80) and HTTPS (port 443) traffic.To distinguish between the two, Cloudflare includes anX-Forwarded-Protoheader which is set to "http" or "https" based on the user's con...
The simplest way to do this is with anifdirective. If there is a better way, please let me know, as people say theifdirective is inefficient. Nginx converts dashes to underscores in headers, soX-Forwarded-Protobecomes$http_x_forwarded_proto.server { listen 80; server_name example.com; # Replace this with your o...
nginx: how to create an alias url route?
basically an server instance is running atsomesite.com/production/folder/here?param=here&count=1I want to pointsomeite.com/demoto/production/folder/hereso when user typessomesite.com/production/demo?param=hereit will work without redirecting to/production/folder/here
server { server_name example.com; root /path/to/root; location / { # bla bla } location /demo { alias /path/to/root/production/folder/here; } }If you need to usetry_filesinside/demoyou'll need to replacealiaswith arootand do a rewrite because of the bugexplained here
Webpack Dev Server with NGINX proxy_pass
I'm trying to getwebpack-dev-serverrunning inside a Docker container then accessing it through a NGINX host. The initialindex.htmlloads but the Web Sockets connection to the dev server cannot connect.VM47:35 WebSocket connection to 'ws://example.com/sockjs-node/834/izehemiu/websocket' failed: Error during WebSocket han...
Proxy pass should be ip and port of your webpack-dev-server container and you needproxy_redirect off;location /sockjs-node { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://node:8080; proxy_redirect off; ...
Configure reverse-proxy for Keycloak docker with custom base URL
How can I set thedocker keycloak base urlas parameter ?I have the following nginx reverse proxy configuration:server { listen 80; server_name example.com; location /keycloak { proxy_pass http://example.com:8087/; } }When I try to accesshttp://example.com/keycloak/I got a keycloak http redirect ...
Just tested that @home, and actually multiple configuration additions are needed:1/ Run the keycloak container with env-e PROXY_ADDRESS_FORWARDING=trueas explained in the docs, this is required in a proxy way of accessing to keycloak:docker run -it --rm -p 8087:8080 --name keycloak -e PROXY_ADDRESS_FORWARDING=true jbos...
Nginx only shows welcome page
I'm trying to set up a simple virtual host, serving only static files. Trouble is, directing the browser to (in this case)jorum.devdisplays the default nginx welcome page, as opposed tojorum.dev/index.html.Nginx was installed using Homebrew on Mac OS X Mountain Lion.hosts127.0.0.1 jorum.devjorum.devserver { l...
Missing includes innginx.confinclude /usr/local/etc/nginx/sites-enabled/*;http://wiki.nginx.org/CoreModule#include
Where does nginx store the rewrite_log?
When you turn on the nginx rewrite log withrewrite_log on;, where does the system actually log that info? It doesn't seem to be in the documentation, and a decent search through google doesn't turn anything up.I have also tried enabling and looking in both the access and error logs. No luck.
Ifrewrite_log on;is used then the rewrite information will be logged toerror_logatnoticelevel. There is no separate log file.
Advantages of a reverse proxy in front of Node.JS
What are the advantages of having nginx or another web-server running as a reverse-proxy in front of the Node.JS? What does it provide?(This question is intended for matters concerning web-apps, not web-pages).Thank you.
I think the greatest benefit is that you're then able to use the same port (80) for multiple applications. Otherwise, you'd need a new IP address for each nodejs application you have. Depending on how you set things up, you can also configure different folders and subdomains to different nodejs apps running on differen...
Vuejs app showing Invalid host header error loop
I was running a vuejs app on its own dev server, now I can access the site by public IP of machine, But after pointing it with a domain using nginx its showing an error loop in consoleerror in consoleInvalid Host header [WDS] Disconnected!Due to this the script,style injection and auto reload not working.config of dev ...
I believe you need to changevue.config.jsmodule.exports = { devServer: { disableHostCheck: true } }
Setting a trace id in nginx load balancer
I'm using nginx as a load balancer in front of several upstream app servers and I want to set a trace id to use to correlate requests with the app server logs. What's the best way to do that in Nginx, is there a good 3rd party module for this?Otherwise a pretty simple way would be to base it off of timestamp (possibly...
In most cases you don't need a custom module, you can simply set a header with a combination of embedded variables of http_core_module which is (most probably) unique. Example:location / { proxy_pass http://upstream; proxy_set_header X-Request-Id $pid-$msec-$remote_addr-$request_length; }This would yield ...
nginx proxy_pass to a linked docker container
I have two docker containers with nginx. container1 is linked to container2. Docker then adds an entry to/etc/hostswhich I entered into the nginx configuration like so:server { location ~ ^/some_url/(.*)$ { proxy_pass http://container1/$1; } }I can pingcontainer1fromcontainer2, but nginx cannot resolve ...
Use an upstream block instead of the container name directlyupstream backend { server container1; } server { location ~ ^/some_url/(.*)$ { proxy_pass http://backend/$1; } }This should allow normal name resolution to occur providing a way to easily use docker links with nginx.
Permission Denied Error using Laravel & Docker
I have two docker containers: Nginx and App.The app container extends PHP-fpm and also has my Laravel Code.In mydocker-compose.ymlI'm doing:version: '2' services: nginx: build: context: ./nginx dockerfile: ./Dockerfile ports: - "80:80" links: -...
Make your Dockerfile something as below -FROM php:7-fpm WORKDIR /var/www RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client && docker-php-ext-install mcrypt pdo_mysql ADD . /var/www RUN chown -R www-data:www-data /var/wwwThis makes directory/var/wwwowned bywww-datawhich is the default user forphp-fpm.S...
What does "SSL_CTX_use_PrivateKey_file" "problems getting password error" indicate in Nginx error log? [closed]
Closed.This question isnot about programming or software development. It is not currently accepting answers.This question does not appear to be abouta specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic onanother Stack Exchan...
I got it... the private key file used with nginx mustnothave a passphrase. I removed the passphrase and it worked.
Nginx and favicon.ico - "GET /favicon.ico HTTP/1.1" FAILED
How to I get rid of all the below errors in nginx. I do not have a favicon.ico2012/03/11 17:13:25 [error] 959#0: *116 open() "/usr/local/nginx/html/favicon.ico" failed (2: No such file or directory), client: 111.68.59.75, server: 127.0.0.1, request: "GET /favicon.ico HTTP/1.1"I would imagine some line in nginx conf?
location = /favicon.ico { log_not_found off; }