Prompt stringlengths 14 160 | Instruction stringlengths 18 2k | Response stringlengths 8 2k |
|---|---|---|
about ip_hash in nginx upstream module | I want to replace pound with nginx as loadbalancer and all tests look fine so far. I will do a typical upstream configuration like this:upstream backend {
ip_hash;
server backend1.example.com;
server backend2.example.com;
server backend3.example.com;
}There are now 2 questions left open:How long does this... | It is based on client source ip address hash and as long as you have same set of backends stickiness will persist.http://nginx.org/en/docs/http/ngx_http_upstream_module.html#ip_hash |
Including the hostname in a HTML file served by nginx | Does nginx offer a way to add the hostname (and port) in an HTML file (without using other solutions, such as PHP)? | May beSSIis what you are looking for?All variables, which available in core module also available in ssi module.Usage example::I had put this string inside test.html and invoke this page throughhttp://localhost/test.htmlAs a result I get following string:localhost:80 |
How to use fastcgi_next_upstream in Nginx [closed] | Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed10 years ago.Improve this questionI'd like to have 1 web server (nginx) and 2 FastCGI instances of the same application as back-end. The idea is to forward req... | http://wiki.nginx.org/HttpUpstreamModulehttp://wiki.nginx.org/HttpFcgiModuleupstream backend {
server main_backend.server:port1;
server backup.server:port2 backup;
}
fastcgi_pass backend; |
using certbot-auto for nginx | I have an nginx running.
Now I want my nginx to use SSL:certbot-auto --nginx -d my.domain.com -n --agree-tos --email[email protected]OUTPUT:Performing the following challenges:
tls-sni-01 challenge for my.domain.com
Cleaning up challenges
Cannot find a VirtualHost matching domain my.domain.com.my.domain.com is pointing... | In my case, I had to add the "server_name" line because it wasn't in my nginx config so it was giving me the error message "Cannot find a VirtualHost matching domain my.domain.com" when I ran:certbot --nginxMake sure this is in your config:server {
server_name my.domain.com;
....
} |
nginx configuration with multiple location blocks | I'm trying to configure nginx to serve 2 different php scripts from 2 different location. The configuration is as follows.I have a Laravel installation which resides in/home/hamed/laravelin which itspublicdirectory should be served.I have a Wordpress installation in/home/hamed/www/blog.And this is mynginxconfiguration:... | Thanks to @RichardSmith I finally managed to create the right configuration. Here is the final working config. I had to use the combination of nestedlocationblocks and an inverse regex match for it to work.server {
listen 443 ssl;
server_name example.com;
root /home/hamed/laravel/public;
# ... |
How To Convert Apache Config To NGINX | I am moving from an Apache to an NGINX environment and need to convert the following virtual server configuration to NGINX.
DocumentRoot /var/www/myproject/web
ServerName myproject.dev
ServerAlias myproject.dev
AllowOverride All
Order allow,deny
Allow from All
What would b... | server {
listen 80;
server_name myproject.dev;
root /var/www/myproject/web;
}Start from herehttp://wiki.nginx.org/Configuration. |
Weak ETAGs in Rails? | What is the best way to tell rails to useweak instead of strong ETAGswhen using methodsfresh_whenandstale??The reason I ask is thatnginx (correctly) removes strong ETAG headers from responses when on-the-fly gzipping is enabled. | I took the code from @grosser's answer and turned it into a Gem:https://rubygems.org/gems/rails_weak_etagshttps://github.com/johnnaegle/rails_weak_etagsYou can just add this to your gemfile:gem 'rails_weak_etags'And it will be installed into your middleware beforeRack::ConditionalGet:> bundle exec rake middleware
....
... |
How to have multiple location blocks use the same named @location | I am trying to create a nginx conf file that has little repetition in it. I am using nginx to serve static files, and it proxies 404s or php content to the named location @varnish:location @varnish {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_head... | If you put the proxy settings into the server context and let the locations inherit them, then it's not much to duplicate. You can also set up an upstream block to make it easier to change the proxy target should you need to:upstream _varnish {
server localhost:6081;
}
server {
proxy_redirect off;
proxy_set_hea... |
Multiple Nginx Alias to One Location | I would like to create a location rule for two alias to one location.This is the rule used for one location:location ~ ^/images/(.*)$ { alias /var/www2/images/$1; }What I would like to do is define two alias in location. So for example,
I can visithttp://domain.com/styles/file.cssandhttp://domain.com/css/file.cssand it... | Try:location ~ ^/(?:styles|css)/(.*)$ { alias /var/www2/styles/$1; }Orlocation ~ ^/(styles|css)/(.*)$ { alias /var/www2/styles/$2; }$1refers to the first capturing group(...). When you added another group it referred to that one instead. You can use a non-capturing group(?:...)instead, or refer to the second capturing ... |
A curious string copy function in C | When I was reading the nginx code, I have seen this function :#define ngx_cpymem(dst, src, n) (((u_char *) memcpy(dst, src, n)) + (n))
static ngx_inline u_char *
ngx_copy(u_char *dst, u_char *src, size_t len)
{
if (len < 17) {
while (len) {
*dst++ = *src++;
len--;
}
... | It is an optimization - for very small strings simple copy is faster than calling a system (libc) copy function.Simple copy withwhileloop works rather fast for short strings, and system copy function have (usually) optimizations for long strings. But also system copy does a lot of checks and some setup.Actually, there ... |
NGINX hashbang rewrite | I'm wondering what a location or rewrite nginx directive for hashbang (#!) urls would look like. Basically routing all non hash-banged url's through the hashbang like a front controller. So:http://example.com/about/staffwould route tohttp://example.com/#!/about/staffI'm unclear what the best technique here would be? Wh... | GETs for fragment identifiers don't/shouldn't (some buggy clients may send them) appear in an HTTP request, so you can't have a rewrite rule to match them, regardless of webserver.The HTTP engine cannot make any assumptions about it. The server is not even given it.If you tried to make the initial request for / redire... |
How do I fix Nginx 502 Bad Gateway on large headers? | I have a Django REST Framework app running behind an Nginx proxy, we have a third party service that redirects to one of the urls in the app. I'm getting 502s from this endpoint when the redirect happens and have narrowed it down to the Referer header being too large. My logic is as follows:Received 502 when the redire... | After a number of hours trying out different things, the reason was in fact the uwsgi buffer-size just not being high enough even though I had quadrupled it. For those that don't know, you need to add:buffer-size=32768Where the number is some number of bytes that works for your use case. The default is 4096. |
Kubernetes Ingress running behind nginx reverse proxy | I have installed minikube on a server which I can access from the internet.I have created a kubernetes service which is available:>kubectl get service myservice
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
myservice 10.0.0.246 80:31988/TCP 14hThe IP address of minikube is:>minikube ip
192.168.... | As stated by @silverfox, you need an ingress controller. You can enable the ingress controller in minikube like this:minikube addons enable ingressMinikube runs on IP 192.168.42.135, according tominikube ip. And after enabling the ingress addon it listens to port 80 too. But that means a reverse proxy like nginx is re... |
why between nginx/nginx upstream use http/1.0? | I have 3 server:
A(nginx)-->B(nginx)-->C(nodejs),When i access A or B,chrome use http/1.1+keepalive by default.I do not set "proxy_http_version 1.1;" and proxy_set_header Connection "";But between A and B,NGINX use http/1.0 by default。That is like:client-->nginxA(upstream to b)-->nginxB(upstream to c)-->C (nodejs)http... | Nginx since version 1.1.4 supports HTTP/1.1 when connecting to upstream servers. You just need to set configuration parameterproxy_http_version 1.1(1.0 is the default value).
seehttp://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version |
Error code: ssl_error_rx_record_too_long for https in nginx on ruby on rails application | am using rails 3.2 and ruby 1.9 for my app, have to run application in https with domain name likehttps://welcome.comon my system. so i configure my nginx by creating ssl certificate for domain name and httpssnapshort of ssl:# HTTPS server
#
server {
listen 443 ssl;
server_name welcome.com;
root html;
index index.... | You can't have bothlisten 443 ssl;andssl on;, remove thessl on;line and restart nginx. |
php -v and php-fpm -v show different versions of php | I've been struggling with this all night and can't find an answer that fixes it!I'm on a mac and using homebrew to install php and nginx, I ran the following which show as successfulbrew install php
brew install nginxno problems so far and I can start both servicesbrew services start nginx
brew services start nginxwhen... | Okay I've now got bothphp -vandphp-fpm -vreturning the same value of php and i did it by runningbrew doctorwhich told me to run echo'export PATH="/usr/local/sbin/:$PATH"'so now that I have the same versions running and can confirm that php-fpm is running without failing usinglsof -i | grep php-fpmI'm on to normal probl... |
Why use nginx to deploy tornado instead of its built-in server? | I found out that we can run the tornado application from just firing something likepython main.py. But everyone else says to deploy tornado with nginx. What are the benefits? I know it's a bit foolish, but I really am confused. | See the notes on Nginx in the Tornado docs:http://tornado.readthedocs.org/en/stable/guide/running.htmlSince one Tornado process can only take advantage of one CPU core (Edit:Seeupdated docsfor a development on this), use Nginx to load-balance multiple Tornado processes to use multiple cores
Additionally, Nginx is like... |
Flush output buffer in Apache/Nginx setup | I would like to have page content for a web page I am developing appear on screen as it is downloaded. In my test/development environment this works as expected using the PHP flush() command.However, my production setup (WPEngine) uses an Nginx proxy in front of Apache and flush() no longer works (nor do any of the oth... | You should turn off buffering in nginx:proxy_buffering off;Reference:http://nginx.org/r/proxy_buffering |
Heroku Cedar and nginx (gzip) | According to the comments in the accepted answer hereRails how to Gzip Javascript? (Heroku)and the official cedar documentation (http://devcenter.heroku.com/articles/http-routing#the_herokuappcom_http_stack):Since requests to Cedar apps are made directly to the application server – not proxied through an HTTP server li... | You must be accessing these apps through a domain pointing to these IPs:75.101.163.44
75.101.145.87
174.129.212.2These are the apex faces and they are in front of both bamboo and cedar apps. Varnish is there for bamboo, but any request that goes through them ends up going through varnish too.These faces are only for ap... |
NGinx : How to test if a cookie is set or not without using 'if'? | I am using the following configuration for NGinx currently to test my app :location / {
# see if the 'id' cookie is set, if yes, pass to that server.
if ($cookie_id){
proxy_pass http://${cookie_id}/$request_uri;
break;
}
... | There are two reasons why 'if is evil' as far as nginx is concerned. One is that many howtos found on the internet will directly translate htaccess rewrite rules into a series of ifs, when separate servers or locations would be a better choice. Secondly, nginx's if statement doesn't behave the way most people expect ... |
Handling flask url_for behind nginx reverse proxy | I have a flask application using nginx for a reverse proxy/ssl termination, but I'm running into trouble when using url_for and redirect in flask.nginx.conf entry:location /flaskapp {
proxy_pass http://myapp:8080/;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}The... | I managed to fix it with some changes.Change 1. Adding /flaskapp to the routes in my flask application. This eliminated the need for URL-rewriting and simplified things greatly.Change 2. nginx.conf changes. I added logc in the location block to redirect http requests as https, new conf:location /flaskapp {
proxy_pass... |
django-allauth: how to modify email confirmation url? | I'm running django on port 8001, while nginx is handling webserver duties on port 80. nginx proxies views and some REST api calls to Django. I'm using django-allauth for user registration/authentication.When a new user registers, django-allauth sends the user an email with a link to click. Because django is running ... | Django get hostname and port from HTTP headers.
Addproxy_set_header Host $http_host;into your nginx configuration before optionsproxy_pass. |
NGINX bind to a specific network interface, regardless of IP address | Is there a way to make Nginx 1.11 bind to a specific interface regardless of the IP address?I've got a home gateway to an ISP provider; it uses DHCP client to obtain its dynamic IP address. I do not know what that IP address is at NGINX configuration time.Surely, there must be a way to make such a fine HTTP server bin... | Edit your startup sequence to run a command or script that captures the interface's IP address and writes it to a file in the formatlisten :80or whatever port you want:echo "listen $(ip -o -4 a s eth0 | awk '{ print $4 }' | cut -d/ -f1):80;" > /path/to/some/fileThen just have your nginx config include that file:include... |
Nginx access_log default flush time | How frequently nginx flushes its buffer to access_log by default ?In manual there is not info, just setup syntax:access_log path [format [buffer=size [flush=time]] [if=condition]]; | Nginx doesn't flush unless you specify theflushoption (even if you have specified thebufferoption).Here's an example of how to buffer packets of 8k to the log every five minutes:access_log /var/log/nginx/access.log main buffer=8k flush=5m; |
proxying relative urls with nginx | My question is similar toNginx Relative URL to Absolute Rewrite Rule?- but with an added twist.I have nginx acting as a proxy server, which proxies for multiple apps, similar to this (simplified) config:server {
listen 80;
server_name example.com;
location /app1 {
proxy_pass http://app1.com;
}
location... | Based on your updated comments;if the upstream backend sends the referer header, you could do something like this:location ~* ^/(css|js)/.+\.(css|js)$ {
#checking if referer is from app1
if ($http_referer ~ "^.*/app1"){
return 417;
}
#checking if ... |
600+ memcache req/s problems - help! | I am running memcached on my server and when it hits 600+ req/s it becomes unstable and causes a big load of problems. It appears when the request rate gets that high, my PHP applications at random times are unable to connect to the memcache server, causing slow load times which makes nginx and php-fpm freak out and I... | Switch away from using TCP sockets and going to UNIX sockets (assuming you are on a unix based server)Start memcached with a socket enabled:
Add-s /tmp/memcached.socketto your memcached startup line (Note, sockets disables networking support)Then in PHP, connect using persistent connections, and to the new memcache soc... |
Running Nginx Docker with SSL self signed certificate | I am trying to run a UI application with Docker using nginx image I am able to access the service on port 80 without any problem but whenever I am trying access it via https on 443 port I am not able to access the applications the site keeps loading and eventually results in not accessible I have updated the nginx.conf... | For nginx server to allow SSL encryption you need to provide ssl flag while listening in nginx.conf
and only ssl certificate will not be sufficient, you will need the ssl certificate key and password as well and they must be configured.charset utf-8;
server {
listen 80;
server_name localhost;
root /usr/sha... |
nginx with passenger | I'm trying to move from Apache + Passenger to Nginx + passenger on my Ubuntu Lucid Lynx box.When I install passenger:sudo gem install passengerandcd /var/lib/gems/1.9.1/gems/passenger-2.2.14/bin
sudo ./passenger-install-nginx-moduleeverything is fine (no error). Nginx is downloaded and compiled and installed at the sam... | Youdidend up with 2 Nginx installations:The one installed globally by your OS's package manager (/usr/sbin/nginx). This uses /etc/nginx/nginx.conf as configuration file by default.The one installed by Phusion Passenger (/opt/nginx/sbin/nginx). This uses /opt/nginx/conf/nginx.conf as configuration file by default.Only (... |
Why browsers display CORS error in case of response 413? | I was testing an REST Api that uploads image file to server.The image was too large and exceeded max request body size, so Nginx refused it and returned response 413(Request Entity Too Large).Nginx: error.log*329 client intended to send too large body: 1432249 bytes, client: xx.xx.xx.xx, server: api.example.com, reques... | The issue in this case is that the error response didn't have an appropriateAccess-Control-Allow-Originon it, so the requesting application didn't have permissions to view it. That is, even the error messages are subject to cross-origin policy. |
How to configure nginx for heroku nodejs web application | How does one configure nginx for a heroku nodejs web application? I would like to configure nginx such that an IP address is limited to N requests for a given time period. Like the classic "You're doing that too much" message as seen on Reddit.Thanks,Charles | Good starting point :heroku/heroku-buildpack-nginxWhat you are looking for is rate-limiting with NGINX, read this for a better understandingand here you have an example gist:NGINX reverse proxy with rate limitingThis is the file of theheroku-nginx-node-examplethat I think you have to add thelimit_reqoptionsIf you need ... |
Is it possible to use Windows integrated auth without IIS? | I have an nginx reverse proxy to a few node apps. Our users are all on a Windows domain controlled network. I'm aware I can useexpress-ntlmorpassport-windowsauthto prompt the user for their login credentials, but that's non-integrated auth.Is it possible to use integrated auth (windows authenticated users can bypass cr... | Yes, you can, there is a package callednode-sspi. It only works on Windows environment though.Windows SSPI server-side authentication for NodeNodeSSPI to Node.js is what mod-auth-sspi to Apache HTTPD. In a nutshell NodeSSPI authenticates incoming HTTP(S) requests through native Windows SSPI, hence NodeSSPI runs on Wind... |
Sending information to a ngnix from php on the same server without http | We are developing a realtime app and we are using nginx push stream module for a websockets part. Firstly, data is send from a client to a php script that does some authentication and stores needed information in database and then pushes information to nginx that later sends it to a subscribed users on a specific socke... | I am assuming the following:Current work flow:User run php script from command line, which communicate with a server side script/cgi setup in Nginx using http requestServer side script/cgi in Nginx will take the incoming data, process it and put it in database, or send out to end userOP concern:Efficiency of command li... |
Nginx: can I use $server_name when specifying access log location? | I want to write a config file for an nginx virtual host that looks like this:server {
listen 80;
server_name www.my-domain-name.com;
access_log /home/me/sites/$server_name/logs/access.log;
error_log /home/me/sites/$server_name/logs/error.log;
location /static {
alias /home/me/sites/$serve... | I wanted to do this too, but apparently by design nginx cannot expand variables in theerror_logcommand, in case there are errors doing so and it cannot get a log filename to write them to.Their suggestion is to use some program to generate your configuration files instead. You could usesedfor this, to automatically se... |
How can I securely detect SSL in CakePHP behind an nginx reverse proxy? | CakePHP (all versions that I've seen) check against$_SERVER['HTTPS']to see whether a request has been made over HTTPS instead of plain HTTP.I'm using nginx as a load balancer, behind which are the Apache application servers. Since the SSL connection terminates at the load balancer,$_SERVER['HTTPS']is not set as far as ... | mod_rpafwill let you do this.This sets the HTTPS value in Apache to "on" based on the headers sent by nginx so Cake will work out of the box (as well as any other apps run in Apache).It also corrects the values for REMOTE_ADDR, SERVER_PORT and HTTP_HOST.Here is my example config:
RPAF_Enable On
RPAF_Proxy... |
Cross-Subdomain Requests | I have two URLs:One is the application URL =http://domain.com/appOne is the application API URL =http://api.domain.com/How can I get the application to be able to request things from the api at a different subdomain.I have already tried putting Access-Control-Allow-Origin: * on both sides with no luck.Thanks | The two servers (not the client) need to send the following headers:Access-Control-Allow-Origin : Decide which origin could call into the serverAccess-Control-Allow-Methods : The method that is allowed to access the resource (GET or POST)Access-Control-Max-Age : How long the cache is heldYou could inspect the headers r... |
NGinx - Count requests for a particular URL pattern | I wanted to count the number of requests to a particular url pattern. Not sure how this is done in NGinx.Is this possible:When an request to the url pattern comes, we serve that request first. Then NGinx makes another request asynchronously to a server which counts the impression. NGinx does not wait for the response o... | You can use the post_action directive to trigger a sub_request after the main request is complete.Useful for the sort of logging you have in mind.** OCT 2016 UPDATE **The post_action directive has been removed from the Nginx documentation and while it still appears to work, usage is inadvisable. Caveat Emptor!** JAN 20... |
ExpressJS Server Goes Offline Every Night - 502 Bad Gateway | I have a website with Nginx installed as a reserve proxy for an ExpressJS server (proxies to port 3001). This uses Node and ReactJS for my frontend application.This is simply a testing website currently, and isn't known or used by any users. I have this installed on a Digital Ocean Droplet with Ubuntu.Every morning whe... | I think you should check thisgithub thread, it seems like it could help you.Basically, after few hours, a Nodejs server stop functioning, and the poor nginx can not forward its requests, as the service listening to the forward port is dead. So it triggers a 502 error.It was all due to a memory leak, that leads to a mas... |
How to resolve a PHP-FPM Primary script unknown with a PHP-FPM and an Nginx Docker container? | My situation is this, I have two Docker containers:Runs PHP-FPM on port 9000Runs nginx and has PHP files (should the PHP-FPM container have access to the files?)I keep getting the following error:FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.17.0.1, ser
ver: _... | Change root line to:root /var/www/WordPress/;for the$fastcgi_script_namedoesn't include/ |
Php5-FPM error while including multiple phar files | We are using a Ubuntu+nginx+php5-fpm combination on our servers with PHP version being 5.5. We are trying to run index.php which includes a bunch of phar files. Something like:When this script is run from the command line PHP, it works fine. When this is run from either php Development server (php -S) or from nginx, we... | The problem might be happening because of conflicting stubs in your various phar files. Try: |
Why Node.js failed to serve .woff files | I downloaded the.wofffile from Google web fonts for some network reason in China. Previously I tried@font-facethat onGithub Pagesand it works. But this time it took me an hour to find where was broken.I use Node to serve static files withmime, and thecontent-typeappears to beapplication/x-font-woff, and my code in Coff... | In this line,fs.readFileSync(filepath, 'utf8')the encoding is set to'utf8'. It needs to be'binary'.Also, theres.end(file_content)function needs to pass the right encoding. Tryres.end(file_content, 'binary').I had the same issue and had to figure it out myself, this answer doesn't seem to exist anywhere online. |
Clarification: Does Heroku Run Python Apps Behind Nginx or Not? | TL/DR: My primary question: Is it worth my time to try to add NGinx to my Django/Gunicorn/Cedar/PostgresSql app or does Heroku do this type of performance improvement for me?In the Cedar documentation (https://devcenter.heroku.com/articles/cedar), it clearly states that cedar does not support a reverse-proxy. "Cedar d... | Heard back from Heroku Support:We do not recommend trying to add nginx to your stack, nor does Heroku provide that layer. But you are correct that if you wish to gzip responses, your application must gzip the responses - this is often handled in application framework (e.g. Ruby's Rack) as a middleware layer. gzip is ex... |
good unicorn + nginx + cap deploy howto? | Can anyone suggest a good good unicorn + nginx + cap deploy how to?
I have searched high and low spend like 5 hours getting my deploy up and running with all kind or errors. | Just yesterday I had to setup some Unicorns and nginx. I followed:The article aa_memon already mentionedandhttp://www.slideshare.net/mauricio.linhares/deploying-your-rails-application-to-a-clean-ubuntu-10Also, here is my Unicorn config and init.d script:https://gist.github.com/2049606.The deploy script I ended up using... |
How to configure nginx to act as a load balancer for proxies? | I am aware that nginx can be configured to act as a load balancer, but I'm wondering if it is possible to load balance between proxies? Let's say I have multiple proxies running on localhost, and I want to use nginx to provide a single point of connection so that I can rotate between the proxies. I am trying to achieve... | as you can see in your haproxy post haproxy akt as aforward proxyoption http_proxyWhat this option mean is described in the manualhttps://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4-option%20http_proxyIt sometimes happens that people need a pure HTTP proxy which
understands basic proxy requests without ca... |
Django @login_required dropping https | I'm trying to test my Django app locally using SSL. I have a view with the@login_requireddecorator. So when I hit/locker, I get redirected to/locker/login?next=/locker. This works fine with http.However, whenever I use https, the redirect somehow drops the secure connection, so I get something likehttps://cumulus.dev/l... | Django is running on plain HTTP only behind the proxy, so it will always use that to construct absolute URLs (such as redirects), unless you configure it how to see that the proxied request was originally made over HTTPS.As of Django 1.4, you can do this using theSECURE_PROXY_SSL_HEADERsetting. When Django sees the con... |
How do docker-compose network aliases work if there are multiple instances for zero downtime container update? | So I have:version: "3.6"
services:
nginx:
image: nginx
app:
image: node:latestAnd my nginx config is:upstream project_app {
server app:4000;
}
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://project_app;
}In order to update a container without downtime (rolling u... | So I finally found more info on this.When writingserver app:4000;,appisa DNS entry, which resolves to multiple instances.Itis possibleto update those DNS entrieswithout having to restart nginx. The detail is here:https://serverfault.com/a/916786/182596Thisreddit postandnnginx this articlehelped also.Basically, one has ... |
Tomcat process time is small but nginx shows it is big | I have five tomcat instances behind nginx.Sometimes the nginxupstream_response_timeis very big, more than 1 second, while the tomcat local access log shows the process time is only 50ms(I use%Dto log process time).What is the possible reason and how to fix it? It does not seems the network is slow since other applicati... | The servers normally queue the requests until a thread is available to handle it.
If there are many requests in the queue but only a few threads, a single thread might handle the request quite fast, but if you add the time, the request was queued, the consumer sees a much longer time.See:How to increase number of threa... |
Apache equivalent of Nginx `proxy_buffering off` | I have an application that requires me to disable buffering in the reverse proxy. I managed to do that with the following nginx configuration:server {
listen 80;
server_name 10.0.0.104;
location / {
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header ... | flushpackets=onmeans flushing out the buffer after each chunk is sentThis example is from the guacamole docs:https://guacamole.apache.org/doc/gug/proxying-guacamole.html#proxying-with-apache
Order allow,deny
Allow from all
ProxyPass http://HOSTNAME:8080/guacamole/ flushpackets=on
ProxyPassReverse http:/... |
Nginx ssl_verify_client and proxy_pass [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, ... | At the moment, that is not supported in nginx. But there is senginx[1], it's proxy module is extended to support client certificate handshake with origin server.[1]http://www.senginx.org/en/index.php/Proxy_HTTPS_Client_Certificate |
Installed Nginx with passenger-install-nginx-module. How do I uninstall it? | I'm on Mac OSX. Nginx is installed in /opt/nginx.How do I uninstall it? Any thoughts? | gem uninstall passengerwill remove passenger and all these dependenciespassenger, passenger-install-apache2-module,
passenger-install-nginx-module, passenger-config, passenger-status,
passenger-memory-stats, passenger-make-enterprisey |
How do I get Phpmyadmin to work with Nginx and Ubuntu? [closed] | Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed12 years ago.Improve this questionI'm using Ubuntu 11.04 and Nginx.I want to install phpmyadmin and have access to it on mydomain.com/phpmyadmin.I've looked ar... | First, you have to configure php with fpm or fastcgi (older method) on nginx, there are plenty of docs available for that.
Once you have setup php with either of the methods, all you have to do is extract phpmyadmin files to the docroot in a subdirectory and configure phpmyadmin by editing config.inc.php or using the s... |
Docker: Is it possible to share data between 2 containers without a volume? | I have 2 containers:webandnginx. When I buildwebcontainer, static assets for frontend are generated within the container.Now, I want to share those assets betweenwebandnginxwithout using a volume on the host machine. Otherwise, I'll have to build those static assets on the host side and then include as a volume into th... | Otherwise, I'll have to build those static assets on the host side and then include as a volume into the web container and share it with nginx container.This statement seems incorrect.If the static assets are generated as part of the build process, then just mount a volume on top of that directory at runtime. Docker w... |
Handling Multiple Concurrent Large Uploads | I've created an API in Laravel, that allows users to upload zip archives that contain images.Once an archive is uploaded it's sent to S3 and then picked up by another service to be processed.I'm finding that with larger archives PHP keeps hitting its memory limit. I know I could raise the limit but that feels like a sl... | Thanks for the discussion everyone. After looking into PHP Post/Upload process, it cleared up how things worked a little.Updating the SDK appeared to eliminate those initial memory limit issues.Of course I'm still looking into the issue of concurrency, but I feel like this is more of an apache/nginx/server config/spec ... |
nginx redirect loop with ssl | This is a very similar problem toNginx configuration leads to endless redirect loopbut that discussion has not led me to an answer yet. I'm learning how to work with nginx and ssl and everything works perfectly on the regular http:// example.com side of things, but when routing to the https:// example.com/admin I inste... | When nginx encounters ahttpsprotocol it thinks it is still usinghttpas the protocol and is not being forwarded with the rest of the headers, try adding:proxy_set_header X-Forwarded-Proto $scheme;in your location blocks to fix it. |
passenger 5 performance compared to unicorn/thin/puma/etc | I've been searching around for performance tests on the new passenger 5 as I readhereit became way faster.I tried to find other ressources confirming this but no luck. Has anyone tried to install it and see the difference? | Passenger 5 scores better on custom-picked benchmarks because it has a built-in caching layer ("turbocaching") that can avoid actually running your application code for identical requests in a short timeframe; it will not make your actual application code run any faster. This caching layer is only active in certain con... |
Config of nginx to filter http flood | A have a http flood on my server, not so much queries, but anyway. Queries in log95.55.237.3 - - [06/Sep/2012:14:38:23 +0400] "GET / HTTP/1.0" 200 35551 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)" "-" | "-"
93.78.44.25 - - [06/Sep/2012:14:38:23 +0400] "GET / HTTP/1.0" 200 36051 "-" "Mozilla/5.0 (Windows; U;... | Try adding something like the following directives to your config to prevent http flooding:http {
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;
server {
limit_conn conn_limit_per_ip 10;
limit_req zone=req_limit_per_... |
Laravel proper permissions | I just tried to change my Laravel project to run on Nginx instead of Apache and can't get the right permissions. Don't really know what to try next. Currently here they are:I even gave the 777 permission to the storage folder, but nothing works. I have an admin panel on a blog which always keeps throwingErrorException ... | This will work, as777is a security risksudo chmod -R o+w storage/
sudo chmod -R 775 storage/ |
502 error with nginx + uwsgi +django | I've tried to configure django on top on nginx and uwsgi and a 502 bad gateway error is encountered when trying to access localhostThis is my /etc/ngingx/sites-available/default fileserver {
server_name testapp1.com www.testapp1.com;
access_log /var/log/nginx/testapp1.com.access.log;
location / {
u... | The error message is clear enough:Tue Jul 10 21:49:38 2012 - uwsgi socket 0 bound to UNIX address
/run/uwsgi/app/testapp1/socket fd 5
Tue Jul 10 21:49:38 2012 - bind():
No such file or directory [socket.c line 107]Do you see difference between:socket = /run/uwsgi/testapp1/socketand:uwsgi_pass unix:///var/run/uwsgi/app/... |
How to configure Kibana 4 and elasticsearch behind nginx? | I have kibana 4 and elasticsearch running on the same server.I need to access kibana through a domain but when I try I keep getting file not found.I just create location /kibana in nginx and the proxy_pass is the ip:port of kibana.Anyone had this? | I fixed it by the following:location /kibana4/ {
proxy_pass http://host:5601/;
proxy_redirect http://host:5601/ /kibana4/;
}I had to use proxy_redirect to have the response back !Thanks |
wkhtmltopdf (pdfkit) Could not connect to any X display | I am trying to use wkhtmltopdf with Django ,nginx,uwsgi
it works perfectly on development env running using manage.py runserver
but when serving with nginx ans uwsgi i get this error:wkhtmltopdf exited with non-zero code 1. error:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-isp'
qt.qpa.screen:... | SolutionInstead of usingapt-get install wkhtmltopdfI downloaded the latest version from thereleases pageand everything works now. |
Nginx Routing path to server | I have a few sites. Each site has its own "server" section with a server_name that looks like thisserver {
...
server_name siteA.example.com;
root /var/www/siteA;
...
}I can therefore bring up the site using the urlhttp://siteA.example.comI however also need to bring up the site by using the urlhttp://examp... | Two options to add to your config below ...Option 1:server {
...
server_name example.com;
...
location /siteA {
root /var/www/siteA;
...
}
location /siteB {
root /var/www/siteB;
...
}
...
}Option 2:server {
...
server_name example.com;
...
... |
Get the real IP address of client with Rails and Nginx? | My server doesn't have a public IP address, so I don't know how to get the real client's IP address.This is my nginx's configuration:location / {
proxy_pass http://domain1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwar... | You should get the header value X-forwarded-forhttp://en.wikipedia.org/wiki/X-Forwarded-For |
What is the cause of the "502 Bad Gateway" after Ghost 1.8.7 update | I recently installed Ghost 1.8.4 and Nginx on myAWS ec2 Ubuntu 16.04server. When I loaded my blog site, it correctly took me to the Ghost home page, from where I logged into Ghost admin. On the admin screen, there was a message to update.I ranghost updatein puttyThe update appeared to be successful, but when I returned... | I've experienced 502 issues with ghost behind nginx several times over a few years of running it. I'm not sure if the cause of mine today is the same as yours, but what I observed was that after a restart ghost had changed its port number to one different than what its nginx config was listening on.I followed these di... |
How to Proxy Pass from / to /index.html | I'm currently working on a JS Project, that uses the url path. Now if I go on my website withexample.com/, the JavaScript won't work, because I actually needexample.com/index.html.I'm already using an reverse proxy to proxy pass to two different docker containers. So my idea was to pass the request toexample.com/index.... | Below config should work for youserver {
listen 80;
server_name example.com;
# allow large uploads of files - refer to nginx documentation
client_max_body_size 1G;
# optimize downloading files larger than 1G - refer to nginx doc
before adjusting
#proxy_max_temp_file_size 2G;
location = / {
rewrite ^ /ind... |
mail() doesn't work on new server | May be it's a dumb question, but I can't find the reason why php mail function doesn't work
I have a nginx server on debian squeeze, I moved to it recently. I tried simple mail execution but it return false.if(mail('[email protected]', 'test-subject', 'test-text-blablabla'))
echo 'ok';
else
echo 'bad';What can i ... | Okay, I made it. How I made it for debian squeeze with nginx server: (all commands I execute from root user)First of all you need to install sendmailapt-get install sendmailnext, you must configure this file that was easier than I thoughtsendmailconfigokay, next step that I make was a php.ini configuration (I'm not a g... |
How to remove "X-Runtime" header from Nginx/Passenger? | EDIT-- the solution I posted below probably applies to any server (Nginx/Apache/anything else), because this header is set in Rails itself.Anyone know where the "X-Runtime" header can be removed in Nginx & Passenger?I've grepped the source files and haven't found anything yet, but I'd like to get rid of it for security... | Turned out it wasn't being set in either Nginx or Passenger.It's in benchmarking.rb in /gems/actionpack-2.3.2/lib/action_controller/, line 90. |
nginx gzip compression not working | I have no idea where to place my gzip compression lines within myhttpblock, shown here.http {
default_type application/octet-stream;
include /etc/nginx/mime.types;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '... | Edit your config file like this and it should work:gzip on;
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf fon... |
Gunicorn doesn't log real ip from nginx | I run a django app via gunicorn, supervisor and nginx as reverse proxy and struggle to make my gunicorn access log show the actual ip instead of 127.0.0.1:Log entries look like this at the moment:127.0.0.1 - - [09/Sep/2014:15:46:52] "GET /admin/ HTTP/1.0" ...supervisord.conf[program:gunicorn]
command=/opt/middleware/bi... | The problem is that you need to configuregunicorn's logging, because it will (by default) not display any custom headers.From the documentation, we find out that the default access log format is controlled byaccess_log_formatand is set to the following:"%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"where:h... |
How to deploy a svelte kit app after build using nginx as web server | I have a svelte kit project. I want to deploy the app in an Nginx web server after annpm run build. At the moment I have a node container and I use to start usingnpm run preview. It's working fine, but I want to deploy in a production environment usingbuild.How could I do that?ref:https://kit.svelte.dev/docs#command-li... | As @Caleb Irwin said, you can runnode ./build/index.jsThe NGINX configuration will look like this:upstream sveltekit {
server 127.0.0.1:3000;
keepalive 8;
}
server {
# listen ...
# servername ...
# root ... (folder with an index.html in case of sveltekit being crashed)
location / {
proxy_set_header... |
Upgrade Phusion Passenger without reinstalling Nginx | Is it possible to upgrade Phusion Passenger to a newer version when it is already running (with Nginx in my case)?I installed Passenger 4.0.0.rc6 usingpassenger-install-nginx-module. My Nginx config now containspassenger_root /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.rc6;
passenger_ruby /usr/local/bin/ruby;Now ... | @Wukerplank's comment put me on the right track. I checked the output when runningpassenger-install-nginx-moduleagain and it says:Nginx doesn't support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.
Do you want this installer to download,... |
When does nginx $upstream_response_time start/stop specifically | Does anyone know when, specifically, the clock for$upstream_response_timebegins and ends?The documentation seems a bit vague:keeps time spent on receiving the response from the upstream server; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like ad... | A more specific definition is in theirblog.$request_time– Full request time, starting when NGINX reads the first
byte from the client and ending when NGINX sends the last byte of the
response body$upstream_connect_time– Time spent establishing a
connection with an upstream server$upstream_header_time– Time
between esta... |
nginx.conf (permission to write denied). How do I fix this? | So I am trying to follow the tutorial here:https://gorails.com/deploy/ubuntu/14.04to deploy a Rails app. When I tried to edit the nginx.conf at (/etc/nginx/nginx.conf) file, it tells me I have read only permission, even though I followed the steps(with setting the permissions) previously. How do I fix this? | you need sudo to edit that file, because it's owned by root user,usesudo nano /etc/nginx/nginx.conforsudo vim /etc/nginx/nginx.confwhich ever editor you prefer. |
How to get subdomain of URL in NGINX | I am wanting to do a redirect based on what subdomain the user is entering.For example:.example.com/admin -> .myurl.comIdeally I want to passas a parameter to my redirect URL.I was looking at something along the lines of this:location ~ (sub).(somewhere).(com)/(some)(thing)/(something)(else) {
set $var1 = $1; # = sub... | The domain name part of the URL is not tested by thelocationdirective. You will need to use a named capture in theserver_namedirective. Seethis documentfor details.For example:server {
server_name ~^(?\w+)\.example\.com$;
location /admin {
return 301 $scheme://$name.myurl.com/;
}
} |
Nginx: how to let rewrite rules ignore files or folders | I use Nginx to serve a SPA (Single Page Application), in order to support HTML5 History API I have to rewrite all deeper routes back to the/index.html, so I followthis articleand it works! This is what I put in nginx.conf now:server {
listen 80 default;
server_name my.domain.com;
root /path/to/app/root;
... | Putrewriteinto onelocationand use otherlocations for assests/dynamic urls/etc.server {
listen 80 default;
server_name my.domain.com;
root /path/to/app/root;
location / {
rewrite ^ /index.html break;
}
location /assets/ {
# Do nothing. nginx will serve files as usual.
}
} |
Nginx: Prevent direct access to static files | I've been searching for a while now but didn't manage to find anything that fits my needs. I don't need hotlinking protection, as much as I'd like to prevent people from directly accessing my files. Let's say:Mywebsite.comrequestswebsite.com/assets/custom.js, that'd work,but I'd like visitors which directly visit this ... | You can use nginx referer module:http://nginx.org/en/docs/http/ngx_http_referer_module.html.
Something like this:server {
listen 80;
server_name website.com;
root /var/www/website.com/html ;
location /assets/ {
valid_referers website.com/ website.com/index.html website.com/some_other_good_page.h... |
PHP-FPM and Nginx rewrite causing download [closed] | Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed11 years ago.Improve this questionI have an Nginx HTTP server with PHP-FPM set up and almost everything works fine. I want to be able to go topath/to/fileand ... | Try changingrewrite ^/beta/(.+)$ /beta/index.php?url=$1 break;torewrite ^/beta/(.+)$ /beta/index.php?url=$1 last; break;Which should get nginx to re-read the URI and process it accordingly. |
How to append Nginx IP to X-Forwarded-For in Kubernetes Nginx Ingress Controller | I’’m wondering “How to append Nginx IP to X-Forwarded-For”I added snippet in Ingress annotation.apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ing
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-Forwarded-For "$remote_addr, $server_addr";But it see... | Your configuration snippet is not being doubled, actually what is happening is thatproxy_set_header X-Forwarded-For $remote_addr;is already set by default when you deploy NGINX Controller in your cluster.In order to disable this default setting, you need to use acustom template.By doing this, you can have a ngin... |
Elastic Beanstalk Nginx Serve Static Files | I am new to Elastic Beanstalk, trying to serve a Node.js Express app and utilize serving our static files separately with Nginx. None of the tutorials I've come across are explicit in how to define the virtual path.I'm attempting to do this through the AWS console in the browser. I am trying to add a virtual path/direc... | This is a known bug, They only support python when it comes to the web console. if your application is in nodejs you would need to set these properties from the cli.you can setup the values from cli this wayaws elasticbeanstalk update-environment --environment-id your_enviornment_id --option-settings 'Namespace=aws:ela... |
phpMyAdmin import file size 2M limit | I was using phpmyadmin (Version information: 4.0.10deb1) on php 7.0.7 & nginx 1.4.6 . When I was trying to import a csv file to one of tables, I saw the max size allowed indicated on the phpmyadmin screen is 2,048KiB . Then I changed settings in php.ini (both /etc/php/7.0/fpm/php.ini & /etc/php/7.0/cli/php.ini):upload_... | I checked with myDigitalOceantechnical support and found out the reason: I restarted Nginx, but haven't restarted php-fpm which is the PHP process for Nginx.After I triedservice php7.0-fpm restart, phpMyAdmin is showing (Max: 150MiB) for importing limit now. And the importing works! |
How to point a Dokku app at the root domain of the dokku server | How do I point a dokku app that will set up in the dokku server, to point at the root domain of the server itself. Suppose my domain isapps.comand the app to be implemented is calledbotapp. If I use virtualhost naming, and dogit remote add dokku[email protected]:botappit will get pointed atbotapp.apps.com. What do I do... | As of v0.3.10, Dokku ships with a domains plugin. This lets you easily add domains to your app. By default your app is located atmyapp.mydomain.com. If you want your app to be accessible via the root domain, then just add the root domain as one of your app's domains.dokku domains:add myapp mydomain.com.That was really ... |
Nginx Cache-Control header not working (getting 404 on logs) | I'm trying to setup nginx to cache static files, such as images, css and js.This is my conf.server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /var/www/site;
index index.html index.htm;
}
... | The problem was withlocation ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}It should have root path set.location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
root /var/directory/...
... |
nginx rewrite rule under a subdirectory | I have a WordPress site running nginx under a sub-direcotry.
how can i write rewrite rules in a sub-directory?
or can anyone please convert this Apache rewrite rule? I searched everywhere about nginx rewrite rules but nothing worked!
RewriteEngine On
RewriteBase /main/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUE... | try to use this, and please don't forget to replace root path!location /main/ {
root /full/path/from/root/main/;
try_files $uri $uri/ /index.php?$args;
}I've set wordpress on my host in folder /main and got it's working with next settings:location /main {
index index.php;
try_files $uri $uri/ /mai... |
Nginx allow only root and api locations | I have a server configured as a reverse proxy to my server. I want to reject all the requests except to two locations, one for root and another the api root.so the server should only allow requests to the given pathsexample.com/ (only the root)
example.com/api/ (every url after the api root)The expected behaviour is th... | Here it is:location = / {
# would serve only the root
# ...
}
location /api/ {
# would serve everything after the /api/
# ...
}You need a special '=' modifier for the root location to work as expectedFrom thedocs:Using the “=” modifier it is possible to define an exact match... |
Using Google Compute Engine as a proxy for a Google App Engine web app | I have a Java web app on Google App Engine which makes requests to an external API. The API recently requires the whitelisting of IP addresses in order to access its services. Because GAE does not offer static IPs, I understand that one solution is to set up GCE instance (with a static IP) and use it as a proxy for ext... | We faced a similar issue with a client who needed our IP address to be whitelisted. We solved the issue by:Spinning up a Compute Engine with a static IP address. This is the IP address we gave to our clientInstalled Squid on the compute engine (https://help.ubuntu.com/lts/serverguide/squid.html)We then redirected all c... |
NGINX try_files does not pass to PHP | I have a very simple PHP site:.
├── about.php
├── index.php
├── project
│ ├── project_one.php
│ └── project_two.php
└── projects.phpAnd the following nginx config (only relevant parts shown):location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/path/to/php.sock;
fa... | Per nginx documentation fortry_filesChecks the existence of files in the specified order and uses the first found file for request processing;the processing is performed in the current contextso nginx find PHP file and process it in context oflocation /therefor just serve it as static file. Only last parameter is diffe... |
Why does $_SERVER["REMOTE_ADDR"] show a different IP than my external IP? [duplicate] | This question already has answers here:Closed12 years ago.Possible Duplicate:suddenly $_SERVER['REMOTE_ADDR'] is started returning 10.10.10.10 phpI must have missed some fundamental thing here.. But when I navigate to an IP-displaying site such ashttp://www.whatsmyip.org/they show a certain IP. But when I echo out$_SER... | If your computer is on the same network with your server, behind a router with NAT, then you might see your private IP |
asp.net core on linux with nginx routing doesn't work | I've created anASP.NET Core MVCapplication and deployed it into Linux server. When I go to sitename.com browser shows up the Home/Index page without any problem.But when I try to gositename.com/Home/Indexor another controller likesitename.com/Admin/Loginnginx throws a404 Not Founderror. What should be the problem?Here ... | Removetry_files $uri $uri/ =404;as it's testing if a certain url exists on the file system and if not return 404.But/Home/Indexis a route, which do not map to an existing file but to controller action, hence you get the 404 error. |
Nginx url limit 502 gateway | I have a question but I accept other suggestions that bypass this feature.Basically I'm sending big lines of text ~3000 characters to my server in a get request and the server sends it to google translate as params in a url.The problem: Nginx throws me a 502 bad gateway error when the url is > 1900 characters.How can I... | To answer your question, there is a setting you can change in the nginx.conf file containing your server's configuration.Set the following setting to something that seems fitting to your situation:large_client_header_buffers 4 16k;Find the documentation for ithere.I would suggest to use a POST request in case your ~300... |
letsencrypt django webroot | I am trying to setup my nginx and django to be able to renew certificates.
However something goes wrong with my webroot-pluginin nginx:location ~ /.well-known {
allow all;
}But when I run the renewal command:./letsencrypt-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=/home/sult/huppels -d h... | I have my Django app running with gunicorn. I followed the instructionshere.I made sure to include the proper location blocks:location /static {
alias /home/user/webapp;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set... |
Handle Express Subdomain with nginx | I Wonder how can i handle subdomains in my project that based on Expressjs.Here's Mynginxconfigurationserver {
listen 80;
server_name bee.local;
access_log /var/log/nginx/bee.local.access.log;
error_log /var/log/nginx/bee.local.error.log;
location / {
proxy_pass http://1... | There are several requirements:SetupHostheader in nginx with required domain or proxy if applicableUsesubdomainmiddleware before other middlewares that handle endpointsWork example:nginx configuration:server {
listen 80;
server_name bee.local;
location / {
proxy_pass http://127.0.0.1:3000;
... |
Why laravel homestead is not running Apache | Obviously, I've Laravel project that really needs the.htaccessrules and Nginx doesn't seem to be the best solution for me,1- my question is why Laravel didn't provide homestead with Apache!
After a small research that I made I foundonline toolfor converting the rules but the output didn't work (was too short), whereas,... | Steps are as followshere.SSH into vagrant ->vagrant sshStop Nginx ->sudo service nginx stopRemove it ->sudo apt-get purge nginxUpdate you repos ->sudo apt-get updateInstall apache ->sudo apt-get install apache2Restart it ->sudo service apache2 restartYou are now on Apache server, update the apache conf file as your nee... |
what is the difference in resolver valid time and resolver_timeout in nginx | I have this nginx configuration entry.http {
resolver 172.17.42.1 valid=600s;
resolver_timeout 60s;In this configuration there 2 two different timeouts.
The nginxdocumentationdoes not make it clear to me what is the difference betweenvalidandresolver_timeout.Can someone explain in detail? | resolve_timeoutsets how long NGINX will wait for answer from resolver (DNS).validflag means how long NGINX will consider answer from resolver as valid and will not ask resolver for that period.In your example, let's say NGINX want to resolveexample.com. It will ask resolver (172.17.42.1) and if resolver doesn't answer ... |
Configure nginx proxy_pass with two parallel locations | Let's say we have the following quite minimalnginx.conf:server {
listen 443 default ssl;
location /api/v1 {
proxy_pass http://127.0.0.1:8080;
}
}Now, I'm trying to usenginxitself as an event-source. Another component in my system should be aware of any HTTP requests coming in, while ideally not blocking the ... | This can be done usingecho_locationdirective (or similar, browse the directives) of the 3rd partyNginx Echo Module. You will need to compile Nginx with this module or useOpenrestywhich is Nginx bundled with useful stuff such as this.Outline code:server {
[...]
location /main {
echo_location /sub;
... |
Spring Boot configure a Domain/Host to access in a www.website.com fashion | I have a spring boot application. Usually I run my Spring applications on PaaS instances, and configuring a domain name from there is easy enough, however I am running this on a Virtual Private Server, and I cannot, for the life of me, figure out how to run my spring boot so it's accessible with a domain name.I have al... | Technically you could do that in Tomcat. However, to start the application with port 80 or 443 you would have to run it with root permissions. Thus i'd recommend to configure and Apache HTTP or an Nginx server as reverse proxy (you can find many tutorials for that topic). |
jQuery ajax won't make HTTPS requests | I'm doing some pretty basic jQuery ajax stuff on my website, and I'm having a boatload of trouble.Here's the relevant code:$(document).ready( function() {
$("#getdatabutton").click( function() {
$.ajax({
url: "/jsontest/randomdata",
type: "get",
data: [{name:"ymax", value... | Try fixing the URL so your server doesn't have to redirecturl: "/jsontest/randomdata/" // there was a missing trailing /
// i.e. https://larsendt.com/jsontest/randomdata?ymax=500&count=32&t=0.9604179110508643
// was going to https://larsendt.com/jsontest/randomdata/?ymax=500&count=32&t=0.9604179110508643 |
Request Line is too large (8192 > 4094) [duplicate] | This question already has an answer here:How to set gunicorn limit_request_line parameter over 8190?(1 answer)Closed2 years ago.I am using nginx and gunicorn to deploy my django project, when I use GET funcation posted data to server I get the error:Bad Request
Request Line is too large (8192 > 4094)On nginx.conf I ha... | it is gunicorn issue, not Nginxyou can change the limit--limit-request-linehttps://docs.gunicorn.org/en/stable/settings.html#limit-request-line |
How to avoid basic authentication for AWS ELB health-check with nginx configuration | I'm having a trouble trying to implement basic authentication for ELB healthcheck.
I've searched quite a bit to figure out the nginx file configuration to avoid 401 error shown below, which ELB returns due to basic authenticationunhealthy in target-group hogehoge due to (reason Health checks failed with these codes: [4... | The easiest approach would be to create a location for the ELB, for example:location /elb-status {
access_log off;
return 200;
}You will just need to change thePing Pathto be/elb-statusIf you want to see something on your browser while testing you may need to change thecontent-typesince defaults toapplication/octet... |
Node JS - Nginx - proxy_pass to a subdirectory - Koa | I'm running a Koa app on port 5000, and i'd like Ngnix to serve the app in a sub-directory - e.g:http://example.com/myNodeAppHere's what I've currently got in/etc/nginx/sites-enabled/defaultlocation ^~ /myNodeApp/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy... | I have recently come across the same problem and here's what I did to fix it.In Server Config:I had to addrewrite ^/myNodeApp/(.*)$ /$1 break;to the NGINX config, in thelocation /myNodeApp/ {...}block, under what you already have in your example.In client side:I addedto the of my html files (or pug layout file in my c... |
Chef::Exceptions::ChecksumMismatch when installing nginx-1.7.8 from source | I get the following error when runningvagrant up --provisionto set up my development environment with vagrant...==> default: [2014-12-08T20:33:51+00:00] ERROR: remote_file[http://nginx.org/download/nginx-1.7.8.tar.gz] (nginx::source line 58) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (0510af... | Thenginx cookbookrequires you to edit thechecksumattribute when using another version of nginx. Theremote_fileresource that is causing you an error is:remote_file nginx_url do
source nginx_url
checksum node['nginx']['source']['checksum']
path src_filepath
backup false
endYou need to update the checksum ... |
Problematic Nginx config | I have setup the following ngnix config for my Ubuntu 14.04 VPS running HHVM with ngnix:server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/lephenix/main_website;
index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
include hhvm.conf... | It needs to be:index index.php index.html index.htmThe directive is "index".Also, the "try_files" is wrong. Change to:try_files $uri $uri/ /index.php$is_args$argsAlso it's much nicer to have the config file indented properly. It makes it much easier to debug.I suspect the tutorial that you followed is wrong, it's cert... |
Puma / missing logs | Why I don't see any Rails specific entries in the logs ?I'm using Puma 2.7.1 with Nginx proxy, on a normal Debian box, nothing fancy, ruby 1.9.3 via RVM.My puma config:#!/usr/bin/env puma
environment 'sandbox'
bind 'unix://tmp/puma.sock'
stdout_redirect 'log/puma.log', 'log/puma_error.log', true
pidfile 'tmp/pids/puma.... | Rails has a seperate log file and doesn't log to the puma log. By default, Rails logs to a file inlogs/.log, e.g.log/production.log |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.