Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
nginx / 413 Request Entity Too Large
When I'm trying to upload a file on my server I get this error:413 Request Entity Too LargeWhich ofcourse means my file is too large. So i've done a quick google search and came accross this:open:/etc/nginx/nginx.confEdit:# set client body size to 2M # client_max_body_size 2M;However I don't have that code in my nginx....
client_max_body_sizedefault value is 1 MB.RTM
how can I use external URI with the nginx's auth_request module
I'm trying to usenginx'sngx_http_auth_request_modulein such way:server { location / { auth_request http://external.url; proxy_pass http://protected.resource; } }It doesn't work, the error is:2017/02/21 02:45:36 [error] 17917#0: *17 open() "/usr/local/htmlhttp://external.url" failed (2: No such ...
There is a little known fact that you don't have to start location with/or@.So this would work:location / { auth_request .auth; proxy_pass http://protected.resource; } location .auth { internal; proxy_pass http://external.url/auth; # you must use path part here ^ # otherwise it would be invalid...
How can I enforce SSL using ASP.NET Core and nginx
I spun up a new VM running Ubuntu 16.04 and ran the command.dotnet new -t webwhich creates a new basic MVC web template. Next I ran the app and the connection was successful.After that I modified nginx.conf to use SSLserver { listen 443 http2 ssl default; ssl_certificate /etc/s...
Your SSL connection is terminated as nginx, which communicates with Kestrel in plain http. Kestrel redirects user to https, which is terminated again in nginx, passed to Kestrel as http and again and again. That's endless loop.Configure nginx to require https (redirect http to https), don't touch Kestrel. You site itse...
Connecting to webservice results in com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 200: OK
I made a wsdl using sun-jaxws. I created a web service client in Netbeans, and successfully called the wsdl web service. Then I configured my nginx server to access the web service by https. When I call the service over https I get the following error:com.sun.xml.internal.ws.client.ClientTransportException: The server ...
The problem was in the extra slash in my url. I changed url fromhttps://somesite.com/mywsdl/?wsdltohttps://somesite.com/mywsdl?wsdland the problem disappeared.
In Nginx, "etag" directive doesn't work for proxy_pass?
I'm using Nginx 1.9.2 and following is my configurationupstream httpserver0{ server 127.0.0.1:35011 max_fails=3 fail_timeout=30s; #H_server0 ...
No, it does not work forproxy_pass.http://nginx.org/r/etagEnables or disables automatic generation of the “ETag” response header field forstatic resources.Even more, it's turned on by default.
Nginx Subdomain redirect to static URL
I have a domain that I can browse to viaexample.com:1234. Now I do not want to always have to type the port at the very end, but rather have nginx redirect me to the static URL when browsing a subdomain eg.status.example.com.I have tried writing a redirect, but it didn't work at all.server { listen 80; server_n...
Please try configuration as below,server { listen 80; server_name status.example.com; location / { proxy_pass http://example.com:1234; } }For reference useNGINX Reverse ProxyandModule ngx_http_proxy_module
How to access web page served by nginx web server running in docker container
We are trying to use docker to run nginx but for some reason I'm unable to access thenginxweb server running inside the docker container.We have booted a Docker Container using the followingDockerfile:https://github.com/dwyl/learn-docker/blob/53cca71042482ca70e03033c66d969b475c61ac2/Dockerfile(Its a basic hello world u...
You shouldn't be trying to hit the IP address of the container, you should be using the IP address of the host machine.What you are missing is the mapping of the port of the host machine to the port of the container running the nginx server.Assuming that you want to use port 8888 on the host machine, you need a paramet...
nginx: [emerg] host not found in "localhost:8004" of the "listen" directive
I am developing a django powered application usingnginxandgunicorn. Everything was fine, until today which i tried to restartnginxwhich failed. so I tested it withsudo nginx -tcommand and I got this error.nginx: [emerg] host not found in "localhost:8004" of the "listen" directive in /etc/nginx/sites-enabled/808:2 ngin...
thissmart answerwas my solutionI assume that you're running a Linux, and you're using gEdit to edit your files. In the/etc/nginx/sites-enabled, it may have left a temp file e.g.default~(watch the~). Delete this file, and it will solve your problem.
How to change chef nginx default http port 80?
I tried to install apache on a machine that chef-server was installed. Apache could not start up due to the occupation of port 80 by chef nginx. If I want to let apache use port 80 as default, is it possible to change chef nginx default http port to another one?I found a solution on the Internet to set virtual host on ...
Here is how to change the port. Edit/etc/opscode/chef-server.rbnginx['non_ssl_port'] = 10080 nginx['ssl_port'] = 10443 nginx['url'] = "https://:10443/"and adjust your local~/.chef/knife.rbto readchef_server_url 'https://:10443/organizations/'But currently there is a bug in Chef that prevents the embedded nginx to run o...
How to include redirects on external file?
I need to setup about 5-6k redirects on a domain (for a site migration), and I'm new to nginx. I have some test redirects working in the main .conf file for the domain. But I don't want to have 5k+ rewrites in the main .conf file so I have been told that I can include a external file in the .conf to keep it clean, so...
OK, issue was I was calling the extenal file redirects.conf, since every file ending in .conf is considered a site configuration file.I changed it to sitename.redirects and now it works fine
Passenger process already running? but its not
Trying to start passenger standalone withpassenger start -p 80and it's saying its already running but when i do apassenger stop -p 80i getAccording to the PID file '/var/crm/tmp/pids/passenger.80.pid', Phusion Passenger Standalone doesn't seem to be running.But it clearly is not because when i try stop it, it says its ...
try runninglsofornetstat -tlnp | grep 80to determine which application is using port 80. Once you have that figured out you can do something like ps -elf to kill that process.
Global favicon.ico and iOS icons
I am looking to set the icons for a domain on an nginx server I have configured. There are many different urls on this domain which will need to display the same favicon / icon no matter what the url.I am looking for some advice in implementation.
If you would like to have all (sub)domains on a server have the same favicon, you can enter this in the server configuration:location ~ /(favicon.ico|apple-touch-icon.png)$ { root /var/www/default; }And just place the icons in the above folder.Hope that helps, cheers!
Rails 3 + carrierwave + nginx = permission denied
I've installed carrierwave gem with rmagick.I can get it working fine if load thro WEBrick but getting 500 Internal Server Error when trying to use nginx instead.The nginx error.log says:2011/08/14 10:06:40 [crit] 760#0: *4247 open() "/usr/local/Cellar/nginx/1.0.4/client_body_temp/0000000033" failed (13: Permission den...
This is not related to CarrierWave, Nginx is not being able to write at the folder/usr/local/Cellar/nginx/1.0.4/client_body_temp/with the temporary uploaded file, which means your Nginx process doesn't have rights on it. Make sure the user that's running nginx can read/write files under this specific path, if you have ...
Can Hadoop run on Nginx?
Is that possible to run Hadoop on Nginx? if so, is there any reference?
Nginx is a http server, it has nothing to do with Hadoop.
Why does wiki.js need public URL when installing?
After configuring my database and running my Wiki.js instance using nodejs, I was prompted to "install" Wiki.js onlocalhost:3000. However, there is this input bar asking for the public URLwiki.example.com:I am trying wiki.js out on my own computer, which has nothing to do with public URLs. In the future, I plan to usen...
TL;DR if you're on localhost and testing it doesn't matter what URL you put. Also note that this setting can be easily changed after installation from admin area.I was deploying wiki.js in our company and first I was setting it up on throwaway domain before switching to target domain, and I was confused by this as well...
Nginx: Client request body is buffered to a temporary file
I've deployed a ML Model on AWS. It's an image classifier. When I provide the following images to the ML Model via a form in Flask, it works in certain cases but doesn't work in other cases.The link of the image which work is listed below:https://drive.google.com/file/d/1hbrEa2gNLdqGPJxp5jVxWcXl1wunp5Mc/view?usp=sharin...
I figured out the answer by following this link:Increasing client_max_body_size in Nginx conf on AWS Elastic BeanstalkThe nginx configuration settings should be performed in a folder named .platform.The folder structure is (.platform/nginx/conf.d/proxy.conf)Inside the proxy.conf mention:client_body_buffer_size 50M;(the...
Deploy both django and react on cloud using nginx
I have a digitalocean server and I have already deployed my Django backend server using gunicorn and nginx.How do I deploy the React app on the same server?
You can build React app and serve its static files with NginxYou can use docker-compose to manage Nginx and Django. What is more, you can build React static files during docker build.Here is my article:Docker-Compose for Django and React with Nginx reverse-proxy and Let's encrypt certificate.Below my Nginx configuratio...
nginx-prometheus-exporter container cannot connect to nginx
I have a docker-compose and both nginx and nginx-prometheus-exporter are containers. I put the relevant parts here:nginx: container_name: nginx image: nginx:1.19.3 restart: always ports: - 80:80 - 443:443 - "127.0.0.1:8080:8080" nginx-exporter: image: nginx/nginx-prometheus-expo...
the problem was the missing-.nginx: container_name: nginx image: nginx:1.19.3 restart: always ports: - 80:80 - 443:443 - "127.0.0.1:8080:8080" nginx-exporter: image: nginx/nginx-prometheus-exporter:0.8.0 command: - -nginx.scrape-uri - http://127.0.0.1:8080/stub_s...
uwsgi: OSError: write error during GET request
Here is the error log that I received when I put my application in the long run.Oct 22 11:41:18 uwsgi[4613]: OSError: write error Oct 22 11:41:48 uwsgi[4613]: Tue Oct 22 11:41:48 2019 - uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 341] during GET /api/events/system-alarms/ Nov 19 19:11:01 uwsgi[3062...
Faced a similar issue before, it happens when the client makes a request and then closes it(either because server took too long to respond or client has been disrupted)but uwsgi is still processing that request.From the Tags I notice that you are using nginx+uwsgi configuration, there are multiple ways to solve this :F...
How to configure nginx.ingress.kubernetes.io/rewrite-target and spec.rules.http.paths.path to satisfy the following URI patterns
How can I configurenginx.ingress.kubernetes.io/rewrite-targetandspec.rules.http.paths.pathto satisfy the following URI patterns?/aa/bb-aa/coolapp /aa/bb-aa/coolapp/ccLegend:a= Any letter between a-z. Lowercase. Exactly 2 letters - no more, no less.b= Any letter between a-z. Lowercase. Exactly 2 letters - no more, no le...
Came up with the following configuration - it is working for all of my test routes / requirements so far.The regex is almost the same as the one posted by @Gilgames.I based mine on the official docs rewrite example:https://kubernetes.github.io/ingress-nginx/examples/rewrite/#rewrite-targetApart from that I took a quick...
Linux - client_body_in_file_only - how to set file permissions for the temp file?
We use the client_body_in_file_only option with nginx, to allow file upload via Ajax. The config looks like this:location ~ ^(\/path1|\path2)$ { limit_except POST { deny all; } client_body_temp_path /path/to/app/tmp; client_body_in_file_only on; client_body_buffer_size 128K; client_max_body_size ...
Looking through thenginxsource, it appears that the only mechanism that would modify the permissions of the temporary file is therequest_body_file_group_accessproperty of the request, which is consulted inngx_http_write_request_body():if (r->request_body_file_group_access) { tf->access = 0660; }But even that limits...
413 Request Entity Too Large uploading files with Django Admin and Nginx Configuration
Whenever I upload a small file, such as an image, the data is saved successfully. However, when I upload an audio file I get this error: 413 Request Entity Too Large. The file sizes are around 8MB. The confusing part is that uploading these files in development process easily but now that the website is live, it doesn'...
By default, nginx is configured to allow a client maximum body size of 1MB. The files you are uploading (~8MB) are larger than 1MB, which is why the 413 (Request Entity Too Large) error is being returned.To fix this issue, simply editnginx.confand add aclient_max_body_sizeconfiguration like so:###################### ...
502 Bad Gateway when installing PHP7.2 on nginx
So i installed LEMP (nginx, mysql, php..) by following the digital ocean guide. But ubuntu 16.04 only comes with php7 by default and i need greater then 7.1 to run Laravel. I am confused on why every time i replace php 7 with php 7.2-fpm from ondrejsudo add-apt-repository ppa:ondrej/phpWhy does the default php-fpm work...
I had same problem, so I changed the nginx config file/etc/nginx/sites-avaiable/your-site.Change:fastcgi_pass unix:/run/php/php7.1-fpm.sock;tofastcgi_pass unix:/run/php/php7.2-fpm.sock;This worked for me.
nginx client authentication with multiple client certificates
I am trying to set up a NGINX to perform client authentication against multiple clients. The problem I have is that those clients will have different certificates, basically different Root CAs:[clientA.crt] ClientA > IntermediateA > RootA [clientB.crt] ClientB > IntermediateB1 > IntermediateB2 > RootBI looked at the NG...
Thehttp://nginx.org/r/ssl_client_certificatedirective is used to specify which certificates you trust for client-based authentication. Note that the whole list is basically sent every time a connection is attempted (usessl_trusted_certificateas per the docs if that's not desired).As per above, note thatssl_verify_dept...
Nginx proxy_pass then try_file
I am setting up a Rails app with nginx in front.What I want is first to check if the URL makes sense for Railsthenserve content of the public folder.I can't achieve this:upstream extranet { server localhost:3000; } server { location / { try_files @extranet $uri; root /var/www/extranet/public; } locati...
try_fileschecks for the presence of a file on the local file system and cannot respond to the response code from a proxy.Presumably, the proxy response with a 404 response if the remote page does not exist, which can be intercepted by anerror_pagestatement.For example:location / { proxy_pass http://extranet; ...
How to delete networkpolicies using kubectl?
I've followed a Kubernetes tutorial similar to:https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/which created some basic networkpolicies as follows:root@server:~# kubectl get netpol -n policy-demo NAME POD-SELECTOR AGE access-nginx run=nginx 49m default-deny 50mI ...
This should work. A similar command works at my end.kubectl -n policy-demo delete networkpolicy access-nginx
Redirect non-www to www with aws elastic beanstalk
I'm using Elastic Beanstalk and I've followed the instructions to deploy my app using the express web server as follow:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.htmlThis setup uses nginx and route 53.Everything works well, but now I'm trying to redirect from non-www/non-https UR...
You can setup a S3 bucket that redirects naked domain to www. It is explained here.http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.htmlYou can redirect http to https by using Cloudfront. You can read more information here.http://docs.aws.amazon.com/AmazonCloudFront/latest/Develo...
Nginx - Exclude specific file or folder from logging to access.log
I'm using an access and error log in Nginx.I have extremely large number of requests for stats which take up too much storage space in access.log and are not required.Is it possible to exclude a specific file or folder from logging to access.log?I would like to exclude all requests to/stats/server { listen 80 defa...
You can do this if you know which location block or server is handling the request for stats. Just add the directiveaccess_log off;to the server or location block in which you want this disabled.--Edit--Add this location to your server block:location /stats/ { try_files $uri $uri/ =404; access_log off; }
Nginx redirect to www domain not working
I have the following nginx configuration.server { listen 80; listen [::]:80; listen 443 ssl; server_name example.com; return 301 https://www.example.com$request_uri; }it redirectshttp://example.comtohttps://www.example.combut does not redirecthttps://example.comtohttps://www.example.com.How can I re...
please separate http and https traffic. your current config is messing up a bit with things. The following code rewrites all request fromhttp://example.comtohttps://example.comusing a permanent redirect:server { listen 80; server_name example.com; return 301 https://$server_name$request_uri; }Second code block...
AppHarbor's Reverse Proxy causing issues with SSL and app.UseOAuthBearerTokens ASP.NET MVC 5
Applications at AppHarbor sit behind an NGINX load balancer. Because of this, all requests that hit the client app will come over HTTP as the SSL will be handled by this front end.ASP.NET MVC's OAuth 2 OAuthAuthorizationServerOptions has options to restrict access to token requests to only use HTTPS. The problem is, un...
You could try and register some middleware that can modify requests based on the headers forwarded by nginx. You probably also want to set the remote IP address to the value of theX-Forwarded-Forheader.Something like this should work (untested):public class AppHarborMiddleware : OwinMiddleware { public AppHarborMid...
How to stop rails nginx-passenger application?
I use thepassengerspawned bynginx. There aremanyother rails applications on the server that uses passenger (each has own virtual host in nginx).I can restart the Rails/Nginx/Passenger application like this:touch tmp/restart.txtHow I can stop it?This doesn't work:touch tmp/stop.txt touch tmp/shutdown.txt
Method 1Remove your app's virtual host entry and restart Nginx. Phusion Passenger will no longer serve it.Method 2In case you want to keep your app's virtual host entry, but not actually run the app.Set the following option and restart Nginx:passenger_min_instances 0;Phusion Passenger will now shut down your app if it ...
Using regex in nginx location block for variables
Using nginx and CodeIgniter, I have a location block in my server config that handles the routing for my project like this:location /beta/ { try_files $uri $uri/ /beta/index.php; }This works fine, but I perform backups on this CodeIgniter project and move them to another folder. The "beta" project gets renamed (wi...
Two possible problems:You don't have any brackets in your regex so it's not going to be a capturing group. And you missed out the ~* command to tell Nginx to do a regex match.location ~* ^/backups/(\w+)$ { try_files $uri $uri/ /backups/$1/index.php; }The last parameter in a try_files is magic. It doesn't actually t...
How to get the real IP of a client in a pyramid server behind a nginx proxy
I have a Pyramid application which usesrequest.environ['REMOTE_ADDR']in some places.The application is served by Python Paste on port 6543 and a nginx server listening on port 80 is forwarding requests to the Paste server.The nginx configuration is inspired by the Pyramid cookbook:server { listen 80; ## listen f...
If you use thepaste.deploy.config.PrefixMiddlewarein your WSGI pipeline viause = egg:PasteDeploy#prefix, it will automatically translateX-Forwarded-ForintoREMOTE_ADDR. It is also great for other properties of your reverse proxy, for example it will translateX-Forwarded-Protointowsgi.url_schemeto ensure that if the user...
Nginx , SImple configuration for serving all the files in a Directory and all the directories within
I am looking for a simple configuration to serve all files and directories inside a particular folder.To be more precise I am trying to serve everything inside the pinax/static_media/folder and/media/folder as it is with the same url, and preferably auto index everything .by the way I have runpython manage.py build_med...
I found the answer , It was Quite simple as i guessed . One has to set the root directory once and use the sub-directories as the locationserver { listen 80; server_name QuadraPaper; access_log /home/gdev/Projects/QuardaPaper/access_log.log; root /home/gdev/Projects/QuardaPaper; location /site...
Should I go with Varnish instead of nginx?
I really like nginx.But recently I've found that varnish gives you an opportunity to implement smart caching revers proxy layer(with URL purging). I have a cluster of mongrels which are pretty resource-intensive so if this caching layer can remove some load from mongrels this can be a great thing.I didn't find a way to...
I do not know what you mean under "smart", but anyway Nginx has caching starting from 0.7 branch. There are many parameters to tune, e.g.you can have various TTLs for different return codes,ability to return stale content when application does not respondpossible to limit the total size of the cache on diskyou can defi...
Django doesn't serve static files with NGINX + GUNICORN
Everything worked very well before gunicorn and nginx, static files were served to the website. But now, it doesn't work anymore.Settings.pySTATICFILES_DIRS = [ '/root/vcrm/vcrm1/static/' ] STATIC_ROOT = os.path.join(BASE_DIR, 'vcrm/static') STATIC_URL = '/static/' MEDIA_ROOT = '/root/vcrm/vcrm1/vcrm/media/' MEDIA_UR...
NGINX + Gunicorn + DjangoDjango project:djangoapp - ... - database - djangoapp - settings.py - urls.py - ... - media - static - manage.py - requirements.txtServer: install venv, requirements.txt:sudo apt-get update sudo apt-get install -y git python3-dev python3-venv python3-pip supervisor nginx vim lib...
Certbot, specify redirection without answering question
So I'm trying to automate certbot a bit in a script. When I run thissudo certbot --nginx -d your_domain -d www.your_domainI get the following:Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. ------------------------------------------------------------------------------- 1: No redire...
Use--redirectsudo certbot --nginx --redirect -d your_domain -d www.your_domainSecuritysection of thedocumentation
How can I make nginx handle fastcgi requests concurrently?
Using a minimal fastcgi/nginx configuration on ubuntu 18.04, it looks like nginx only handles one fastcgi request at a time.# nginx configuration location ~ ^\.cgi$ { # Fastcgi socket fastcgi_pass unix:/var/run/fcgiwrap.socket; # Fastcgi parameters, include the standard ones include /etc/nginx/fastcg...
In order to have Nginx handles fastcgi requests in parallel you'll need several things:Nginx >= 1.7.1 for threadpools, and this configuration:worker_processes N; // N as integer or autowhereNis the number of processes,autonumber of processes will equate the number of cores; if you have many IO, you might want to go bey...
Airflow + Nginx set up gives Airflow 404 = lots of circles
I'm trying to set up Airflow behind nginx, using the instructions given here.airflow.cfg filebase_url = https://myorg.com/airflow web_server_port = 8081 . . . enable_proxy_fix = Truenginx configurationserver { listen 443 ssl http2 default_server; server_name myorg.com; . . . location /airflow { ...
I just had the same problem and fixed it by adding a tailing/to the location:location /airflow/ {instead oflocation /airflow {. The tailing backslash tells nginx to remove the preceeding /airflow in uri paths to the corresponding python app.My overall config looks as follows:server_name my_server.my_org.net; locati...
Server static files from FTP server using NGINX
I have a local network, on which there are some old insecure services. I use nginx reverse proxy with client certificates authentication as safe entrypoint to this local network from the Internet. Till now I used it only to proxy HTTP servers usinglocation / { proxy_pass http://192.168.123.45:80/; }and ever...
Nginx doesn't support proxying to FTP servers. At best, you can proxy the socket... and this is a real hassle with regular old FTP due to it opening new connections on random ports every time a file is requested.What you can probably do instead is create a FUSE mount to that FTP server on some local path, and serve th...
nginx - Passing request header variables to upstream URL as query parameter
I have an application running on localhost listening on port 8080nginx is running as reverse proxy, listening on port 80So, a request coming to nginx on port 80 is sent to this application listening on localhost:8080 and response from this application sent back to the userNow this application is incapable of reading th...
So there is no need to do rewrite or anything else. Simply pass the header parameters that you want to pass as query parameter to the localhost application like below by appending to the arguments.If you have custom header parameter like userid, then it would be $http_useridserver { location /test { set...
NGINX Logs have no jsonPayload field in Stackdriver
I have a basic nginx deployment serving static content running on a GKE cluster. I have configured Stackdriver Logging for the cluster as per instructionshere(I enabled logging for an existing cluster), and I also enabled the Stackdriver Kubernetes Monitoring feature explainedhere. The logging itself seems to be workin...
After being in contact with Google Cloud Support, we were able to devise a workaround for this issue, although the root cause still remains unknown.The workaround is to define the NGINX log format itself as a JSON string. This will allow the Google-Fluentd parser to correctly parse the payload as a JSON object. This is...
What's the difference between starting nginx with command "nginx", "service start nginx" and "systemctl nginx start"?
I have noticed that when ever I start nginx with ubuntu command "nginx" and I do systemctl status nginx. It shows that systemctl is disabled. More over if I first start nginx with command systemctl start nginx and i try to start nginx with command nginx, it check the availbility of the ports and then says nginx: [emerg...
The difference between the examples you have provied is how the processes are being started.Running the commandnginxwill start the application and wait for your user action to stop it.Thesystemctlorservicecommands are nearly the same thing and runningservice nginx startorsystemctl start nginxwill start a service in the...
build with volumes in the docker-compose.yml
I want to run multiple web application images with NGINX.So I wrotedocker-compose.ymlwhich build nginx image and run nodejs containers.I have SSL Certificate issued by letsencrypt.The certificate files is located in/etc/letsencrypt/live/mydomain.com/I want NGINX container to read the files.So, I appendedvolumes: - /etc...
The problem is that the volume would be mounted after the build operations is completed. That is why this approach won't work for you.What you will need to do is copy those resources inside container in adockerfile.Assuming you don't have a dockerfile defined. You can create your on makingnginxyour base image.Which wou...
504 gateway timeout while runnning the Load Test jmeter
I have been working on performing the load test on jmeter for 500 users per second. I am using JMeter for the same. While running the load test I am continuously getting the error on login API. Below is the request and response which I am sending and receiving timeout.Sample RequestPOST https://example.com//9000/v1/api...
Most likely your Nginx server is overloaded therefore request cannot be processed in the timely fashion causing the error.It might be caused by several issues:Nginx server simply lacks hardware resources (CPU, RAM, Network or Disk). Make sure it has enough headroom to operate by monitoring the aforementioned resources ...
codeception in docker-compose - can't connect to Webdriver
I have somewhere an error in setting the Webdriver for my codeception and just can't figure it out.when starting withdocker-compose run --rm codeception runit finds the acceptance tests, and even reads the$I->wantTobut then throws an error:[ConnectionException] Can't connect to Webdriver at http://127.0.0.1:4444/wd/hub...
I finally found it. Given the various descriptions on the net using just url, I thought that I am setting the host also with the url. But you actually need to set the host and the url independently. So the solution is to add the service name of the selenium browser together with host.- WebDriver: url: http:...
Can I add permissions to media django media files?
I want to build an app and let user to see some videos just if they have permissions or they paid for that video. I am using Django and I want to add ngnix and gunicorn to serve media files. I am not sure if once the user has the url of the video, how can I block him to not see the video if his payment expired or he do...
You need to implement the so-called 'X-Sendfile feature'. Let's say your paid-for files will be served from location/protected/- you need to add to nginx's config:location /protected/ { internal; root /some/path; }then when you want to serve your user a file namedmycoolflix.mp4your app needs to add headerX-Ac...
NGINX rewrite requests to file outside root
Currently I'm running webprojects with the following directory structure (simplified):project_folder/public/root/index.phpWhat I want to do is set the root in the server block to:root /project_folder/root/;But when a request location does not exists I want it to forward the request to project_folder/index.php. I tried ...
Usually PHP files are processed by alocation ~ \.php$block (or similar). I assume thatindex.phpis not the only PHP file in your application, and to process PHP files within the/root/directory structure, that location will need to useroot /project_folder/root.You can specify a differentrootfor URIs which begin/publicand...
Module socket not found lua
I am trying to use lua to access redis values from nginx. When i execute lua files on command line there everything is ok i am able to read and write values to redis. But i when try to execute the same files from nginx by accessing a location in which access_by_lua directive is written the following error logged in err...
You get this error because your code executes the commandrequire("socket")This command will search for a file with that name in several directories. If successful the content will be executed as Lua code. If it is not successful you'll end up with your error message.In order to fix this you have to add the path contain...
Nginx drop when server_name does not match
I have two vhosts : one ondomain.tldport 80, the other onsub.domain.tldport 443 with SSL on. I added a CNAME entry on my DNS server that redirects mysubsubdomain todomain.tld.. Everything works as expected, but going tohttp://sub.domain.tlddoes the same as going tohttp://domain.tld, andhttps://domain.tldthe same ashtt...
If these are your onlyserverblocks, then they are also your defactodefault serverblocks for port 443 and port 80 respectively. See [this document][http://nginx.org/en/docs/http/server_names.html] for details.If you do not want this, you need to declare a default server block. A minimalist definition might be:server { ...
nginx doesn't follow symlinks with www-data user
I have created a folder to the default server at/var/www/defaultand everything works as expected. Inside that folder I made a symlink to~/WebstormProjects/my-project, using the commonln -s. It worked for a while, and the last time I updated usingapt-get, nginx doesn't follow anymore the symbolic link, which gives me a ...
It was just a problem with permissions:chmod 755 /home chmod 755 /home/userGot previous commands fromthis answer.
Dokku domains:add <app> <domain> returns unsupported vhost config found. disabling vhost support
This is my first site I've were I've tried to use Dokku to deploy a rails app on Digital Ocean.This is a defaultDokku installon a basic Ubuntu VM hosted on Digital OceanWhen I try to run:dokku domains:add myapp mydomain.comI get the following error=====> unsupported vhost config found. disabling vhost support =====> co...
If you didn't fill in the HOSTNAME option on initialsetup of dokkuyou'll run into your current problem. The VHOST file has yet to be created causing the current error.To remedy this we have to create the missing VHOST file and populate with your domain name. First SSH into your droplet and run the following (Depending ...
Nginx SSL Certificate failed SSL: error:0B080074:x509 (Google Cloud)
My server was hosted in Bluehost (Apache), the certificate was working fine. Now, I'm using Google Cloud for multiple pages in NodeJS on different port usingproxy_pass. I am trying to configure the SSL but I have problems. I was looking for similar questions, but it still shows the same error. I created the key file fo...
The problem may occur in case of wrong concatenation order. You tried:cat www_example_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crtWhich looks correct, but concatenation usually require to eliminate extra download from root CA, therefore Nginx c...
Phusion Passenger 4 & nginx cannot see environment variables in Ubuntu Linux
According to the documentation athttps://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#env_vars_passenger_apps15.3.5 Phusion Passenger should be reading environmental variables from .bashrc. I am trying to run a rails 4.2 application from a user account named rails using nginx and Phusion passenger ...
I have found the answer to this horrible question. The answer is athttps://github.com/phusion/passenger/wiki/Debugging-application-startup-problemsunder the heading "Early Termination in Bash". It turns out that the Ubuntu .bashrc does not run if the shell is not interactive. Phusion Passenger does not run in an intera...
Creating a symlink for Ruby while using RVM
I am following thishttps://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-nginx-on-ubuntu-14-04But i have installed Ruby using RVM as its easy to maintain ruby.I am at the step to create a symlink for ruby which under this guide it sayssudo rm /usr/bin/ruby sudo ln -s /usr/local/b...
Use this:sudo ln -sfn $(which ruby) /usr/bin/rubyThat is essentially the same for you as doing this:sudo ln -s /usr/local/rvm/rubies/ruby-2.2.0/bin/ruby /usr/bin/ruby
How to set date format for nginx $date_local
According tothe docsyou can set the date format in nginx with the commandconfig timefmtbut I can't find any documentation/example on where or how to set that.The default shows a string like "Sunday, 26-Oct-2014 21:05:24 Pacific Daylight Time" and I want to change it toyyyyMMddI'm running nginx on Windows if that makes ...
You must not have read thengx_http_ssi_module documentationproperly (especially its'SSI Commands' section): it explains the commands format.You need to set thessidirective toonin the context you wish SSI commands to be parsed, then you need to serve files there which contains those commands.For example:server { lis...
Chef template - Conditionally inserting a block of text
With Chef, is there a way to insert a block of text from a template only if a condition is met?Let's say we have an attribute:node["webapp"]["run"] = "true"And we only want an entry in the nginx .conf in sites-enabled/app.conf if the webapp is true, like this:#The nginx-webapp.conf.erb template file SOME WORKING NGINX...
assuming you have an attributenode[:test][:bool] = truein the template would have to do<% if node[:apache][:bool] -%> ServerAlias ​​<% = node[:apache][:aliasl]%> <% end -%>another option is to check if the attribute is null<% unless node [:icinga][:core][:server_alias].nil? %> ServerAlias ​​<% = node[:icinga][:core...
Multiple 404 error pages in nginx
I am running nginx server. I want to serve a custom error page for a particular request only. For-example for requesthttp://localhost/abc1 & http://localhost/abc2if these pages are not there I want to serve a custom error page. This custom error page should appear only for above two mentioned links, rest of the page er...
Ok, I found the answer. The trick is you have to define error_page explicitly for all those special locations. Here is the configuration which worked for me.location / { root /var/www/nginx-default; index index.html index.htm; error_page 404 /404.html; } location /abc1.html { root /var/www/nginx-d...
Configure nginx to not log ELB secondary healthcheck
Amazon Elastic Load Balancer (ELB) performs periodic health checks:In addition to the health check you configure for your load balancer, a second health check is performed by the service to protect against potential side-effects caused by instances being terminated without being deregistered. To perform this chec...
The solution is to not use legacy unsupported versions of nginx. Starting from version 1.3.15 (pretty old one), nginx does not log the 400 errors in such cases.See changelog for information:http://nginx.org/en/CHANGES*) Change: opening and closing a connection without sending any data in it is no longer logged to ac...
What are the appropriate NGINX configs if you are only sending JSON objects?
I'm an iOS developer and my back end is all written in Django. I use gunicorn as my HTTP server. I have three workers running on a small EC2 instance.My iOS app does not require any images or static content. At most, I am sending 1-20 JSON objects at a time per request. Each JSON object has at most about 5-10 fields.I'...
proxy_buffersThenumberdefines how many buffers nginx will create and thesizehow big each buffer will be. When nginx starts receiving data from the upstream it starts filling up those buffers, either until the buffers are full or the upstream sendsEOForEOT. If any of those two conditions is met, nginx will send the cont...
Restarting nginx: nginxnginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
When I try to restart nginx with sudo /etc/init.d/nginx restart I get the message from the subject.I discovered that the reason is most likely that the script doesn't know how to stop the deamon because the pid file (/var/run/nginx.pid) is not created on start.I have two installations on two different servers... one wa...
The solution is to uncomment this line in nginx.conf:pid /var/run/nginx.pid;It looks like different installations do it differently but the right thing is to uncomment it.
nginx php file rewrite url
so with apache i have a folder:www.domain.com/folder/folder1/index.php?word=blahblahand i want users who access www.domain.com/folder/folder1/blahblah to be redirected to the above URL without the url changing.Thus i have the following .htaccess in the folder/folder1/ which works perfectly:RewriteEngine on RewriteCond...
First, don't useif. If is evil ->http://wiki.nginx.org/IfIsEvilYou can accomplish this by using the following rewrite rule.rewrite ^/folder/folder1/(.*)$ /folder/folder1/index.php?word=$1 last;Place this rewrite rule just above youlocation / {}block
Pass parameters to Python Flask via UWSGI / NGINX
I am trying to use the GeoIP module with my Nginx and Uwsgi stack. All the tutorials relate to using it with fastcgi, but since I dont use fastcgi it doesnt help.I need to get nginx to pass GeoIP data into your CGI app via custom HTTP headers, e.g.:proxy_set_header X-GeoIP-Country $geoip_country_name; proxy_set_header ...
uwsgi_param key value;Ex.uwsgi_param GEOIP_COUNTRY $geoip_country_name;
Django Performance / Memory usage [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 am running an alpha version of my app on a EC2 Small instance (1.7 GB RAM) with postgres and apache (wsgi-mod not as daemon...
We are using nginx together with our Django app in agunicornserver. The performance is quite good so far, but I have not done any direct comparisons with an Apache setup. Memory usage is quite small, nginx takes about 10MB memory and gunicorn about 150MB (but it also servers more than one app). Of course this may vary ...
How can I correct the Meteor base-url in a NginX reverse-proxy configuration?
I have installed both Apache and Meteor behind NginX through reverse-proxy (on an Ubuntu server). Apache is mapped directly as baseURL (www.mydomain.com/) and Meteor is mapped as a subfolder (www.mydomain.com/live/).The problem I encounter is that my Meteor test (which works as expected at port 3000) stops working behi...
The new "absolute-url" package in Meteor 0.4.0 fixed the problem.http://docs.meteor.com/#absoluteurl
Why is my Nginx reverse-proxy node.js+express server redirecting to 0.0.0.0?
I have a server configured to host multiple node.js+express apps on multiple domains through an Ngnix frontend. Everything works great, except for when calls to redirect are made from an express route:res.redirect('/admin');Then the client browser is redirected tohttp://0.0.0.0:8090It seems like it must be an issue wi...
Solved. I had a problem in my nginx conf file that was causing node/express to receive the wrong request-header. When a relative path is passed intores.redirect, it pulls the Host from the incomingreqobject and sets it in the response-header.proxy_set_header Host $proxy_host;should have beenproxy_set_he...
AWS Elasticbeanstalk overriding Nginx config using .platform is not working
I am deploying my Laravel application to AWS ElasticBeanstalk. I have deployed it. Now, I am trying to override "/etc/nginx/conf.d/elasticbeanstalk/php.conf" file using .platform folder.I created .platform/etc/nginx/conf.d/elasticbeanstalk/php.conf file right inside the project's root folder. Then I put in the configur...
Thenginxconfig file you are trying to set is used inAmazon Linux 1(AL1).For AL2, thenginxconfig files should be provided (aws docs) using:.platform/nginx/conf.d/or if you want to overwrite mainnginxconfig file, use.platform/nginx/nginx.confThus, you can try the following file.platform/nginx/conf.d/laravel.confwith cont...
Nginx accept trailing slash or no trailing slash in proxy_pass
I'm running into the following issue where I would like to be able to access a proxy passed location (React/NextJs webApp in a hosted docker container) from a home website with a trailing slashandwithout a trailing slash.Currently, when I hit:http://my-website.com/test# this worksBut when I hit:http://my-website.com/te...
After long experiments we came to this solution:location ~ ^/test(?:/(.*))?$ { # some directives here proxy_pass http://nginx_docker_container_url/$1; # some directives here }needed to pass everything after/testto app, with or without trailing slash it should be handled correctly
Add Java to an NGINX Docker or add NGINX to a Java Docker on Alpine?
I need to build a Docker container (feeling as a N00b about it) that runs a Java application fronted by an nginx Web server. For reasons not subject to discussion I need to put them into one container.I'd like to use Alpine for that. I found both images that contain Alpine with an installed nginx and Alpine with an ins...
For creating a combined image, you could follow either of the suggested paths:Creating a mergedDockerfilewith the setup steps for both images, and building your own custom image.Creating aDockerfilepulling from image 1 (the more "complex" one), and adding the commands needed for image 2.The second approach is preferred...
How to properly log the "Path" in K8S ingress-nginx metrics
I'm usingingress-nginxas an Ingress controller for one of my services running over K8S (I'm using the nginx-0.20.0 release image with no specific metrics configurations in the K8S configmap the ingress-controller is using).The nginx-ingress-controller pods are successfully scraped into my Prometheus server but all ingr...
ThePathattribute in the NGINX metrics collected by prometheus derives from the Ingress definition yaml.For example, if your ingress is:apiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: kubernetes.io/ingress.class: nginx name: namespace: spec: rules: - host: http: paths: ...
How to rewrite an Nginx GET request into POST?
My use case is that I have an email containing a "verify your email address" link. When the user clicks this link, the user agent performs a GET request like:GET http://widgetwerkz.example.com/confirm_email?challenge=LSXGMRUQMEBOThe server will perform this operation as a POST (because it is a side-effecting operation)...
You need something like this:location /confirm_email { proxy_method POST; proxy_set_body '{ "challenge": "$arg_challenge" }'; # your proxy_set_headers and other parameters here proxy_pass /rpc/verify?; }
Nginx ingress resource - Redirect from to www (SSL doesn't work)
Use caseI deployed the nginx ingress controller in my Kubernetes cluster using this helm chart:https://github.com/helm/charts/tree/master/stable/nginx-ingressI created an ingress resource for my frontend serving webserver and it is supposed to redirect from non-www to the www version. I am using SSL as well.The problem...
Looks like you fixed the issue for receiving an invalid certificate by adding an additional rule.The issue with the redirect looks like it's related tothisand it's not fixed as of this writing. However, there is a workaround as described on the same link:nginx.ingress.kubernetes.io/configuration-snippet: | if ($host ...
configure nginx to make a background request
I am building an application where I need to do some analytics on the api-data combination usage. Below is my nginx configuration -location /r/ { rewrite /r/(.*)$ http://localhost:3000/sample/route1/$1 redirect; post_action /aftersampleroute1/$1; } location /aftersampleroute1/ { rewrite /aftersampleroute1/(...
As you correctly mentioned,post_actionis not documented and has always been considered an unofficial directive.Nginx provides a new "mirror" module since version 1.13.4, describedherein the documentation. So I advise you to give it a try. In your case, it would look like this –location /r/ { rewrite /r/(.*)$ http:/...
POST response caching does not work in nginx
My task is to implement microcaching strategy using nginx, that is, cache responses of some POST endpoints for a few seconds.Inhttpsection of thenginx.confI have the following:proxy_cache_path /tmp/cache keys_zone=cache:10m levels=1:2 inactive=600s max_size=100m;Then I havelocationinserver:location /my-url/ { roo...
It turned out that the following directive (which was defined globally) prevented caching from working:proxy_buffering off;When I override it underlocationconfig withproxy_buffering on;, caching starts working.So, to make caching work with POST requests, we have to do the following:OutputCache-Control: public, max-age=...
How to expose kubernetes nginx-ingress service on public node IP at port 80 / 443?
I installedingress-nginxin a cluster. I tried exposing the service with thekind: nodePortoption, but this only allows for a port range between30000-32767(AFAIK)... I need to expose the service at port80for http and443for tls, so that I can linkA Recordsfor the domains directly to the service. Does anyone know how this ...
If you want on IP for 80 port from a service you could use the externalIP field in service config yaml. You could find how to write the yaml hereKubernetes External IPBut if your usecase is really like getting the ingress controller up and running it does not need the service to be exposed externally.
How to listen 443 port in jwilder/nginx-proxy
I am using thehttps://github.com/jwilder/nginx-proxyfor nginx-proxy settingThe port 80 redirect is working. That means i can get to my site via non SSL using test.example.com but with HTTPS i get a chrome error of "This webpage is not available ERR_CONNECTION_CLOSED"Then I found that default.conf from nginx-proxy seems...
Finally solved by adding CERT_NAME under nginx server environment:nginx: image: nginx:alpine restart: always environment: - VIRTUAL_HOST=docker-reverse-proxy.com - VIRTUAL_PROTO=https - VIRTUAL_PORT=443 - CERT_NAME=YOUR_CERT_NAME ## Add this
Nginx serving Django in subdirectory - admin login is redirecting
I have to serve a Django app from a subdirectory (hostname/service/). So far I'm able to get to the Admin Login prompt (hostname/service/admin/login/?next=/admin/), but after successfully logging in I'm redirected to (hostname/admin/login/) and get a 404.How can I keep the correct subdirectory and get inside the Admin ...
You need to add theFORCE_SCRIPT_NAMEsetting to yoursettings.pyas such:FORCE_SCRIPT_NAME = '/service'mind that there's no trailing slash at the end.
How to force Nginx to verify upstream certificates against the hostnames present in upstream server block?
I am trying to implement HTTPS protocol communication at every layer of a proxying path. My proxying path is from client to load balancer (nginx) and then from nginx to the upstream server.I am facing a problem when the request is proxied from nginx to the upstream server.I am getting the following error in the nginx l...
We can make use of the "proxy_ssl_name" directive in nginx. It allows overriding the hostname against which nginx should verify the certificate of the backend server.proxy_ssl_name mybackend-server.hostname.com;
Regex to find files matching file extension except if filename contains string
I have caching enabled for specific files in nginx, like this:location ~* \.(?:css|js)$ { access_log off; add_header Cache-Control "no-transform,public,max-age=31536000,s-max-age=31536000"; expires 1y; }What I'd like to do here is to exclude all files matching the pattern i18n-*.js, and as a result, cache all .js files...
Official documentationdescribeshow location tree is traversed:Rregular expressions are checked, in the order of their appearance in the configuration file. The search of regular expressions terminates on the first match, and the corresponding configuration is used. If no match with a regular expression is found t...
What are the correct permissions for my site that is now served by NginX?
I am running a local testing server on my laptop running Ubuntu 16.10. I was running Apache2, but I've decided to switch over to NginX. Following guides likethis one, I think I've got NginX up and running, along with PHP 7.0 fpm.However, when I load one of my sites, I get a403 Forbidden error. The NginX error log says ...
You have wrong permission for subdir1, fix it:chmod 755 /home/user/Dropbox/subdir1or even better (recursive):find /var/www/example.com -type d -print0 | xargs -0 chmod 755As for nginx user, you can set it withuserconfiguration directive:user www-data;You can use any user with NGINX server, you just need correct permiss...
Github authentication failed with user www-data
I'm setting up a hook between Github and my server, which can auto pull new commits when the script triggered by Github requests.It's all setting finished, like ssh-keys, git origin. I can pull a new commit from my private repo hosted on Github by runninggit pull origin master. It's works fine with the shell.But when I...
This problem solved with adding GitHub to known hosts according to Benyi's comment.ssh-keyscan -t rsa github.com >> /var/www/.ssh/known_hostsYou should specify ssh key firstly. After that, you should do git tasks what you want.1-) Ssh keys are not user specific. So you can create rsa key pair everywhere. Public key sho...
How to specify a directory in nginx.conf to serve index.html from
I am trying to rewrite a very simple nginx.conf file. The only purpose of this project is to have nginx serve a static index.html on localhost.Since all of the documentation and tutorials online have minimum 50 line configurations. I'm wondering if my 7 line configuration will work and accomplish what I need.} ...
You'll do best to include the server_name as well, and to end your statements with semicolons:server { server_name some.server.name; listen 8888; # or just _ (underscore) to listen to any name root /test/index; index index.html; }
Nginx - another root for a specific location
I have some static html files under:/var/www/project1Nginx config for this project is:server_name www.project1.com project1.com; root /var/www/project1; location / { index index.html; }My goal is to use nginx so that when a user enters this url:www.project1.com/project2Ngin...
According to your config of project2location /project2 { root /var/www/project2; index index.html; }Nginx will be looking for files under the path/var/www/project2/project2/for your requests to project2. So if your project2 is under/var/www/project2, The correct config should belocation /project2 { root /va...
CSRF django nginx with ssl from cloudflare
BackgroundI'm trying to configure my Django app to work with ssl provided by cloudflare. I have about the same setup asthis answerand have followed the same solution.Issue:This has been killing me for weeks (please help!) as I amnota networking/security guy and just need a solution that will avoid me gouging my eyes ou...
You need to setup the domain which is sending the CSRF cookie. Try settingCSRF_COOKIE_DOMAINto".domain.co.uk"andCSRF_COOKIE_SECUREtoTruein your settings.Relevant documentationhttps://docs.djangoproject.com/en/4.1/ref/csrf/#how-it-works
How to Override Content-Security-Policy of Site A while using nginx proxy_pass on Site B for serving content?
Is there a way to override Content-Security-Policy set by the domain/site A while i am using nginx proxy_pass on Site B.Site A defined Content-Security-Policy on their domain. Site B acts as a reverse proxy for site A.How can i override Content-Security-Policy while serve content from site B ?how can i achieve this in ...
This problem seems similar to theNginx as reverse Proxy, remove X-Frame-Options headerthread on the Nginx mailing list. That solution wasproxy_hide_headerBy default, nginx does not pass the header fields “Date”, “Server”, “X-Pad”, and “X-Accel-...” from the response of a proxied server to a client. The proxy_hide_...
Nginx location regex not matching
Been trying this for several hours now but i am having a hard time figuring it out.location ~* ^\/sys\/assets\/(.*).css$ { try_files $uri $uri/ /sys/assets/stylesheets/$1; }I am basically trying to make css files called from /sys/assets/file.css to fallback to /sys/assets/stylesheets/file.css
Your first match group is file name without extension, while you're passing it to the last fallback URL where extension is expected.Also there's no point of escaping forward slashes. They have no special meaning here.server { listen 80; server_name localhost; root /var/www/localhost/www; location ~*...
unable to proxy from nginx to kibana
I am trying to proxy requests from nginx to kibana (logstash). I can access the kibana dashboard on port 9292 - I can confirm that a service is listening on port 9292. I can successfully proxy from nginx to other services but the proxy directive for kibana (port 9292) does not work - I can proxy to 9200 for elasticse...
The problem seems to beproxy_pass http://your-logstash-host;If you look at the logs in your LogStash Web, you'll see "WARN -- : attack prevented by Rack::Protection::JsonCsrf"There's some built-in security, which I'm not familiar with, provided by rack-protection to prevent Cross-origin resource sharing attacks. The pr...
What are PHP-FPM pools and what is pm.max_children?
I have a Drupal site with NGINX and PHP-FPM with 3 pools.What I want to know is what are FPM pools or just give me links to good documentation, i've searched about this topic but all I found is how to configure "X" to obtain a better performance.Also, what is pm.max_children? I recently notice in the log that when pool...
Well you can simply say that each pool is like a separate php, like for me i use pools to run each by a different user, give each the appropriate limits in terms of resources and such for separate websites running on the same server.I don't understand though why 3 pools for same site, do you use anupstreamin nginx?As f...
How to simulate a huge amount of simultaneous requests to a web-server?
I want to see how far my nginx + node.js setup can go and what changes I can make to squeeze out extra performance I've stumbled ona great articledetailing some tuning that can be done to the OS to withstand more requests (which I'm not sure I completely understand)Say I want to see how it handles 60,000 requests per s...
You could givesiegea try as well.The article you've linked looks good to me.Generating 60,000 rq/s and answering them at the same time will be a problem because you most definitely run out of resources. It would be best to have some other computers (maybe on the same network) to generate the requests and let your serve...
Curl PUT request with file upload to PHP
I'm trying to upload a file using HTTP PUT.After reading a bit it seems the$_FILESarray is only with POST andmultipart/form-data. While with PUT, I'd need to manually readphp://inputto get the data. Both methods don't work.I tried the following options and would appreciate any tips you might have:curl --upload avatar.j...
I have some ideas for debugging.Do avar_dump(file_get_contents('php://input'));instead of an echo. According to thereference:This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testin...
How to create a cookie with FastCGI (nginx) in C++
I'm creating a website in C++ using FastCGI on nginx. My problem is now to track a user (aka session). I can read the HTTP_COOKIE out, but I have no clue how I can create a new cookie with a name and a value and send this to the client.Looking up in Google I only found relevant stuff for PHP, Python and other scriptlan...
you can use setcookie syntax.#include #include int main(int argc, char** argv) { int count = 0; printf("Content-type: text/html\r\n" "Set-Cookie: name=value\r\n" "\r\n" "CGI Hello!" "CGI Hello!" "Request number %d run...
Replace underscores in unknown subdomains with dashes in an nginx redirect
I've got URLs coming in that look like this:https://some_sub_domain.whatever.comThat need to be redirected to:https://some-sub-domain.whatever.comI don't know what the subdomains will be (they're usernames).While I need to replace underscores for the subdomain, I need to leave other underscores in-tact:https://some_sub...
Here's a way to rewrite via lua:location / { rewrite_by_lua ' if string.find(ngx.var.host, "_") then local newHost, n = ngx.re.gsub(ngx.var.host, "_", "-") ngx.redirect(ngx.var.scheme .. "://" .. newHost .. ngx.var.uri) end '; proxy_pass http://my_backend; proxy_set_header Host $host; }
Nginx 504 gateway timeout after 60 seconds [duplicate]
This question already has answers here:Closed11 years ago.Possible Duplicate:How do I prevent a Gateway Timeout with NginxI'm using an existing SOAP API for importing data via XML. Sometimes while the XML is too large I get a 504 gateway timeout after 60 seconds.I've tried to set fastcgi_read_timeout to 300 in the ngin...
You need to setup send_timeout because this specifies the response timeout to the client.send_timeout 300I think this is the case because send_timeout applies to client-read operations which is exactly what you are trying to do.
How to generate CSR for SSL that works with Nginx & Apache?
I want to generate the CSR file for requesting SSL (wildcard) certificate. This certificate and private key will be used on multiple machines with both Apache and Nginx.RapitSSL states the following commands for the different setups:Nginx$ openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csrApach...
Apache Mod SSL$ openssl genrsa -des3 -out < private key file name>.key 2048Apache-SSL$ openssl genrsa -des3 -out www.yourdomain-example.com.key 2048These two are obviously the exact same command, with a different way of writing the example name. They just generate the key pair, you'd need an additionalreqcommand to gen...
How to set nginx cache headers to never expire?
Right now I'm using this:location ~* \.(js|css)$ { # |png|jpg|jpeg|gif|ico expires max; #log_not_found off; # what's this for? }And this is what I see in firebug:Did it work? If I didn't get it wrong, my browser is asking for the file again, and nginx is answering 'not modified', so my browser uses the cache. But I...
Do not use F5 to reload the page. Use click on the url + enter, or click in a link. That's how I got only 1 request.
Keepalived upstream connection to Unicorn via socket
Nginx 1.1.4+ can serve upstream connection with HTTP1.1keepalivedirective, see theofficial documentation(it's not the same as keepalived clients' connections). So the Unicorn configuration can look like as below:upstream unicorn { server unix:/tmp/unicorn.todo.sock fail_timeout=0; keepalive 4; ...
Yes, it's valid. There's no difference between UNIX-socket and TCP/IP-socket in terms of HTTP Keepalive.
Need help converting Apache2 Rewrite rules to nginx
I've managed to convert most of them, but I'm struggling a bit with these two -RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,QSA,L] RewriteRule !^(media/(.+)|favicon.ico|robots.txt|sitemap.xml|sitemap-main.xml)$ index.phpWould appreciate a hand if anyone is a nginx rewrite ninja :)
This:RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,QSA,L]will be converted to:rewrite ^/(.+)/$ http://$http_host/$1 permanent;and this:RewriteRule !^(media/(.+)|favicon.ico|robots.txt|sitemap.xml|sitemap-main.xml)$ index.phpwill be converted to:rewrite /!^(media/(.+)|favicon.ico|robots.txt|sitemap.xml|sitemap-main....
How to make a chunked request via nginx
It seems that nginx does not support chunked requests well. But I'm trying to get a more definitive (and current) answer. I have a client making a SOAP request to a server from a Java client which sets the headerTransfer-Encoding: chunked. All works well when I connect directly to my application on Tomcat.But when I pu...
I have gathered up answers to all parts of this question.Base nginx does not support chunked requests (as Alexander confirmed!). Nginx can support chunked request by usingNginXHttpCunkinModule(as my question mentions). Better: this module graduated from beta status to production quality more than 18 months ago. Best: I...
Trying to stream using eventsource through nginx/fastcgi
I am trying to set up an event stream using MVC.NET, Nginx and Fastcgi. The streaming works fine for me using xsp4, but I have not been able to get it to work through Nginx and Fastcgi. My goal is to open an EventSource stream and to downstream data to my website.I have tried adding the 'ngx_http_upstream_keepalive' ...
Based on what I have read here:http://wiki.nginx.org/X-accelyou need to turn off X-Accel-Buffering. Here is some example code:public ActionResult Stream(string id) { Response.ContentType = "text/event-stream"; Response.Buffer = false; Response.BufferOutput = false; Response.Headers["X-Accel-Buffering"] ...
Hide Headers in Passenger/Nginx Server
I am trying to hide this headers for the production server but without success :X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7 X-Runtime: 0.021429 Server: nginx/1.0.0 + Phusion Passenger 3.0.7 (mod_rails/mod_rack)Using :- Rails 3.0.9 - Passenger 3.0.7 - Nginx 1.0.0Any ideas ?
To removenginxServer:header you could useserver_tokens offdirective.For other headers try usingHeaders Morenginx module:more_set_headers 'Server: anon'; # replace the default 'nginx + Passenger' more_set_headers 'X-Powered-By'; # clear header entirely