Questions tagged [nginx]
Nginx is a web and proxy server. Note that questions on the use and configuration of server software may be off-topic and subject to closure if they do not directly involve a programming context. Other Stack Exchange sites such as Super User, Server Fault, or Webmasters may be more appropriate places to ask such questions.
nginx
55,662
questions
3427
votes
45
answers
2.6m
views
From inside of a Docker container, how do I connect to the localhost of the machine?
I have a Nginx running inside a docker container. I have a MySql running on the host system. I want to connect to the MySql from within my container. MySql is only binding to the localhost device.
Is ...
1138
votes
12
answers
443k
views
Node.js + Nginx - What now?
I've set up Node.js and Nginx on my server. Now I want to use it, but, before I start there are 2 questions:
How should they work together? How should I handle the requests?
There are 2 concepts for ...
656
votes
8
answers
439k
views
Nginx -- static file serving confusion with root & alias
I need to serve my app through my app server at 8080, and my static files from a directory without touching the app server.
# app server on port 8080
# nginx listens on port 8123
server {
...
587
votes
19
answers
433k
views
Nginx no-www to www and www to no-www
I am using nginx on Rackspace cloud following a tutorial and having searched the net and so far can't get this sorted.
I want www.mysite.example to go to mysite.example as normal in .htaccess for SEO ...
459
votes
10
answers
805k
views
Where can I find the error logs of nginx, using FastCGI and Django?
I'm using Django with FastCGI + nginx. Where are the logs (errors) stored in this case?
417
votes
17
answers
329k
views
(13: Permission denied) while connecting to upstream:[nginx]
I am working with configuring Django project with Nginx and Gunicorn.
While I am accessing my port gunicorn mysite.wsgi:application --bind=127.0.0.1:8001 in Nginx server, I am getting the following ...
404
votes
28
answers
588k
views
nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
All of a sudden I am getting the below nginx error
* Restarting nginx
* Stopping nginx nginx
...done.
* Starting nginx nginx
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
...
403
votes
33
answers
1.0m
views
NGinx Default public www location?
I have worked with Apache before, so I am aware that the default public web root is typically /var/www/.
I recently started working with nginx, but I can't seem to find the default public web root.
...
348
votes
19
answers
387k
views
upstream sent too big header while reading response header from upstream
I am getting these kind of errors:
2014/05/24 11:49:06 [error] 8376#0: *54031 upstream sent too big header while reading response header from upstream, client: 107.21.193.210, server: aamjanata.com,...
331
votes
4
answers
178k
views
Nginx location priority
What order do location directives fire in?
328
votes
27
answers
377k
views
nginx error connect to php5-fpm.sock failed (13: Permission denied)
I update nginx to 1.4.7 and php to 5.5.12, After that I got the 502 error. Before I update everything works fine.
nginx-error.log
2014/05/03 13:27:41 [crit] 4202#0: *1 connect() to unix:/var/run/...
323
votes
32
answers
370k
views
Kubernetes service external ip pending
I am trying to deploy nginx on kubernetes, kubernetes version is v1.5.2,
I have deployed nginx with 3 replica, YAML file is below,
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ...
317
votes
26
answers
521k
views
How to clear the cache of nginx?
I use nginx to as the front server, I have modified the CSS files, but nginx is still serving the old ones.
I have tried to restart nginx, to no success and I have Googled, but not found a valid way ...
307
votes
21
answers
801k
views
Nginx 403 error: directory index of [folder] is forbidden
I have 3 domain names and am trying to host all 3 sites on one server (a Digital Ocean droplet) using Nginx.
mysite1.name
mysite2.name
mysite3.name
Only 1 of them works. The other two result in 403 ...
278
votes
6
answers
438k
views
Configure nginx with multiple locations with different root folders on subdomain
I'm looking to serve the root url of a subdomain and directory of a subdomain to two different folders on my server. Here is the simple set-up that I have and is not working...
server {
index ...
277
votes
5
answers
261k
views
How can I have same rule for two locations in NGINX config?
How can I have same rule for two locations in NGINX config?
I have tried the following
server {
location /first/location/ | /second/location/ {
..
..
}
}
but nginx reload threw this error:
...
276
votes
17
answers
462k
views
nginx - client_max_body_size has no effect
nginx keeps saying client intended to send too large body. Googling and RTM pointed me to client_max_body_size. I set it to 200m in the nginx.conf as well as in the vhost conf, restarted Nginx a ...
259
votes
3
answers
236k
views
What does upstream mean in nginx?
upstream app_front_static {
server 192.168.206.105:80;
}
Never seen it before, anyone knows, what it means?
255
votes
3
answers
233k
views
nginx missing sites-available directory
I installed Nginx on Centos 6 and I am trying to set up virtual hosts. The problem I am having is that I can't seem to find the /etc/nginx/sites-available directory.
Is there something I need to do ...
242
votes
18
answers
721k
views
NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream
I have Puma running as the upstream app server and Riak as my background db cluster. When I send a request that map-reduces a chunk of data for about 25K users and returns it from Riak to the app, I ...
241
votes
8
answers
262k
views
Have nginx access_log and error_log log to STDOUT and STDERR of master process
Is there a way to have the master process log to STDOUT STDERR instead of to a file?
It seems that you can only pass a filepath to the access_log directive:
access_log /var/log/nginx/access.log
...
236
votes
4
answers
232k
views
What's the difference of $host and $http_host in Nginx
In Nginx, what's the difference between variables $host and $http_host.
235
votes
16
answers
613k
views
Possible reason for NGINX 499 error codes
I'm getting a lot of 499 NGINX error codes. I see that this is a client side issue. It is not a problem with NGINX or my uWSGI stack. I note the correlation in uWSGI logs when a get a 499.
...
231
votes
12
answers
300k
views
Nginx 403 forbidden for all files
I have nginx installed with PHP-FPM on a CentOS 5 box, but am struggling to get it to serve any of my files - whether PHP or not.
Nginx is running as www-data:www-data, and the default "Welcome to ...
231
votes
11
answers
406k
views
Nginx reverse proxy causing 504 Gateway Timeout
I am using Nginx as a reverse proxy that takes requests then does a proxy_pass to get the actual web application from the upstream server running on port 8001.
If I go to mywebsite.example or do a ...
228
votes
6
answers
384k
views
nginx: [emerg] "server" directive is not allowed here
I have reconfigured nginx but I can't get it to restart using the following configuration:
server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
...
225
votes
16
answers
191k
views
React-router and nginx
I am transitioning my react app from webpack-dev-server to nginx.
When I go to the root url "localhost:8080/login" I simply get a 404 and in my nginx log I see that it is trying to get:
my-nginx-...
223
votes
10
answers
120k
views
nginx: how to not exit if "host not found in upstream"?
We have several rails apps under common domain in Docker, and we use nginx to direct requests to specific apps.
our_dev_server.com/foo # proxies to foo app
our_dev_server.com/bar # proxies to bar
...
221
votes
8
answers
300k
views
How to redirect to a different domain using Nginx?
How can I redirect mydomain.example and any subdomain *.mydomain.example to www.adifferentdomain.example using Nginx?
219
votes
8
answers
281k
views
NGINX to reverse proxy websockets AND enable SSL (wss://)?
I'm so lost and new to building NGINX on my own but I want to be able to enable secure websockets without having an additional layer.
I don't want to enable SSL on the websocket server itself but ...
218
votes
29
answers
393k
views
Nginx serves .php files as downloads, instead of executing them
I am installing a website in a droplet (Digital Ocean). I have an issue for install NGINX with PHP properly. I did a tutorial https://www.digitalocean.com/community/tutorials/how-to-install-linux-...
216
votes
5
answers
237k
views
How do I prevent a Gateway Timeout with FastCGI on Nginx
I am running Django, FastCGI, and Nginx. I am creating an api of sorts that where someone can send some data via XML which I will process and then return some status codes for each node that was sent ...
214
votes
18
answers
343k
views
Nginx: stat() failed (13: permission denied)
I am using the default config while adding the specific directory with nginx installed on my ubuntu 12.04 machine.
server {
#listen 80; ## listen for ipv4; this line is default and implied
...
214
votes
11
answers
253k
views
How to run Nginx within a Docker container without halting?
I have Nginx installed on a Docker container, and am trying to run it like this:
docker run -i -t -p 80:80 mydockerimage /usr/sbin/nginx
The problem is that the way Nginx works, is that the initial ...
210
votes
8
answers
130k
views
How can I tell if my server is serving GZipped content?
I have a webapp on a NGinx server. I set gzip on in the conf file and now I'm trying to see if it works. YSlow says it's not, but 5 out of 6 websites that do the test say it is. How can I get a ...
209
votes
28
answers
100k
views
Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk
I'm running into "413 Request Entity Too Large" errors when posting files larger than 10MB to our API running on AWS Elastic Beanstalk.
I've done quite a bit of research and believe that I need to up ...
208
votes
15
answers
325k
views
413 Request Entity Too Large - File Upload Issue
I am trying to upload 30MB file on my server and its not working.
When I upload 30MB file, the page loads "Page Not Found"
When I upload a 3MB file, I receive "413 Request Entity Too Large" with ...
205
votes
6
answers
167k
views
nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size
I'm in the process of setting up a new server. The web server of my choice is NGINX. I want to add the domain (e.g. example.com) as a virtual host. I already have two other domains in there and it ...
204
votes
10
answers
254k
views
Locate the nginx.conf file my nginx is actually using
Working on a client's server where there are two different versions of nginx installed. I think one of them was installed with the brew package manager (its an osx box) and the other seems to have ...
202
votes
4
answers
300k
views
How to edit nginx.conf to increase file size upload
I want to increase the maximum file size that can be uploaded.
After doing some research online, I found that you have to edit the file 'nginx.conf'.
The only way I can currently access this file is ...
196
votes
34
answers
583k
views
nginx.service failed because the control process exited
nginx.service failed because the control process exited
$ systemctl status nginx.service
nginx.service - Startup script for nginx service
Loaded: loaded (/usr/lib/systemd/system/nginx.service; ...
192
votes
6
answers
160k
views
nginx: send all requests to a single html page
Using nginx, I want to preserve the url, but actually load the same page no matter what. I will use the url with History.getState() to route the requests in my javascript app. It seems like it ...
188
votes
19
answers
304k
views
SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
I'm not able to setup SSL. I've Googled and I found a few solutions but none of them worked for me. I need some help please...
Here's the error I get when I attempt to restart nginx:
root@s17925268:~...
188
votes
7
answers
330k
views
How can query string parameters be forwarded through a proxy_pass with nginx?
upstream apache {
server 127.0.0.1:8080;
}
server{
location ~* ^/service/(.*)$ {
proxy_pass http://apache/$1;
proxy_redirect off;
}
}
The above snippet will redirect requests ...
185
votes
3
answers
344k
views
nginx error "conflicting server name" ignored [closed]
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
#root /usr/share/nginx/www;
root /home/ubuntu/node-...
184
votes
7
answers
231k
views
Default nginx client_max_body_size
I have been getting the nginx error:
413 Request Entity Too Large
I have been able to update my client_max_body_size in the server section of my nginx.conf file to 20M and this has fixed the issue. ...
183
votes
19
answers
166k
views
nginx showing blank PHP pages
I have setup an nginx server with php5-fpm. When I try to load the site I get a blank page with no errors. Html pages are served fine but not php. I tried turning on display_errors in php.ini but ...
179
votes
8
answers
275k
views
nginx server_name wildcard or catch-all
I have an instance of nginx running which serves several websites. The first is a status message on the server's IP address. The second is an admin console on admin.domain.com. These work great. Now I'...
173
votes
7
answers
75k
views
API gateway vs. reverse proxy
In order to deal with the microservice architecture, it's often used alongside a Reverse Proxy (such as nginx or apache httpd) and for cross cutting concerns implementation API gateway pattern is ...
170
votes
6
answers
463k
views
How to start nginx via different port(other than 80)
Hi I am a newbie on nginx, I tried to set it up on my server(running Ubuntu 4), which already has apache running.
So after I apt-get install it, I tried to start nginx. Then I get the message like ...