question stringlengths 11 28.2k | answer stringlengths 26 27.7k | tag stringclasses 130
values | question_id int64 935 78.4M | score int64 10 5.49k |
|---|---|---|---|---|
I'm trying to get an ingress controller working in Minikube and am following the steps in the K8s documentation here, but am seeing a different result in that the IP address for the ingress controller is different than that for Minikube (the example seems to indicate they should be the same):
$ kubectl get ingress
NAME... | Here’s what worked for me:
minikube start
minikube addons enable ingress
minikube addons enable ingress-dns
Wait until you see the ingress-nginx-controller-XXXX is up and running using Kubectl get pods -n ingress-nginx
Create an ingress using the K8s example yaml file
Update the service section to point to the No... | Kubernetes | 58,561,682 | 33 |
I try to get Total and Free disk space on my Kubernetes VM so I can display % of taken space on it. I tried various metrics that included "filesystem" in name but none of these displayed correct total disk size. Which one should be used to do so?
Here is a list of metrics I tried
node_filesystem_size_bytes
node_filesys... | According to my Grafana dashboard, the following metrics work nicely for alerting for available space,
100 - ((node_filesystem_avail_bytes{mountpoint="/",fstype!="rootfs"} * 100) / node_filesystem_size_bytes{mountpoint="/",fstype!="rootfs"})
The formula gives out the percentage of available space on the poin... | Kubernetes | 57,357,532 | 33 |
I had a kubernetes single node cluster on my windows 10 machine. Due some errors I had to reinstall the Docker Desktop and since then kubernetes installation has failed while docker installed successfully. All attempts to resolve e.g. deleting the config file in .kube directory and complete reinstallation have failed. ... | I stucked in two kinds of error
system pods running, found labels but still waiting for labels...
xxxx: EOF
I finally sovled it by following the advice by the following project,
https://github.com/AliyunContainerService/k8s-for-docker-desktop/
Do as it told you, if not work,
remove ~/.kube and ~/Library/Group\ Cont... | Kubernetes | 55,361,963 | 33 |
If not specified, pods are run under a default service account.
How can I check what the default service account is authorized to do?
Do we need it to be mounted there with every pod?
If not, how can we disable this behavior on the namespace level or cluster level.
What other use cases the default service account shou... |
A default service account is automatically created for each namespace.
$ kubectl get serviceaccount
NAME SECRETS AGE
default 1 1d
Service accounts can be added when required. Each pod is associated with exactly one service account but multiple pods can use the same service account.
A pod can only use... | Kubernetes | 52,995,962 | 33 |
What is the difference between Objects and Resouces in Kubernetes world?
I couldn't find it from https://kubernetes.io/docs/concepts/ . I wonder they make no distinction about them but seems they see objects as a high-level concept of resources.
| A representation of a specific group+version+kind is an object. For example, a v1 Pod, or an apps/v1 Deployment. Those definitions can exist in manifest files, or be obtained from the apiserver.
A specific URL used to obtain the object is a resource. For example, a list of v1 Pod objects can be obtained from the /api/v... | Kubernetes | 52,309,496 | 33 |
I'm using Docker For Desktop with the built-in Kubernetes cluster. I have installed a Pod that serves resources over HTTP, but I'm not sure how to access it using my browser. I have the following ServiceSpec that correctly routes traffic to the Pod:
spec:
clusterIP: 10.99.132.220
externalTrafficPolicy: Cluster
po... | That service will be available in your browser at http://localhost:8037
Note that the port 8037 corresponds to the port property on the ServiceSpec object.
If you are unable to reach the service at that URL, then it could be one of several things, including but not limited to:
There is another Service in your cluster ... | Kubernetes | 50,178,696 | 33 |
From the docs:
Secrets must be created before they are consumed in pods as environment variables unless they are marked as optional. References to Secrets that do not exist will prevent the pod from starting.
How to mark secret as optional?
| What you're looking for is
- name: ENV_NAME
valueFrom:
secretKeyRef:
name: <secrets name>
key: <secrets key>
optional: true
You can find type definition here
Edit: similarly for envFrom
envFrom:
- secretRef:
name: secname
optional: true
| Kubernetes | 48,208,705 | 33 |
What does DiskPressure really means and how it can be avoided in kubernetes during container creation?
Seemingly when I creating a new container on a node there is a high chance that it is crashing the whole node because of the pressure...
| From the documentation you'll find that DiskPressure raises when:
Available disk space and inodes on either the node’s root filesytem or image filesystem has satisfied an eviction threshold
Learning about the conditions of your nodes whenever these issues occur is somewhat important (how much space/inodes are left, .... | Kubernetes | 42,576,661 | 33 |
I'm trying to deploy a single web application to Minikube on my Mac, and then access it in the browser. I'm trying to use the simplest of setups, but it's not working, I just get a "connection refused" error and I can't figure out why.
This is what I'm trying:
$ minikube start --insecure-registry=docker.example.com:50... | You are mostly facing this issue when you use minikube ip which returns 127.0.0.1. It should work if you use internal ip from kubectl get node -o wide instead of 127.0.0.1.
A much easier approach from the official reference docs is you can get the url using minikube service web-test --url and use it in browser or if yo... | Kubernetes | 63,600,378 | 32 |
I have both helm 2 and helm 3 installed in my localhost. I have created a new chart using helm2
sanket@Admins-MacBook-Pro poc % helm create new
Creating new
created a chart 'new ' using helm version 2. Now I have deployed the chart using helm version 3
sanket@Admins-MacBook-Pro poc % helm3 install new new --namespac... | By default, helm3 only shows releases of default namespace.
Do the following to get your release and delete it.
# Get all releases
helm ls --all-namespaces
# OR
helm ls -A
# Delete release
helm uninstall release_name -n release_namespace
| Kubernetes | 61,387,463 | 32 |
I have a problem with helm deployment. It has happend after I have added a new environment variable to the deployment.
When I execute: helm upgrade [RELEASE] [CHART]
I get the following error:
Error: The order in patch list:
[
map[name:APP_ENV value:prod]
map[name:MAILER_URL value:...]
map[name:APP_VERSIO... | I've found that the reason of this problem was that I had some envVars duplicated. In my deployment I had:
...
spec:
template:
spec:
container:
env:
- name: ENV_VAR_NAME
value: "test"
- name: ENV_VAR_NAME
value: "test"
...
After removing the duplicated variable... | Kubernetes | 60,727,150 | 32 |
I'm using MicroK8S in Ubuntu.
I'm trying to run a simple "hello world" program but I got the error when a pod is created.
kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to "Default" policy
Here is my deployment.yaml file which I'm trying to apply:
apiVer... | You have not specified how you deployed kube dns but with microk8s it's recommended to use core dns.
You should not deploy kube dns or core dns on your own; rather you need to enable dns using this command microk8s enable dns which would deploy core DNS and set up DNS.
| Kubernetes | 59,550,564 | 32 |
I am writing a Kubernetes controller.
Someone creates a custom resource via kubectl apply -f custom-resource.yaml. My controller notices the creation, and then creates a Deployment that pertains to the custom resource in some way.
I am looking for the proper way to set up the Deployment's ownerReferences field such th... | ownerReferences has two purposes:
Garbage collection: Refer to the answer of ymmt2005. Essentially all owners are considered for GC. Contrary to the accepted answer the controller field has no impact on GC.
Adoption: The controller field prevents fighting over resources which are to be adopted. Consider a replica set.... | Kubernetes | 51,068,026 | 32 |
In Nginx, I'm trying to define a variable which allows me to configure a sub-folder for all my location blocks. I did this:
set $folder '/test';
location $folder/ {
[...]
}
location $folder/something {
[...]
}
Unfortunately, this doesn't seem to work. While Nginx doesn't complain about the syntax, it returns a... | You can't. Nginx doesn't really support variables in config files, and its developers mock everyone who ask for this feature to be added:
"[Variables] are rather costly compared to plain static configuration. [A] macro expansion and "include" directives should be used [with] e.g. sed + make or any other common templat... | NGINX | 15,416,957 | 89 |
How do you determine when to use $request_uri vs $uri?
According to NGINX documentation, $request_uri is the original request (for example, /foo/bar.php?arg=baz includes arguments and can't be modified) but $uri refers to the altered URI.
If the URI doesn't change, does $uri = $request_uri?
Would it be incorrect or bet... | $uri is not equivalent to $request_uri.
The $uri variable is set to the URI that nginx is currently processing - but it is also subject to normalisation, including:
Removal of the ? and query string
Consecutive / characters are replace by a single /
URL encoded characters are decoded
The value of $request_uri is alwa... | NGINX | 48,708,361 | 88 |
I am getting a 400 Bad Request request header or cookie too large from nginx with my Rails app. Restarting the browser fixes the issue. I am only storing a string id in my cookie so it should be tiny.
Where can I find the nginx error logs? I looked at nano /opt/nginx/logs/error.log, but it doesn't have anything relate... | It's just what the error says - Request Header Or Cookie Too Large. One of your headers is really big, and nginx is rejecting it.
You're on the right track with large_client_header_buffers. If you check the docs, you'll find it's only valid in http or server contexts. Bump it up to a server block and it will work.
s... | NGINX | 17,524,396 | 88 |
How do I log all the headers the client (browser) has sent in Nginx? I also want to log the response headers. Note that I am using nginx as reverse proxy.
After going through documentation, I understand that I can log a specific header, but I want to log all of the headers.
| There are two more options to log headers in nginx.
nginx njs scripting language can be used instead of lua (njs may be considered easier to install and to use and is somewhat more "official")
mirror directive (only for request headers)
Using njs to log request and response headers
njs can be installed from package r... | NGINX | 24,380,123 | 87 |
I'm new to Nginx and I'm trying to get subdomains working.
What I would like to do is take my domain (let's call it example.com) and add:
sub1.example.com,
sub2.example.com, and also have
www.example.com available.
I know how to do this with Apache, but Nginx is being a real head scratcher.
I'm running Debian 6.
My c... | The mistake is putting a server block inside a server block, you should close the main server block then open a new one for the sub domains
server {
server_name example.com;
# the rest of the config
}
server {
server_name sub1.example.com;
# sub1 config
}
server {
server_name sub2.example.com;
#... | NGINX | 17,568,981 | 87 |
I am trying to pass off all calls to /api to my webservice but I keep getting 404s with the following config. Calls to / return index.html as expected. Does anyone know why?
upstream backend{
server localhost:8080;
}
server {
location /api {
proxy_pass http://backend;
}
location / {
... | This
location /api {
proxy_pass http://backend;
}
Needs to be this
location /api/ {
proxy_pass http://backend/;
}
| NGINX | 16,157,893 | 87 |
I develop a new website and I want to use GridFS as storage for all user uploads, because it offers a lot of advantages compared to a normal filesystem storage.
Benchmarks with GridFS served by nginx indicate, that it's not as fast as a normal filesystem served by nginx.
Benchmark with nginx
Is anyone out there, who u... | I use gridfs at work on one of our servers which is part of a price-comparing website with honorable traffic stats (arround 25k visitors per day). The server hasn't much ram, 2gigs, and even the cpu isn't really fast (Core 2 duo 1.8Ghz) but the server has plenty storage space : 10Tb (sata) in raid 0 configuration. The ... | NGINX | 3,413,115 | 87 |
We use following nginx site configure file in our production env.
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $request_time';
server {
root /srv/www/web;
server_name *.... | Try adding the $host variable in log_format:
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$host" "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $request_time';
http://wiki.nginx.org/HttpCoreModule#.24host:
$host
This variable is equal to li... | NGINX | 21,135,719 | 85 |
This is a broad question but I'd like to get a canonical answer. I have been trying to deploy a site using gunicorn and nginx in Django. After reading tons of tutorials I have been successful but I can't be sure that the steps I followed are good enough to run a site without problems or maybe there are better ways to d... |
What "setup" have you seen work best? I used virtualenv and moved my
django project inside this environment, however I have seen another
setups where there is a folder for virtual environments and other for
projects.
virtualenv is a way to isolate Python environments; as such, it doesn't have a large part to pl... | NGINX | 13,004,484 | 85 |
I want to proxy requests made to my Flask app to another web service running locally on the machine. I'd rather use Flask for this than our higher-level nginx instance so that we can reuse our existing authentication system built into our app. The more we can keep this "single sign on" the better.
Is there an existin... | I spent a good deal of time working on this same thing and eventually found a solution using the requests library that seems to work well. It even handles setting multiple cookies in one response, which took a bit of investigation to figure out. Here's the flask view function:
from dotenv import load_dotenv # pip pack... | NGINX | 6,656,363 | 85 |
Ok, I'm almost giving up on this, but how can I disable the caching from Nginx for JavaScript files? I'm using a docker container with Nginx. When I now change something in the JavaScript file, I need multiple reloads until the new file is there.
How do I know it's Nginx and not the browser/docker?
Browser: I used curl... | I have the following nginx virtual host (static content) for local development work to disable all browser caching:
server {
listen 8080;
server_name localhost;
location / {
root /your/site/public;
index index.html;
# kill cache
add_header Last-Modified $date_gmt;
a... | NGINX | 40,243,633 | 84 |
With the release of TCP load balancing for the Nginx community version, I would like to mix OpenVPN and SSL pass-through data. The only way for Nginx to know how to route the traffic is via their domain name.
vpn1.app.com ─┬─► nginx at 10.0.0.1 ─┬─► vpn1 at 10.0.0.3
vpn2.app.com ─┤ ├─► vpn2 at ... | This is now possible with the addition of the ngx_stream_ssl_preread module added in Nginx 1.11.5 and the ngx_stream_map module added in 1.11.2.
This allows Nginx to read the TLS Client Hello and decide based on the SNI extension which backend to use.
stream {
map $ssl_preread_server_name $name {
vpn1.app.... | NGINX | 34,741,571 | 84 |
I am having an intriguing problem where whenever I use add_header in my virtual host configuration on an ubuntu server running nginx with PHP and php-fpm it simply doesn't work and I have no idea what I am doing wrong. Here is my config file:
server {
listen 80; ## listen for ipv4; this line is default and implie... | There were two issues for me.
One is that nginx only processes the last add_header it spots down a tree. So if you have an add_header in the server context, then another in the location nested context, it will only process the add_header directive inside the location context. Only the deepest context.
From the NGINX do... | NGINX | 18,450,310 | 84 |
I am using two system (both are Nginx load balancer and one act as backup).
I want to add and use few HTTP custom headers.
Below is my code for both:
upstream upstream0 {
#list of upstream servers
server backend:80;
server backup_load_balancer:777 backup;
#healthcheck
}
server {
listen 80;
#Add... | To add a header, add the add_header declaration to either the location block or the server block:
server {
add_header X-server-header "my server header content!";
location /specific-location {
add_header X-location-header "my specific-location header content!";
}
}
An add_header declaration within a lo... | NGINX | 11,973,047 | 84 |
If I have the headers: X_HEADER1 & X_HEADER2, I want to reject all requests if either of these headers are not set or do not contain the correct values. What is the best way to do this?
Thanks
| You can use two IF statements either before or in the location block to inspect the headers and then return a 403 error code if it is present. Alternatively, you can use those IF statements to rewrite to a specific location block and deny all in that location:
if ($http_x_custom_header) {
return 403;
}
Reference:
... | NGINX | 18,970,620 | 83 |
I am running docker-nginx on ECS server. My nginx service is suddenly stopped because the proxy_pass of one of the servers got unreachable. The error is as follows:
[emerg] 1#1: host not found in upstream "dev-example.io" in /etc/nginx/conf.d/default.conf:988
My config file is as below:
server {
listen 80... | Just adding a resolver did not resolve the issue in my case. But I was able to work around it by using a variable for the host.
Also, I guess it makes more sense to use Docker's DNS at 127.0.0.11 (this is a fixed IP).
Example:
server {
listen 80;
server_name test.com;
location / {
resolver 127.0.0.11;
... | NGINX | 42,720,618 | 82 |
How to overwrite default Content-Type in nginx? Currently when I request 01.dae file, there's
Content-Type: application/octet-stream;
And I want it to be
Content-Type: application/xml;
I tried something like
location ~* \.dae$ {
types { };
default_type application/xml;
}
and
location ~* \.dae$ {
... | In case you have no file extension:
location ~ something {
default_type application/xml;
}
Nginx docs for default_type
In case you are setting up let's encrypt certificate with a client which creates http server: How to use golang lego let's encrypt client behind nginx?
| NGINX | 19,629,930 | 82 |
I am trying to understand how Nginx's try_files directive works. Nginx is running on my server and serving up the default page located at /usr/share/nginx/html/index.html.
However, I have a simple HTML page located in the filesystem at /var/www/test/index.html. The following config file is not causing that file to get ... | a very common try_files line which can be applied on your condition is
location / {
try_files $uri $uri/ /test/index.html;
}
you probably understand the first part, location / matches all locations, unless it's matched by a more specific location, like location /test for example
The second part ( the try_files ) m... | NGINX | 17,798,457 | 82 |
I have nginx acting as a reverse proxy to apache. I now need to add a new subdomain
that will serve files from another directory, but at the same time I want all location and proxy_pass directives that I have for the default host to apply to the subdomain also.
I know that if I copy the rules from the default host to t... | You could move the common parts to another configuration file and include from both server contexts. This should work:
server {
listen 80;
server_name server1.example;
...
include /etc/nginx/include.d/your-common-stuff.conf;
}
server {
listen 80;
server_name another-one.example;
...
include /etc/nginx/... | NGINX | 9,905,378 | 82 |
I issued a nginx -s stop and after that I got this error when trying to reload it.
[error]: invalid PID number "" in "/var/run/nginx.pid"
That /var/run/nginx/pid file is empty atm.
What do I need to do to fix it?
| nginx -s reload is only used to tell a running nginx process to reload its config. After a stop, you don't have a running nginx process to send a signal to. Just run nginx (possibly with a -c /path/to/config/file)
| NGINX | 7,646,972 | 82 |
With the base install of nginx, your sites-available folder has just one file: default
how does the sites-available folder work and how would I use it to host multiple (separate) websites?
| Just to add another approach, you can use a separate file for each virtual domain or site you're hosting.
You can use a copy of default as a starting point for each one and customize for each site.
Then create symlinks in sites-enabled. In this way you can take sites up and down just by adding or removing a symlink an... | NGINX | 11,693,135 | 81 |
Nginx, Passenger, and Rails are running beautifully on my Linode. Before I launch, I'd like to restrict access so only my IP can view the site.
I've tried to deny access to all, and allow access to only my IP in Nginx. It does deny access to all, but I can't get the allow to work. I have checked to ensure the IP addre... | modify your nginx.conf
server {
listen 80;
server_name www.foo.bar;
location / {
root /path/to/rails/public/;
passenger_enabled on;
allow my.public.ip.here;
deny all;
}
}
| NGINX | 8,438,867 | 81 |
I have a node.js server running behind an nginx proxy. node.js is running an HTTP 1.1 (no SSL) server on port 3000. Both are running on the same server.
I recently set up nginx to use HTTP2 with SSL (h2). It seems that HTTP2 is indeed enabled and working.
However, I want to know whether the fact that the proxy connecti... | In general, the biggest immediate benefit of HTTP/2 is the speed increase offered by multiplexing for the browser connections which are often hampered by high latency (i.e. slow round trip speed). These also reduce the need (and expense) of multiple connections which is a work around to try to achieve similar performan... | NGINX | 41,637,076 | 80 |
Recently I installed the latest version of Nginx and looks like I'm having hard time running PHP with it.
Here is the configuration file I'm using for the domain:
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.php;
}
error_... | Try another *fastcgi_param* something like
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
| NGINX | 17,808,787 | 80 |
Configuration
Ubuntu Server 11.10 64 bit
Amazon AWS, Ec2, hosted on the cloud
t1.micro instance
Before I write anything else, I'd like to state that I've checked both nginx 502 bad gateway and Nginx + PHP-FPM 502 Bad Gateway threads, which unfortunately haven't helped me in this regard.
The issue appears to be rather... | If anyone finds this page by encountering the same problem I had, I found the answer here.
For those of you who can't be bothered to click and work it out for themselves... ;)
The Condition:
Ubuntu or Debian server with NGINX and PHP 5.3 works fine but upgrading PHP to 5.4 gives 502 Bad Gateway errors. Looking for serv... | NGINX | 10,003,978 | 80 |
Im looking for something better than sudo restart projectname every time I issue a git pull origin master, which pulls down my latest changes to a Django project. This restart command, I believe, is related to Upstart, which I use to start/top my Gunicorn server process.
This restart causes a brief outage. Users hittin... | You can tell Gunicorn to reload gracefully using the HUP signal like so:
kill -HUP <pid>
(see the FAQ for details)
I use Supervisor to control my Gunicorn server, which allows me to use this (slightly hacky) way of reloading Gunicorn after a deploy:
supervisorctl status gunicorn | sed "s/.*[pid ]\([0-9]\+\)\,.*/\1/" |... | NGINX | 9,881,819 | 80 |
My docker compose configs look like this:
docker-compose.yml
version: '3.5'
services:
nginx:
ports:
- 8080:8080
docker-compose.prod.yml
version: '3.5'
services:
nginx:
ports:
- 80:80
Now, when I run command: docker-compose -f docker-compose.yml -f docker-compose.prod.... | This behaviour is documented at https://docs.docker.com/compose/extends/#adding-and-overriding-configuration
For the multi-value options ports, expose, external_links, dns, dns_search, and tmpfs, Compose concatenates both sets of values
Since the ports will be the concatenation of the ports in all your compose files,... | NGINX | 48,851,190 | 79 |
As my title, here is the config file located in conf.d/api-server.conf
server {
listen 80;
server_name api.localhost;
location / {
add_header 'Access-Control-Allow-Origin' 'http://api.localhost';
add_header 'Access-Control-Allow_Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authoriz... | The issue is that your if condition is not going to send the headers in the parent in /. If you check the preflight response headers it would be
HTTP/1.1 204 No Content
Server: nginx/1.13.3
Date: Fri, 01 Sep 2017 05:24:04 GMT
Connection: keep-alive
Access-Control-Max-Age: 1728000
Content-Type: text/plain charset=UTF-8
... | NGINX | 45,986,631 | 79 |
Setting up Flask with uWSGI and Nginx can be difficult. I tried following this DigitalOcean tutorial and still had trouble. Even with buildout scripts it takes time, and I need to write instructions to follow next time.
If I don't expect a lot of traffic, or the app is private, does it make sense to run it without uWSG... | When you "run Flask" you are actually running Werkzeug's development WSGI server, and passing your Flask app as the WSGI callable.
The development server is not intended for use in production. It is not designed to be particularly efficient, stable, or secure. It does not support all the possible features of a HTTP se... | NGINX | 38,982,807 | 79 |
In my apache configuration I have the following simple rewrite rule which
unless file exists will rewrite to index.php
on the urls you never see the file extension (.php)
how can I rewrite this in nginx?
#
# Redirect all to index.php
#
RewriteEngine On
# if a directory or a file exists, use it directly
RewriteCond %... | I have tried this and succeeded to get my index page.
When I have added this code in my site configuration file:
location / {
try_files $uri $uri/ /index.php;
}
Inside the configuration file itself it is explained that these are the configured steps
First attempt to serve request as file,
then as directory,
then ... | NGINX | 12,924,896 | 79 |
I am trying to modify the Nginx config file to remove a "rewrite".
Currently, I have this config file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
... | Maybe you're not doing it as root?
Try sudo nginx -s reload, if it still doesn't work, you might want to try sudo pkill -HUP nginx.
| NGINX | 21,292,533 | 78 |
I'm trying to include $remote_addr or $http_remote_addr on my proxy_pass without success. The rewrite rule works:
location ^~ /freegeoip/ {
rewrite ^ http://freegeoip.net/json/$remote_addr last;
}
The proxy_pass without the $remote_addr works, but freegeoip does not read the x-Real-IP:
location ^~ /freegeoip/ {
... | If the proxy_pass statement has no variables in it, then it will use the gethostbyaddr system call during startup or reload and will cache that value permanently. If there are any variables, such as using either of the following:
set $originaddr http://origin.example.com;
proxy_pass $originaddr;
# or:
proxy_pass http... | NGINX | 17,685,674 | 78 |
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... | NGINX | 3,893,839 | 78 |
I'm confused what purpose Mongrel2 serves/provides that nginx doesn't already do.
(Yes, I've read the manual but I must to be too much of a noob to understand how it's fundamentally different than nginx)
My current web application stack is:
- nginx: webserver
- Lua: programming language
- FastCGI + LuaJIT: to connec... | If you could only name one thing then it would be that Mongrel2 is build around ZeroMQ which means that scaling your web server has never been easier.
If a request comes in, Mongrel2 receives it (nothing unusual here, same as for NginX and any other httpd). Next thing that happens is that Mongrel2 distributes the task ... | NGINX | 6,089,091 | 77 |
I have Nginx setup and displaying the test page properly. If I try to change the root path, I get a 403 Forbidden error, even though all permissions are identical. Additionally, the nginx user exists.
nginx.conf:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events ... | I experienced the same problem and it was due to SELinux.
To check if SELinux is running:
# getenforce
To disable SELinux until next reboot:
# setenforce Permissive
Restart Nginx and see if the problem persists. If you would like to permanently alter the settings you can edit /etc/sysconfig/selinux
If SELinux is your... | NGINX | 22,586,166 | 76 |
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:app
But 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?
| Use --daemon option while running gunicorn.
Example:
gunicorn grand56.wsgi:application --name grand56 --workers 3 --user=root --group=root --bind=127.0.0.1:1001 --daemon
| NGINX | 13,654,688 | 75 |
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. ... | To answer your question:
in php-fpm.d/www.conf file:
set the access.log entry:
access.log = /var/log/$pool.access.log
restart php-fpm service.
try to access your page
cat /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 ... | NGINX | 35,261,922 | 73 |
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 part listen 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.... | It is for the IPv6 configs
from the nginx docs
IPv6 addresses (0.7.36) are specified in square brackets:
listen [::]:8000;
listen [::1];
| NGINX | 34,305,351 | 72 |
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 the Nginx 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 m... | 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:
<input... | NGINX | 4,856,917 | 72 |
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 more resources having Gunicorn + Flask running? Is Gunicorn able to reboot the Flask instance when it fails to respond?
What's als... | I think you may be confused, Flask is not a web 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 co... | NGINX | 20,766,684 | 71 |
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 name
Both sites have their own nginx.conf symlinked into sites-enabled, but I get an error starting nginx Starting nginx: nginx: [emerg] duplicate listen op... | 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 one default server.
And it is also says:
A listen directive can have several additional parameters specific to socket-related ... | NGINX | 13,676,809 | 71 |
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;
... | NGINX | 4,833,238 | 71 |
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'
| starting from version 1.9.2 you can do:
nginx -T
show complete nginx configuration
nginx -T | grep "server_name " #include the whitespace to exclude non relevant results
show you all server names
| NGINX | 32,400,933 | 70 |
I tried to deploy my rails app on nginx and ubuntu via capistrano like the tutorial on the page https://gorails.com/deploy/ubuntu/14.04.
but at the end i get an error message:
Incomplete response received from application
in 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/default and 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 root
ru... | NGINX | 29,241,053 | 70 |
I am trying access kibana application deployed in nginx,but getting below
URL :- http://127.0.0.1/kibana-3.1.2
2015/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/... | Old question, but i had the same issue and the accepted answer didnt work for me.
I had to increase the number of worker_connections, as stated here.
/etc/nginx/nginx.conf
events {
worker_connections 20000;
}
| NGINX | 28,265,717 | 70 |
How do I set a location condition 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 ser... | According to nginx documentation
there 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 else
So you could define something like
location ~ (dir1|file2\.php) {
# empty
}
location / {
rewrite ^/(.*... | NGINX | 16,302,897 | 70 |
When is it necessary to restart nginx and reload will not suffice?
Does it make a difference if an extension like passenger is 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 co... | 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... | NGINX | 13,525,465 | 69 |
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 ... | For nginx/mod_wsgi, ensure you read:
http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html
Because 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 scen... | NGINX | 195,534 | 69 |
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 th... | If you're using docker-for-mac 18.03 or newer it auto creates a special DNS entry host.docker.internal that dynamically binds to the host inet ip. You can then use the dns name to proxy services running on the host machine from inside a container as a stand-in for localhost.
i.e. an nginx config file:
server {
listen... | NGINX | 27,810,076 | 68 |
Please help me understand what worker_processes and worker_connections are in Nginx and what is the relation between them. I have looked under Nginx directives it says:
worker_processes
A 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 CP... | 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 o... | NGINX | 23,386,986 | 68 |
Is it possible to serve a custom "Bad Gateway" error page in Nginx?
Similar to having custom 404 pages.
| There are three pieces that must be in place in order for your custom error page to display instead of the generic "Bad Gateway" error.
You must create an html file named something like "500.html" and place it in the root. In the case of Rails running behind Nginx, this means putting it at public/500.html.
You must h... | NGINX | 7,796,237 | 68 |
I have the following scenario: I have an env variable $SOME_IP defined and want to use it in a nginx block. Referring to the nginx documentation I use the env directive in the nginx.conf file like the following:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
env SOME_IP;
Now I want to use the variable for a p... | With NGINX Docker image
Apply envsubst on template of the configuration file at container start. envsubst is included in official NGINX docker images.
Environment variable is referenced in a form $VARIABLE or ${VARIABLE}.
nginx.conf.template:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
... | NGINX | 21,866,477 | 67 |
I want to have my API controller use SSL, so I added another listen directive to my nginx.conf
upstream 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.k... | 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 ... | NGINX | 9,448,168 | 67 |
I'm new to AWS and trying to understand which version of NGINX I should be installing on my instance. I've found multiple options;
Via EPEL as the blog entry
Amazon's own (?) version as this answer
The 2016 NGINX official tutorial
On my development environment (Centos VM) I used sudo yum install nginx. Having trie... | Alternative way to install that could be easier (has a fairly recent version of Nginx):
$ sudo amazon-linux-extras list | grep nginx
38 nginx1=latest disabled [ =stable ]
$ sudo amazon-linux-extras enable nginx1
38 nginx1=latest enabled [ =stable ]
Now you can install:
$ su... | NGINX | 57,784,287 | 66 |
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... | in your location block you can do:
location / {
try_files $uri $uri/index.html;
}
which will tell ngingx to look for a file with the exact name given first, and if none such file is found it will try uri/index.html. So if a request for https://www.example.com/ comes it it would look for an exact file match first, an... | NGINX | 11,954,255 | 66 |
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-available then modify the host file which should listen to a different port (if you didn't change anything here you will find a default file, enter to change it)
in the file change listen: 80 to the port you want to listen to
don't forget to reload the service: service nginx reload
| NGINX | 23,024,473 | 65 |
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.html
... | 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 ... | NGINX | 11,061,788 | 65 |
I've developed a URL shortening web application.
It consists of two separate docker containers: one containing the backend REST api and another containing the frontend static website.
These two containers are linked to an nginx container.
The configuration for this nginx container is below:
worker_processes 1;
event... | If you use a URI with a proxy_pass statement within a regular expression location, you need to build the entire URI using one or more variables. See this document for details.
So the alternatives are to (1), capture the URI from the location expression and add it to the proxy_pass statement. For example:
location ~ ^/(... | NGINX | 53,353,572 | 64 |
I'm using nginx on OS X 10.8. Freshly installed nginx but can't find a way to restart nginx except kill nginx_pid say kill 64116. Wondering if there are better ways to restart nginx.
Found some methods on Google and SO but didn't work:
nginx -s restart
sudo fuser -k 80/tcp ; sudo /etc/init.d/nginx restart
The error m... | Try running sudo nginx before starting nginx.
| NGINX | 14,176,477 | 64 |
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 ... | Nginx uses the Reactor pattern. 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 v... | NGINX | 3,436,808 | 64 |
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.conf
nginx.conf file:
upstream myapp1 {
least_conn;
server http://example.com:81;
server http://example.com:82;
se... | As mentioned in the NGiNX documentation, upstream is supposed to be defined in an http context.
As mentioned in nginx unkown directive “upstream”:
When that file is included normally by nginx.conf, it is included already inside the http context:
http {
include /etc/nginx/sites-enabled/*;
}
You either need to use ... | NGINX | 30,151,436 | 63 |
I installed it by running sudo apt-get install phpymyadmin and then running
sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html and sudo service nginx restart
but 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 out on Github.
Run the following command from your code/projects directory:
curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | bash
Option 2:
This will install PhpMyAdmin ... | NGINX | 23,788,096 | 63 |
I want my nginx make display all url's clean.
http://www.mydomain.com/indexhtml.html as http://www.mydomain.com/indexhtml
http://www.mydomain.com/indexphp.php as http://www.mydomain.com/indexphp
With some research I've made the first case to work. It`s done by following configuration:
location / {
root html;
... | 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;
... | NGINX | 21,911,297 | 63 |
At the end of last week I noticed a problem on one of my medium AWS instances where Nginx always returns a HTTP 499 response if a request takes more than 60 seconds. The page being requested is a PHP script
I've spent several days trying to find answers and have tried everything that I can find on the internet includi... | The cause of the problem is the Elastic Load Balancers on AWS. They, by default, timeout after 60 seconds of inactivity which is what was causing the problem.
So it wasn't NginX, PHP-FPM or PHP but the load balancer.
To fix this, simply go into the ELB "Description" tab, scroll to the bottom, and click the "(Edit)" lin... | NGINX | 15,613,452 | 63 |
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 ... | Add this to your http {} of the nginx.conf file 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 with location ~ .php$ {
fastcgi_b... | NGINX | 13,894,386 | 63 |
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 check Mime.types and nginx configuration file /etc/nginx/ngnix.conf and not found any issue.
still not able t... | This is an working config that I currently use in production.
http://pastie.org/10870547
gzip 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
appli... | NGINX | 12,640,014 | 63 |
I've seen example NGINX configurations with the "deferred" option added to the listen directive
server {
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 me
deferred -- indicates to use that postponed accept... | 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 it HERE.
| NGINX | 8,449,058 | 63 |
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.
s... | 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 like no resolver defined to resolve ...
The solution in my case was to setup the following using a local DNS for DNS ... | NGINX | 5,743,609 | 63 |
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 h... | As of now, the official nginx image uses this to run nginx (see the 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.
| NGINX | 24,241,292 | 62 |
Well I am currently trying to get my django application served using nginx and uwsgi. I am currently using a virtual environment to which uwsgi is installed. However I am currently getting a 502 bad gateway error when attempting to access the page.
The Error I am experiencing.
2014/02/27 14:20:48 [crit] 29947#0: *20 co... | I think you just need to change your socket file to 666(664 is ok with www-data), or remove it and run uwsgi server again.
In my uwsgi.ini:
chmod-socket = 664
uid = www-data
gid = www-data
| NGINX | 22,071,681 | 62 |
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/w... | With nginx 1.9.11, it's not necessary to recompile the server, as they added support for dynamic modules. Take a look here:
https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/
| NGINX | 16,049,717 | 62 |
What is the difference between:
location = /abc {}
and
locaton ~ /abc {}
| location = /abc {} matches the exact uri /abc
location ~ /abc is a regex match on the uri, meaning any uri containing /abc,
you probably want: location ~ ^/abc for the uri begining with /abc
instead
| NGINX | 5,239,131 | 62 |
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 can setup a custom error page for every location block in your nginx.conf, or a global error page for the site as a whole.
To redirect to a simple 404 not found page for a specific location:
location /my_blog {
error_page 404 /blog_article_not_found.html;
}
A site wide 404 page:
server {
listen 80;
... | NGINX | 1,024,199 | 62 |
I'm actually working on a webapp, I use Reactjs for the frontend and Golang for the backend. Those 2 programs are hosted separately on 2 VMs on Google-Compute-Engine. I want to serve my app through https so I choose to use Nginx for serving the frontend in production. Firstly I made my config file for Nginx:
#version: ... | I was trying to create Let's Encrypt certificate using certbot for my sub-domain and had the following issue.
Command:
certbot --nginx -d my_subdomain.website.com -d my_subdomain2.website.com
Issue:
The requested Nginx plugin does not appear to be installed
Solution:
Ubuntu 20+
sudo apt-get install python3-certbot-n... | NGINX | 53,223,914 | 61 |
Now that I have nginx setup I need to be able to hide my .git directories. What kind of rewrite would I need to stop prying eyes? And where in the server {} or http {} block would it go?
| http {
server {
location ~ /\.git {
deny all;
}
}
}
This location directive will deny access to any .git directory in any subdirectory.
Note: This location block must be before your main location block, so that it can be evaluated first.
| NGINX | 2,999,353 | 61 |
How to fix Error: must either provide a name or specify --generate-name in Helm
Created 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 mychart
service.yaml
apiVersion: v1
kind: Service
metadata:
name:... | just to add --generate-name at the end of helm command
| NGINX | 57,322,873 | 60 |
I am using React Router for routing for a multi-page website. When trying to go to a sub page directly https://test0809.herokuapp.com/signin you'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 g... | 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 your index.html regardless 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/... | NGINX | 45,598,779 | 60 |
I use NGINX in my dedicated server.
I've a question about the return and rewrite 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 m... | As stated in the nginx pitfalls you should use server blocks and return statements as they're way faster than evaluating RegEx via location blocks.
Since you're forcing the rewrite rule to send a 301 there's no difference when it comes to SEO, btw..
| NGINX | 30,165,746 | 60 |
I'm getting the following error on my chrome console:
GET http://localhost/grunt/vendor/angular/angular.js net::ERR_CONTENT_LENGTH_MISMATCH
This 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 reques... | Adding the following line to the nginx config was the only thing that fixed the net::ERR_CONTENT_LENGTH_MISMATCH error for me:
proxy_buffering off;
| NGINX | 25,993,826 | 60 |
I've got a Node.js powered site that I'm running on Amazon Elastic Beanstalk.
My Node.js app listens on port 8080, and I'm using the nginx elastic load balancer configuration with my EB app, listening on port 80 and 443 for HTTP and HTTPS.
However, I only want to accept traffic in my app that has come via HTTPS.
I cou... | After several false-starts with ideas from Amazon's paid support, they did come through in the end. The way you get this to work is you configure your environment to respond to both port 80 and 443. Then create a folder in your main Node.js app folder called .ebextensions, and you place a file named 00_nginx_https_rw.c... | NGINX | 24,297,375 | 60 |
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 th... | You have to install pcre3:
apt-get install libpcre3 libpcre3-dev
The 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
| NGINX | 14,045,720 | 60 |
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: Conn... | 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.p... | NGINX | 22,697,584 | 59 |
I am getting this error in my nginx-error.log file:
2014/02/17 03:42:20 [crit] 5455#0: *1 connect() to unix:/tmp/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: xx.xx.x.xxx, server: localhost, request: "GET /users HTTP/1.1", upstream: "uwsgi://unix:/tmp/uwsgi.sock:", host: "EC2.amazonaws... | The permission issue occurs because uwsgi resets the ownership and permissions of /tmp/uwsgi.sock to 755 and the user running uwsgi every time uwsgi starts.
The correct way to solve the problem is to make uwsgi change the ownership and/or permission of /tmp/uwsgi.sock such that nginx can write to this socket. Therefore... | NGINX | 21,820,444 | 59 |
I'm trying to change the client_max_body_size value, so my NGINX ingress will not return the HTTP 413 Content Too Large error (as seen in the logs).
I've tested a few solutions.
Here is my config map:
kind: ConfigMap
apiVersion: v1
data:
proxy-connect-timeout: "15"
proxy-read-timeout: "600"
proxy-send-timeout: "6... | You can use the annotation nginx.ingress.kubernetes.io/proxy-body-size to set the max-body-size option right in your Ingress object instead of changing a base ConfigMap.
Here is the example of usage:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app
annotations:
nginx.ingress.kubernetes.io/pro... | NGINX | 49,918,313 | 58 |
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. Gun... | NGINX | 43,044,659 | 58 |
I'm trying to get my server re-setup as a Lemp stack
The issue I am now running into is installing PHP 7 without Apache, since nGinx will be my webserver.
So, I've added ppa:ondrej/php. ran apt-get update, and tried to install just php7.0 via apt-get install php7.0
--nodeps flag does not work, as I am on Ubuntu 15.10
A... | If you just request php7.0, it'll install Apache as default. Do apt-get install php7.0-fpm and it'll install as FPM instead, leaving something like nginx up to you.
| NGINX | 34,880,267 | 58 |
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 git@github.com:example/example.co.uk.git
to pull my files on GitHub to the /p... | 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 | 20,276,895 | 58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.