Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
What's the best way to run Wordpress on the same domain as a Rails application?
I've got a standard Rails app with Nginx and Mongrel running athttp://mydomain. I need to run a Wordpress blog athttp://mydomain.com/blog. My preference would be to host the blog in Apache running on either the same server or a separate box but I don't want the user to see a different server in the URL. Is that possi...
I think joelhardi's solution is superior to the following. However, in my own application, I like to keep the blog on a separate VPS than the Rails site (separation of memory issues). To make the user see the same URL, you use the same proxy trick that you normally use for proxying to a mongrel cluster, except you pr...
Serving php files from different locations in nginx
I have my main website and wordpress in different directories on my server on which I use nginx as the web server. The main website is in /home/me/www and Wordpress is in /home/me/wordpress. I need to have them in separate directories this way for a particular reason. How do I specify this in the nginx configuration fi...
Check outthis questionand theNginx Manual.Try changing yourblogline to:location ^~ /blog/ { root /home/me/wordpress; index index.php index.html index.htm; }
In django + nginx + wsgi, what is a "mysite.sock"
I followedthis doc, and almost everything went well untill "mysite.sock" occurred. It occurred like this:server unix:///path/to/your/mysite/mysite.sock; # for a file socket # server 127.0.0.1:8001; # for a web port socket (we'll use this first)This doc did not mention anything about the "mysite.sock" and after one day'...
I am not an expert in this area but I have deployed Django using uWSGI on Nginx with this method. A socket file represents a Unix socket. In this case, uWSGI creates it and it will be through this socket that uWSGI and Nginx will talk to each other.The "Concept" section of the link you provided talks about it:uWSGI is ...
E: Package 'python-certbot-nginx' has no installation candidate
When I try to install Certbot for Nginx and runsudo apt-get install python-certbot-nginxI getE: Package 'python-certbot-nginx' has no installation candidateHow to install Certbot for Nginx?
Since Python2 is no longer supported you just need to ask for Python3.Sosudo apt-get install python3-certbot-nginxshould solve your Problem.
Redirecting to SSL using Nginx
I have http:// and https:// on the same host like the following:server { listen 80; listen 443 ssl; ... ... }What I need to do is redirecting users who access my shop tohttps://. The problem is I have many languages:https://example.com/en/shophttps://example.com/fr/shopetc...I tried this and it di...
In order to use regular expressions for matchinglocations, you need to prefix the expression with either~or~*:if ($server_port = 80) { location ~ (en|fr)/shop { rewrite ^ https://$host$request_uri permanent; } }From thedocumentation:To use regular expressions, you must use a prefix:"~"for case sensitive...
FastCGI application behind NGINX is unable to detect that HTTPS secure connection is used
I'm running FastCGI behind Nginx, and need to detect when the url is accessed via HTTPS. However, my Django web application always reports that the connection is HTTP (request.is_secure() == False). However, SSL is setup correctly, and I've verified my https:// urls are secure with an SSL checker.How can I get Django...
Make sure nginx is sendingfastcgi_param HTTPS onfor connections on 443.
ingress configuration for dashboard
I did nginx ingress controller tutorial fromgithuband exposed kubernetes dashboardkubernetes-dashboard NodePort 10.233.53.77 443:31925/TCP 20dcreated ingressapiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: ingress.kubernetes.io/ssl-passthrough: "true" nginx.org/ssl-backend...
As you pointed out, looks like nginx is proxying your https request toipWhichEndsWith.249:8443, which is an HTTPS endpoint, usinghttpas protocol.You should add the following annotation to your PodSpec:LATESTThis annotation was added to replace the deprecated annotation since 0.18.0#2871Add support for AJP protocolnginx...
Nginx proxy_next_upstream doesn't work
I want nginx to search my local host for the file first and on a 404 error it should search server 1.1.1.1.I am able to fetch the file that is located on local host, but not able to get from server 1.1.1.1.server { listen 80; server_name localhost; access_log /var/log/nginx/access.log main; location ...
Theproxy_next_upstreamdirective is a configuration directive to control re-request from a group ofupstream serversby aproxy_passif request to one of them fails. It doesn't make sense withoutproxy_passand anupstreamblock defined. You may use it if you proxy to multiple upstream servers like this:upstream backends { ...
Set default version of Php in CentOS 7
I have two versions of PHP inopt/remifolderphp56andphp72but when Iphp -von cmd it shows:Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.4.1, Copyright (c) 2002-2016, by ...
I have two versions of PHP in opt/remi folder php56 and php72how to set default version to PHP 7.2SCL are designed for parallel installation so don't alter default version in base systemOnce the collection is enabled, the version will be used$ scl enable php72 bash $ php -v PHP 7.2.8 (cli) (built: Jul 17 2018 05:35:43)...
GitLab 7.2.1 with Apache Server instead of Nginx
I have installed GitLab7.2.1with the .deb package fromGitLab.orgfor Debian 7 on a virtual server where I have root access. On this virtual server I have already installed Apache, version2.2.22and I don't want to use Ngnix for GitLab.Now I have no idea where the public folders of GitLab are or what I have to do or on wh...
With two things in mind:Unicorn is listening on 8080 (you can check this withsudo netstat -pant | grep unicorn)Your document root is/opt/gitlab/embedded/service/gitlab-rails/publicYou can create a new vhost for gitlab in apache with the following configuration: ServerName gitlab.example.com ServerSignature Off P...
Nginx gives a 403 error for CSS/JS files
I have setup nginx 0.7.67 on Ubuntu10.10 along with php-cli . I'm trying to get my front-controller based PHP framework to run, but all pages except index.php give a 403 error.Ex :http://mysite.com/styles/style.css- 403 Forbiddenhttp://mysite.com/scripts/script.css- 403 Forbiddenhttp://mysite.com/index.php- WorksMy/etc...
Had the same problem. Fixed it by simply setting the right permissions on my CSS and JS files and folders. Be careful about setting permissions! But for a file to be readable on the web, it has to be readable by the user running the server process.chmod -R +rx css chmod -R +rx jsGives read and execute permissions. The-...
Nginx enable gzip
I want enable the gzip compression on my nginx server. The nginx.conf file is here:http { # Enable Gzip server { location ~* \.(?:ico|woff|css|js|gif|jpe?g|png)$ { expires 30d; add_header Pragma public; add_header Cache-Control "public"; } location /api { try_files $uri...
You can put the gzip configuration anywhere, but if you want to apply it to all websites / files it is best to put it in the http section - this will then be the default for all server and location blocks. I would also "shorten" / change your config to the following:http { gzip on; gzip_min_length 500; gzip_prox...
Nginx log to stderr
I want to redirect nginx access logs tostdoutto be able to analyze them throughjournalctl(systemd).There is the same question with approved answer.Have nginx access_log and error_log log to STDOUT and STDERR of master processBut it does not work for me. With/dev/stderrI getopen() "/dev/stderr" failed (6: No such device...
According to thenginx documentation, theerror_logdirective supportsstderras its argument. The following configuration should therefore log error messages to stderr:http { error_log stderr; ... }Unfortunately,access_logdoesn't supportstdoutas its argument. However, it should be possible to set it tosyslog(docume...
Modifying a Location header with nginx proxy_pass
I have an nginxproxy_passsetup to pass every request on/apithrough to a backend Tomcat REST service. This service in some cases returns aLocationheader which varies according to the type of request, e.g.,Location: http://foo.bar/baz/api/search/1234567-- thebazpart is due to it being hosted on Tomcat.My current configur...
You may be able to use regexp to modify it but a better way is to use a proxy redirect:proxy_redirect http://foo.bar/baz/ /;http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirectAny Location headers forfoo.bar/baz/will go to/If you just want to redirect/baz/api, that'll work too.If any redirects are al...
Configure Nginx with proxy_pass
I'm trying to configure Nginx to proxy stuff on a subdomain: dev.int.comI want dev.int.com to be proxied to IP:8080, and dev.int.com/stash to be proxied to IP:7990Here's my current config fileserver { listen 80; server_name dev.int.com; access_log off; location / { proxy_pass http://IP:8080; proxy_set_header...
Give this a try...server { listen 80; server_name dev.int.com; access_log off; location / { proxy_pass http://IP:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-for $remote_addr; ...
SQLAlchemy extension isn't registered when running app with Gunicorn
I have an application that works in development, but when I try to run it with Gunicorn it gives an error that the "sqlalchemy extension was not registered". From what I've read it seems that I need to callapp.app_context()somewhere, but I'm not sure where. How do I fix this error?# run in development, works python s...
Only when you start your app withpython sever.pyis theif __name__ == '__main__':block hit, where you're registering your database with your app.You'll need to move that line,db.init_app(app), outside that block.
bcrypt is breaking my meteor application, how do I fix it?
I wasn't sure if this should be a stackoverflow or serverfault question.I installed Meteor's accounts-password module and it worked locally, but broke my app when deployed to the server. Here's the scoop:I'm running the latest Meteor 1.0.5 locally on OSX (OS just fully updated) Building with --architecture os.linux.x8...
The bcrypt module is platform dependant (as fibers), so you need to remove the package after decompressing the bundle in your server:rm -R path/to/bcryptthen install it again:npm install bcrypt
NGinx forward websocket from 80 to websocket port
I am using Nginx as a web host and proxy for a websocket running on the same device listening on port 8888. Trying to find a way to have nginx listen on 80 and forward the websocket requests to the internal port. Without exposing a new port to the outside. Is this even possible?UPDATE:This is my current configuratio...
Yes, it's possible assuming you can distinguish the normal HTTP requests and the socket ones.The simplest solution is to match the socket uri withlocation, for example all the requests to/wswill be redirected tolocalhost:8888, any other url tolocalhost:8889. Here it is an example of configurationserver { server_nam...
Nginx, turn off cache for a specific file
location /static { alias /home/ubuntu/Documents/zibann/momsite/momsite/static; # your Django project's static files - amend as required if ($uri ~* ".*config.js") { expires off; } if ($uri ~* ".*\.(js|css|png|jpg|jpeg|gif|swf|svg)" ) { access_log off; expires 365d; add_heade...
Make a separate location block for config.js above the others.location ~ config\.js { alias xyz; expires off; } location static etc
Nginx redirecting to wrong vhost
I have around 1300vhosts in one nginx conf file. All with the following layout (they are listed after each other in the vhost file).Now my problem is that sometimes my browser redirects site2 to site1. For some reason, while the domain names don't event match.It looks like nginx is always redirecting to the first site ...
Reference (how nginx handles request):http://nginx.org/en/docs/http/request_processing.htmlIn this configuration nginx tests only the request’s header field “Host” to determine which server the request should be routed to. If its value does not match any server name, or the request does not contain this header fi...
Nginx proxy_pass to aws Api Gateway
I want to configure Nginx reverse proxy server which will redirect all of the requests it gets by HTTP to my AWS Api Gateway endpoint which is HTTPS (its a GET method). (If you want to know why, the reason for this is that I have an AWS Lambda function which I want a 3rd party vendor to call via Api Gateway, but he cur...
Your issue was that you were setting the HTTP Host header that will be sent to AWS API Gateway to the wrong value.API Gateway needs the HTTP Host header to be set to its own host, e.g. toSOMETHING.execute-api.REGION.amazonaws.comSo you should have:proxy_set_header Host $proxy_host;instead of:proxy_set_header Host $host...
Does Nginx open source support OpenID and JWT
I have a basic Nginx docker image, acting as a reverse-proxy, that currently uses basic authentication sitting in front of my application server. I'm looking for a way to integrate it with our SSO solution in development that uses JWT, but all of the documentation says it requires Nginx+. So, is it possible to do JWT v...
Sure, there are open source codes, which you can use and customize for your case (example).IMHO there are better implementations, which you can use as an "auth proxy" in front of your application. My favorite iskeycloak-gatekeeper(you can use it with any OpenID IdP, not only with the Keycloak), which can provide authen...
nginx and proxying WebSockets
I'm trying to proxy WebSocket + HTTP traffic with nginx.I have read this:http://nginx.org/en/docs/http/websocket.htmlMy config looks like:http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; map $http_upgrade $connection...
Problem 1:As for the connection dying once a minute, I realized that it's nginx timeout variable. I can either make our app to ping once in a while or increase the timeout. I'm not sure if I should set it as 0, I decided to just ping once a minute and set the timeout to 90 seconds. (keepalive_timeout)Problem 2:Connecti...
returned non-zero exit status -9
I am deploying code on elastic beanstalk and it gives me this error. I was using nginx proxy and elastic load balancer I disabled both and then try to deploy code this give me following error. I am unable to find any solutionnpm WARN deprecated[email protected]: use uuid module instead Not using a reverse proxy R...
A "return code" of -9indicatesthat the process was killed with SIGKILL. If you aren't doing that yourself, theOOM killeris a likely culprit.
Nginx - multiple/nested IF statements
What i want to do:Check if request comes from FacebookCheck if URL is like domain.com/2If above conditions are true - show content from /api/content/item/$1?social=1If above conditions are false - show "normal page"It is a single page app. Before my changes configuration looked like this (and it worked):location / { ...
There is goodarticleabout common pitfalls in nignx wiki.First, I've movedrootdirective to server level. Second,locationis the best way to check urls. So I rethink your requirements asif location consist of digitsand request from facebookwe have to rewrite url, and the result is:root /home/eshlox/projects/XXX/project/pr...
Zend Framework on nginx
The Zend Framework based site I have been working on is now being migrated to its production server. This server turns out to be nginx (surprise!). Naturally the site does not work correctly as it was developed on Apache and relies on an htaccess file.My question is... anyone have any experience with this? Any ideas on...
I know it's a pretty old thread but it might help some people anyway.Basically it redirects any 404 error to index.php, but if the file exists (type file) it will set the right root.I did it from the top of my head. It might not be working right away, and you have to put the right path and fastcgi config. I also put ev...
Nginx connect() failed error
I don't know why I got this error every time I tried to open the page:2013/04/06 17:52:19 [error] 5040#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8080"
I resolved it, it was a configuration file issue, I added:location ~ .php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; }
Nginx on macOS : open files resource limit
I'm having configuration errors and I have researched online but I'm not quite sure what the problem is. I'm wanting to install PHP and Nginx on a os x 10.7.5 operating system. Whenever i try to start or stop the server I get the following errors:tone$ nginx nginx: [warn] 1024 worker_connections exceed open file reso...
Try this in your terminal:ulimit -aAnd the result should be sth similar to this:core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files ...
Force www. and https in nginx.conf (SSL)
After purchasing a SSL certificate I have been trying to force all pages to secured https and to www.https://www.exampl.comis working and secure but only if type it in exactly. www.example.com or example.com are still pointing to http.We use nginx as a proxy and need to input the rewrite there. I have SSH / root access...
The best way to implement WWW and HTTPS redirection is to create a newserversection in Nginx config:server { listen 80; #listen for all the HTTP requests server_name example.com www.example.com; return 301 https://www.example.com$request_uri; }You will also have to performhttps://example...
How to install PHP extensions on nginx?
I recently discovered NginX, and decided to try it out on my server. I have NginX running and able to serve PHP and HTML files. But now I want to try to install drupal. When trying to install it and check the requirements, I am stopped by one requirement.PHP extensions DisabledDrupal requires you to enable the PHP e...
Since you are using Nginx - that must mean you are running PHP with PHP-FPM.After you install stuff you need to:sudo /etc/init.d/php-fpm restartorservice php5-fpm restartin newer ubuntu versionsso that PHP will pickup the new extensions.
docker nginx deployment entrypoint
I have a dockerized nginx that works great if I run a shell, but (naturally enough) if I give "nginx start" itself as the entrypoint, it just daemonizes and exits immediately for lack of a process to wait for.My inclination is just to do something like this:pid=$(cat /run/nginx.pid) while ps ax | awk '{print $1}' | gre...
Well I opened up theDockerfile from the official nginx containerfor you and saw they use:CMD ["nginx", "-g", "daemon off;"]
Nginx 504 Gateway Timeout Error for Django
I am running a Django site on DigitalOcean using 1ClickInstallation image. Every thing worked fine but I got issue for 504 Gateway Timeout Error. I've tried multiple settings on blogs but not working. Following are my settings:upstream app_server { server 127.0.0.1:9000 fail_timeout=0; } server { listen 80 d...
I found the solution as I was trying to make changes in/etc/nginx/sites-available/django-project. But I needed to add following lines in/etc/nginx/nginx.confthe global settings for Nginx. Lines I've added are:http { ... proxy_connect_timeout 10; proxy_send_timeout 15; proxy_read_timeout 20; ...
NGINX: How to return inline html?
I want to achieve something like this:server { listen 80; location / { return 200 Hello World } }i.e., any request should return the inline html. Is this possible with NGINX?EDIT:I tried this:server { listen 80; location / { return 200 'Hello World' } }But testing in browser did ...
Use the return directive to return HTML code. Remember to set proper content type, otherwise the browser will asume raw text and won’t render the code:server { listen 80; location / { add_header Content-Type text/html; return 200 'Hello World'; } }
Curly braces ({ and }) from Apache to Nginx rewrite rules.
I have this rules that sucessfully worked on apache but return error or nginx :rewrite ^/saison-([0-9]{1})$ /pages.php?cat_page=saison-$1&season=$1 last; rewrite ^/saison-([0-9]{1})/([a-z0-9-]+)$ /evenements.php?season=$1&title=$2 last; rewrite ^/saison-([0-9]{1})/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)$ /evenements.php...
Read thisdocumentation. especially:Note: for curly braces( { and } ), as they are used both in regexes and for block control, to avoid conflicts, regexes with curly braces are to be enclosed with double quotes (or single quotes).So for example the line :rewrite ^/saison-([0-9]{1})$ /pages.php?cat_page=saison-$1&season=...
Nginx, how to start service with ngx_http_sub_module enabled
How to start Nginx as service with this module?According to thisdocumentation, it says:This module is not built by default, it should be enabled with the --with-http_sub_module configuration parameter.I don't understand where to enter this command. Is itnginx service start --with-http_sub_module? That is so confusing.W...
If you see--with-http_sub_moduleinnginx -Voutput, you can be certain that the module is already built in. So simply use its directives in configuration file, there is no need to do any special magic to load the module itself.Now as to why documentation says:This module is not built by default, it should be enabled with...
nginx proxy based on host when using https
I need to use Nginx as an SSL proxy, which forwards traffic to different back ends depending on the subdomain.I have seem everywhere that I should define multiple "server {" sections but that doesn't work correctly for SSL. Doing that I would always have the SSL being processed in the first virtual host as the server n...
I found the solution which is basically to define the SSL options and the SSL certificate outside the "server" block:ssl_certificate ssl/mysite.com.crt; ssl_certificate_key ssl/mysite.com.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP; ...
build_absolute_uri with HTTPS behind reverse proxy
I'm serving my django app behind a reverse proxyThe internet -> Nginx -> Gunicorn socket -> Django appIn the nginx config:upstream my_server { server unix:/webapps/my_app/run/gunicorn.sock fail_timeout=0; }The SSL is set up with certbot at the nginx level.request.build_absolute_uriinviews.pygenerates http links. How ...
By default Django ignores allX-Forwardedheaders, base onDjango docs.Force read theX-Forwarded-Hostheader by settingUSE_X_FORWARDED_HOST = Trueand setSECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https'). So insettings.py:USE_X_FORWARDED_HOST = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Spring Boot Application deployed on Elastic Beanstalk Java environment returns 502
I'm trying to deploy a very simple Spring Boot application on AWS Elastic Beanstalk using AWS's Java configuration (not their Tomcat configuration), but I keep getting a 502 error with the following log:2016/06/10 02:00:14 [error] 4921#0: *1 connect() failed (111: Connection refused) while connecting to upstream, clie...
Nginx doesn't know on which port your spring boot applicaiton is running. Make application run on port 5000 that Nginx redirects to by default by adding "server.port=5000" to application.properties or other suggested ways in the last step:https://pragmaticintegrator.wordpress.com/2016/07/12/run-your-spring-boot-applica...
What does `expires -1` mean in NGINX `location` directive?
Given the samplelocationexample below, what does-1mean forexpires? Does that mean "never expires" or "never caches"?# cache.appcache, your document html and data location ~* \.(?:manifest|appcache|html?|xml|json)$ { expires -1; access_log logs/static.log; }https://github.com/h5bp/server-configs-nginx/blob/b935688c2...
According tonginx manual, this directive adds theExpiresandCache-ControlHTTP header to the response.Value-1means these headers are set as:Expires:current time minus 1 secondCache-Control: no-cacheSo in summary it instructs the browser not to cache the document.
Customizing Nginx Configuration in AWS Elastic Beanstalk
I'm running a rails application on Ruby 2.0/Puma instances and am trying to customize the nginx configuration. I need to increase the permitted request size to allow file uploads. I've found some other posts that have lead me to add this to my .ebextensions:files: "/etc/nginx/conf.d/proxy.conf" : mode: "000755" ...
I found a way to restart nginx after deployment using an undocumented technique for running post-deployment scripts. I added this to my .ebextensions:files: "/opt/elasticbeanstalk/hooks/appdeploy/post/03_restart_nginx.sh": mode: "000755" owner: root group: root content: | #!/usr/bin/env bash ...
How do I setup ssl on a rails 4 app? (nginx + passenger)
I have a staging rails app running with passenger on nginx. I want to secure the connections with SSL. I have read a lot of resources online but I have yet to make it run on SSL.So far, my server block on nginx.conf is:server { listen 80; listen 443 default deferred; server_name example.com; root /h...
I've just made the decission to go with SSL myself and found an article on theDigitalOceansite on how to do this. It might be thelisten 443 default deferred;, which according to that article should besslnotdeferred.Here's the nginx block they use;server { listen 80 default_server; listen [::]:80 default_server ipv6...
Django get IP only returns 127.0.0.1
I have a webserver set up with gunicorn and nginx and django.I am accessing it remotely, and with this:def testIP(request): ip_address = utils.get_ip(request)I just keep getting an ip address of 127.0.0.1 Like i said I am accessing it remotely and thus it should not be giving a local address.I think it might have s...
How does get_ip() work?If nginx is a reverse proxy and gunicorn is the app server, it's always getting requests from nginx on the local machine.The real ip that nginx sends to the app server is in my caseHTTP_X_REAL_IPvia the nginx conf lineproxy_set_header X-Real-IP $remote_addr;So you might want to set that, and in y...
Force nginx to close connection instantly
How do I let nginx close the tcp connection instantly after the request is fulfilled?
I just found the solution:location /ip/ { keepalive_timeout 0; }
Nginx proxy or rewrite depending on user agent
i'm new to nginx, comming from apache and i basically want to do the following:Based on user-agent: iPhone: redirect to iphone.mydomain.comandroid: redirect to android.mydomain.comfacebook: reverse proxy to otherdomain.comall other: redirect to ...and tried it the following way:location /tvoice { if ($http_user_agen...
The '/api' part of the proxy_pass target is the URI part the error message is referring to. Since ifs are pseudo-locations, and proxy_pass with a uri part replaces the matched location with the given uri, it's not allowed in an if. If you just invert that if's logic, you can get this to work:location /tvoice { if (...
docker-compose --scale X nginx.conf configuration
My nginx.conf file currently has the routes defined directly:worker_processes auto; events { worker_connections 1024; } http { upstream wordSearcherApi { least_conn; server api1:61370 max_fails=3 fail_timeout=30s; server api2:61370 max_fails=3 fail_timeout=30s; server api3...
It's not possible with your current config since it's static. You have two options -1. Use docker engine swarm mode- You can define replicas & swarm internal DNS will automatically balance the load across those replicas.Ref -https://docs.docker.com/engine/swarm/2. Use famous Jwilder nginx proxy- This image listens to t...
Puma "Terminating timed out worker" after rendering HTML
I am new to AWS Beanstalk-Rails-Puma-Nginx. After deploying my RAILS app to Beanstalk, all my api calls work fine, but HTML pages are causing error.When opening my HTML page -Nginx throws502 Bad Gatewayerror.Puma log :Started GET "/admin" for 182.70.76.160 at 2016-04-22 05:13:19 +0000 Processing by Devise::SessionsCont...
For now I moved to EC2 as EBS issues weren't getting solved. I had the same issue on EC2 but I could fix it as I access my machine.Puma workers were timing out because my assets weren't precompiled. Everytime I take a new build on server, I have to run the following :RAILS_ENV=production rake assets:precompile
How to serve static contents in a kubernetes application
I have a smalljavawebapp comprising of three microservices -api-service,book-serviceanddb-serviceall of which are deployed on a kubernetes cluster locally using minikube.I am planning to keep separate UIs forapi-serviceandbook-service, with the common static files served from a separate pod, probably annginx:alpineimag...
Looks like you are confusing the fact that users, browsing online, will trigger standard requests to both "download" your static content,anduse your 2 APIs (book and api). It's not the NGINX service serving the static content that is accessing your APIs, but the users browsers/applications, and they do that exactly the...
How do I customize nginx on AWS elastic beanstalk to loadbalance Meteor?
I am running Meteor on AWS Elastic Beanstalk. Everything is up and running except that it's not running Websockets with the following error:WebSocket connection to 'ws://MYDOMAIN/sockjs/834/sxx0k7vn/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400My unstanding was to add something ...
With a LOT of help from AWS paid support, I got this working. The reality is I was not far off it was down to some SED syntaxt.Here's what currently works (Gist):option_settings: - option_name: AWS_SECRET_KEY value: - option_name: AWS_ACCESS_KEY_ID value: - option_name: PORT value: 8081 - opti...
Why use gunicorn with a reverse-proxy?
FromGunicorn's documentation:Deploying GunicornWe strongly recommend to use Gunicorn behind a proxy server.Nginx ConfigurationAlthough there are many HTTP proxies available, we strongly advise that you use Nginx. If you choose another proxy server you need to make sure that it buffers slow clients when you ...
According to the Nginxdocumentation, a reverse proxy can be used to provide load balancing, provide web acceleration through caching or compressing inbound and outbound data, and provide an extra layer of security by intercepting requests headed for back-end servers.Gunicorn is designed to be an application server that...
AWS elastic Beanstalk / nginx : connect() failed (111: Connection refused
I got this messageconnect() failed (111: Connection refusedHere is my log:------------------------------------- /var/log/nginx/error.log ------------------------------------- 2018/10/21 06:16:33 [error] 4282#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.4.119, server: , r...
111 connection refused likely means your app isn't running on the server/port combination. Also check that the security group for your app instance (or load balancer) has an inbound rule set to allow traffic from the nginx instance
Nginx auth_request handler accessing POST request body?
I'm using Nginx (version 1.9.9) as a reverse proxy to my backend server. It needs to perform authentication/authorization based on thecontentsof the POST requests. And I'm having trouble reading the POST request body in my auth_request handler. Here's what I got.Nginx configuration (relevant part):server { location...
The code of the nginx-auth-request-module isannotated at nginx.com. The module always replaces the POST body with an empty buffer.In one of thetutorials, they explain the reason, stating:As the request body is discarded for authentication subrequests, you will need to set the proxy_pass_request_body directive to off...
How to increase page timeout to prevent 504 error?
I am running a file with considerable amount of code and have to process it for 1000 users. It takes approximately 55 seconds to process 500 users, so I have to increase the default gateway timeout time.Fromthis question, I found that I have to increasefastcgi_read_timeout, but I don't know where to put it infastcgi.co...
fastcgi_read_timeoutshould be put into a location which you're using for processing requests to your file.location { fastcgi_pass you.app:9000; ... fastcgi_read_timeout 900s; # 15 minutes }Please, see more examples indocumentation
Nginx config for WSS
I am having a problem in connecting through WSS to my server. I followed the following article to setup nginx with websockets:http://www.letseehere.com/reverse-proxy-web-socketsThe following is my nginx config which serves a Play! application:#user nobody; worker_processes 1; error_log logs/error.log; #error_log ...
I have at least solved it for the short term by using stunnel (referring to this article:http://www.darkcoding.net/software/proxy-socket-io-and-nginx-on-the-same-port-over-ssl/).Stunnel can convert HTTPS to HTTP and by that token WSS to WS. Nginx served the socket application running on 9000 port as usual:/etc/stunnel/...
let's encrypt vs cloudflare or both? [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, ...
When you use Cloudflare then there are two parts to encrypt:From the user's browser to CloudflareFrom Cloudflare to your serverThis means that you need two certificates for full encryption.Cloudflare automatically provides you with the first one. This is the one that a user sees if they check the URL padlock.There are ...
Nginx Proxy to Files on Local Disk or S3
So I'm moving my site away from Apache and onto Nginx, and I'm having trouble with this scenario:User uploads a photo. This photo is resized, and then copied to S3. If there's suitable room on disk (or the file cannot be transferred to S3), a local version is kept.I want requests for these images (such ashttp://www.mys...
Shouldn't this be an example of usingtry_files?location /p/ { try_files $uri @s3; } location @s3{ proxy_pass http://my_bucket.s3.amazonaws.com; }Make sure there isn't a following slash on the S3 url
How do I get the Wordpress JSON-API to work on Nginx server?
For some reason "out-of-the-box" the Wordpress JSON API does not work on Nginx. I have tried several redirect schemes in the nginx conf. The only thing I have gotten to work is?json. However, this does not work for authentication and registration.As an FYI, I am developing a cordova application and attempting to use th...
I found the solution to the problem. Make sure that permalinks are working properly before you assume (like I did) that it is an issue with the plugin.I was able to correct permalinks for a wordpress site in a subdirectory on an nginx site. This article will help you if you face the same issuehere
Nginx daemon stop is failing
I've got Ubuntu 11.04 i386 server with nginx 1.0.11 installed. Also, I'm usingthis init.d script, the only one I've found in several different places. It starts the server nicely, however, on stop/reset it says* Stopping Nginx Server... [fail]Of course, the daemon is not stopped, and upon restart the configuration...
It's likely that it can't kill the process.Open up the nginx sysvinit script located in /etc/init.d/ (or /etc/rc.d/) and find where nginx.pid is thought to be. It'll be something like "/var/run/nginx.pid".If the pid file isn't there, open nginx.conf and look for the pid setting. If it is a mismatch - set the conf value...
Disable 404 error logging
In my configuration, I'm using:error_page 404 /switch;When I browse to /testABC, I see this error in my log:open() "/usr/local/nginx/html/www/testABC" failed (2: No such file or directory)How can I disable this error? I'm currently using the 404 as part of the site functionality.
If you don't want 404 errors to show in your nginx error logs,log_not_foundis the directive you want to configure.By default,log_not_foundis set to "on" which will report file not found errors in your main error log. To turn these off, just do:log_not_found off;Source:http://nginx.org/en/docs/http/ngx_http_core_module....
Nginx configuration for angular i18n application
I built an angular-5 application using i18n that supports both french and english. I then deployed a separate version of the app for each supported language- dist |___ en/ | |__ index.html |___ fr/ |__ index.htmlI also added the following nginx configuration to serve the application in both lang...
i've done the same thing on iis, first you have to build your app with "base-href" option:ng build --output-path=dist/fr --prod --bh /fr/ ng build --output-path=dist/en --prod --bh /en/and for nginx use this configlocation /fr/ { alias /var/www/dist/fr/; try_files $uri$args $uri$args/ /fr/index.html; } location /e...
Gunicorn will not bind to my application
I have made a django web app using the default localhost, however I am trying to set it up on a server so that I can configure a postgre database and continue on without having to redo the database later on.I am hosting the site though a digital ocean ubuntu 14 droplet. When I created the droplet I selected that it al...
Well that's not how you refer to the WSGI file with gunicorn. Seethe docs:The module name can be a full dotted path. The variable name refers to a WSGI callable that should be found in the specified module.So if your wsgi.py file is in GenericRestaurantSystem/wsgi.py, your command should begunicorn -b 127.0.0.1:8000 Ge...
unknown directive "server" in /etc/nginx/nginx.conf:4
With nginx/0.7.65 I'm getting this error on line 4. Why doesn't it recognizeserver?#### CHAT_FRONT #### server { listen 7000 default deferred; server_name example.com; root /home/deployer/apps/chat_front/current/public; location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control p...
Theserverdirective must be contained in the context ofhttpmodule. Additionally you are missing top-level events module, which has one obligatory setting, and a bunch of stanzas which are to be in the http module of your config. Whilenginx documentationis not particularly helpful on creating config from scratch, there a...
Reload Nginx in during docker build
I am trying to install nginx (and then nodejs) in my container. I have my own nginx config files in nginx/ folder:# --- Release with Alpine ---- FROM phusion/baseimage:0.10.1 # Create app directory WORKDIR /app RUN apt-get update \ && apt-get -y install nginx RUN ls /etc/nginx COPY nginx/nginx.conf /etc/nginx/ng...
nginx -s reloadcan only be used when nginx is running. It sends a signal to the master process of nginx which itself notifies the worker processes.The problem here is, that you do not have a nginx instance running during your build process. So you are unable to reload it.It is not a real problem though. Since nginx is ...
Nginx not started, homebrew says it is
brew services says nginx is started..MacBook-Pro-van-Youri:Homebrew youri$ brew services start nginx Service `nginx` already started, use `brew services restart nginx` to restart.Same for launchctlMacBook-Pro-van-Youri:Homebrew youri$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist /Users/youri/Library...
Because nginx is going to start at port 80, it needs to be root. LaunchAgents are run as non-root user when that user logs in.LaunchDaemonsare loaded at boot as root user.launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plistMove thehomebrew.mxcl.nginx.plistsudo mv ~/Library/LaunchAgents/homebrew.mxcl.nginx....
invalid parameter server_name in /etc/nginx/sites-enabled/django
I've deployed a Django application on DigitalOcean. First off, when i try to secure this with https and ssl, I get this error.when i run nginx -t :nginx: [emerg] invalid parameter "server_name" in /etc/nginx/sites-enabled/django:12nginx: configuration file /etc/nginx/nginx.conf test failedupstream app_server { server ...
You're missing semicolons on a bunch of lines, that's why nginx -t is failing.
Reuse configuration statements for domains in nginx.conf
Let's say I have a nginx configuration set up for a domain like this:server { root /path/to/one; server_name one.example.org; location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_na...
you can do:server_name one.example.org two.example.org;if both are exactly identical except for the domainnameif you have just similar locationblocks you can move those locations to a separate file and then do aninclude /etc/nginx/your-filename;to easily use it in each serverblock
Forwarding to GitLab Subdomain with Existing Nginx Installation
I've been following theinstructions from the GitLab wiki, however, it seems as if some key pieces of information are missing. In the section "Using a Non-Bundled Web Server" it never explains how I need to reconfigure my Nginx installation to reverse proxy over to GitLab.Basically, I'd like to have GitLab installed und...
Based on @cyberchis's answer i simplified the process, and I have got through the same setup twice. I hope that it also works for you.Check the user of nginx1.1. Opennginx.confwithnano /etc/nginx/nginx.conf.1.2. Check the 1st. lineuser www-data;, and the user here iswww-data.Edit external_url of gitlab2.1. Opengitlab.r...
How to get systemd to restart Rails App with Puma
I've been struggling with this a week now and really can't seem to find an answer. I've deployed my Rails App with Capistrano. I use Puma as a server.When I deploy, everything works ok. The problem is to get Puma to start at reboot and/or when it crashes.To get the deployment setup, I've used thistutorial. I'm also usi...
Have you looked intoForeman? Foreman makes it easy to start and stop your application if it has multiple processes. Incidentally it also provides anexportfunction that can generate somesystemdorupstartscripts for you to (re)start and stop your application.As you are already using capistrano you can usecapistrano-forema...
Does the nginx HTTP/2 module support Server Push?
I'm planning to upgrade my nginx to 1.9.6 which supports HTTP/2.Have nginx implemented HTTP/2 server push?ref:https://ma.ttias.be/service-side-push-http2-nghttp2/
Yes, Nginx supports HTTP/2 server push sinceversion 1.13.9, released on February 20, 2018.The Nginx team pointed out in the original1.9.5 blog postthat it wasn't supported back then.
Mongrel2 vs. NGINX+ZeroMQ?
I see this newNGINX+ZeroMQproject on github and am now confused.What are the feature and scalability differences betweenMongrel2and NGINX+ZeroMQ.(The reason why I ask is because I'm under the impression Mongrel2 was solely created since NGINX didn't support ZeroMQ)
I also read about the nginx+zeromq module and I immediately spotted a considerable difference.ZeroMQ nginx module uses REQ/REP sockets to communicate with the backend processes. On the other hand mongrel2 uses two sockets. One PUSH/PULL to send messages downstream (to the handlers) and one PUB/SUB (to receive responses...
Can we use both NGINX and PM2 for node.js production deployment?
I am new to Node.js. I have built my first Node.js server. I am doing some research to improve performance of node js server in production. So I learned about NGINX and Process Manager(PM2).NGINX:It can load balance the incoming requests.It can act as reverse proxy for our application.PM2:It can divide our application ...
This is a huge topic but let me help and give you some pointers.Nginx is much more than just a reverse proxy. It can servestatic content,can compress the response content, can run multiple apps on different port on the same VM and much more.PM2 essentially helps you to scale throughput of your service by running it in ...
File not found nginx php-fpm
I've looked through every question like this here and tried to apply the stated fixes with no success.I'm using thewordpress:4.7.3-php7.0-fpm-alpinedocker image with a separate nginx container in front of it.When I curl wordpress I get:File not found.When I check the wordpress container logs, I get:127.0.0.1 - 16/Mar/...
The error indicates that yourSCRIPT_FILENAMEis incorrect. Your comment:in the wordpress container it's at /var/www/html/index.php in the nginx container it's at /appsuggests thatnginxandphp-fpmare seeing a different document root.In which case, use:fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
Running python through fastCGI for nginx
I am looking to run standalone python scripts through fcgi for use with nginx, but I have no idea where to start with spawning the processes. Currently, I have PHP successfully with nginx+fcgi, but I'm unsure if/how I can do the same with python. Any suggestions on where to start?
See thepython docs section on FCGI. Basically, with Python, you use the WSGI interface on top of an fcgi server which talks to the web server (the fcgi client).SeePython + FastCGIfor a couple of Python fcgi servers.Edit:This nginx wiki pageexplains exactly how to set up Python with nginx using fcgi.This wiki pagedescri...
How to setup health check page in django
I have a webapp which required authentication to access any page of it. But for my ELB to work I have to setup health-check page for ELB so that ELB discover django app.This page should return HTTP 200 and no auth required. How do I setup this with django/nginx world.
NOT RECOMMENDED - this was a quick and dirty way to get Django up and running with ELB, but in most cases a health check response should be returned directly from your application code. See the rest of the answers for a better solution.This is something better handled by nginx, so the fact that it's serving a django ap...
How do I allow a PUT file request on Nginx server?
I am using an application which needs toPUTa file on a HTTP server. I am using Nginx as the server but getting a405 Not Allowederror back. Here is an example of a test with cURL:curl -X PUT \ -H 'Content-Type: application/x-mpegurl' \ -d /Volumes/Extra/playlist.m3u8 http://xyz.comAnd what I get back from Nginx: 405 N...
To add HTTP and WebDAV methods like PUT, DELETE, MKCOL, COPY and MOVE you need to compile nginx withHttpDavModule(./configure --with-http_dav_module). Checknginx -Vfirst, maybe you already have theHttpDavModule(I installed nginx from the Debian repository and I already have the module).Then change your nginx-config lik...
Set php include_path from nginx
Apache lets you set php.ini values for virtual hosts with the php_value directive.Does nginx have something similar? Is there another way to set the include_path on a per-site basis?
Now, it is possible to do this way:fastcgi_param PHP_VALUE "include_path=/my/include/path";More information here:http://bugs.php.net/bug.php?id=51595Using this technique to set php values, I have successfully set different "error_log" locations for multiple virtual hosts.Thanks, PHP and NginX guys!
Where does nginx store default error pages
Where doesnginxstore the default error pages it outputs on disk? I.E. the standard404looking like:404 Not Found404 Not FoundnginxHopefully these arenothard-coded into the nginx source. Thanks.
Check out html folder in the nginx directory - there should be 50x pages.By default, I believe, all "special pages", including 404 page arehardcodedstatic char ngx_http_error_404_page[] = "" CRLF "404 Not Found" CRLF "" CRLF "404 Not Found" CRLF ;Source:https://github.com/nginx/nginx/blob/release-1.15.8/src/http/ngx_ht...
How to set php ini settings in nginx config for just one host
One can seterror_reportinginnginx.conflike so:fastcgi_param PHP_VALUE error_reporting=E_ALL;But if I do this in one server block, will it affect all the others as well? Should I change php settings in all server blocks simultaneously?
If every host on your server runs in its own PHP-FPM pool, than addingfastcgi_param PHP_VALUE ...to one nginx host will not affect the other ones.If on the other hand allnginxhosts use one PHP-FPM pool, you should specifyPHP_VALUEfor every host you have (error_reporting=E_ALLfor one of them, empty value for others). Si...
Nginx: Redirect all but one
I have the following http config:server { listen 80; server_name example.com; # Necessary for Let's Encrypt Domain Name ownership validation location /.well-known/acme-challenge/ { root /home/vagrant/.well-known/acme-challenge/; } return 301 https://$host$request_uri; }I would...
You should move that redirect to be in the "/" block:location / { return 301 https://$host$request_uri; }They do process in order, but yours isoutsideof any location block, so likely is taking precedence.
nginx config with spa and subdirectory root
I always seem to have problems with nginx configurations. My SPA is located at /mnt/q/app (pushstate is enabled) and the frontend root is located at client/public. Everything should be mapped to index.html, where the app picks up the route and decides what to do.Full path to the index is/mnt/q/app/client/public/index.h...
Ifnginxviews the file system from the root, then therootshould be set to/mnt/q/app/client/public, and not either of the two values you are using.The last element of thetry_filesdirective can be a default action (e.g./index.html), a named location or a response code. You have a named location in the penultimate element ...
Unable to start php-fpm - "cannot get uid for user 'apache'"
On a fresh AWS Linux HVM box, I ran the commands:sudo yum update sudo yum install git nginx php-fpmI then tried tosudo service start php-fpm, but got the error:Starting php-fpm: [10-Sep-2014 20:52:39] ERROR: [pool www] cannot get uid for user 'apache' [10-Sep-2014 20:52:39] ERROR: FPM initialization failedWhere am I go...
Theapacheuser comes fromphp-fpm.conffile. It does not matter that you run it as root, the service will start as the user which is configured in this file.Find yourphp-fpm.conffile. It should be somwhere in/etc. Edit it and change linesuser = apache group = apachetouser = www-data group = www-dataI'm assuming your defau...
Nginx load balance with upstream SSL
Trying to setup Nginx as load balancer for https servers. The upstream serves over port 443 with SSL certificates configured. How to configure Nginx, so that the SSL certificate configuration is handled only on the upstream servers and not in the Nginx server?
You need to useUpstream module, andReverse Proxy module. To reverse proxy to the https upstream, use thisproxy_pass https://backend;where backend is an uptream block.However, if I were doing this, I'd terminate ssl on the nginx server, and make upstream app servers doing what they are good at: serving the content, ins...
nginx auth_basic time limitation
I'm protecting my dev server using nginx and theauth_basicmodule, but I can't seem to find a way to specify the interval at which the 'authentication' expires.I would like to be able to force nginx to ask for the password say every 6 hours. Is there a way to do that? If not, what is an acceptable workaround?
It's probably not possible. There doesn't seem to be any documentation on thenginx HttpAuthBasicModule pageto suggest that you can timeout Basic HTTP authentication.TheHTTP specificationforAuthorizationheaders also does not specify a timeout mechanism. I don't expect you'll be able to rely on basic authentication if yo...
nginx proxy to comet
I need some help from some linux gurus. I am working on a webapp that includes a comet server. The comet server runs on localhost:8080 and exposes the url localhost:8080/long_polling for clients to connect to. My webapp runs on localhost:80.I've used nginx to proxy requests from nginx to the comet server (localhost:80/...
i don't think, that is possible ...localhost:8080/long_pollingis aURI... more exactly, it should behttp://localhost:8080/long_polling... inHTTPtheURIwould be resolved as requesting/long_polling, to port 80 to the server with at the domain 'localhost' ... that is, opening a tcp-connection to 127.0.0.1:80, and sendingGET...
Where are these extra HTTP headers coming from?
When I simply echo something out of php file, I do not send any headers intentionally, however - there are some default headers present anyway when I look at firebug response:response headers:HTTP/1.1 200 OKServer: nginxDate: Thu, 23 Jun 2011 19:33:51 GMTContent-Type: text/htmlTransfer-Encoding: chunkedConnection: keep...
I believe it is a combination of both... You can tell that "X-Powered-By: PHP/5.3.6-6~dotdeb.1" comes from PHP and "Server: nginx" comes from NGINX.You can alter the headers in PHP as follows:The gzip header most definitely comes from NGINX as it is compressing the output (html) to the browser. PHP can "add" to the hea...
auth_basic within location block doesn't work when return is specified?
i thought this would work but for some reason it skips the auth_basic and always returns 200. Same happens if i swap 200 for a 301 redirect.If i comment out the return statement it works ok. Ideally i want just an/authendpoint that once authenticated it will 301 redirect to another path.location /auth { auth_basic...
return-directives are executed before most other directives. To solve your problem you need to split this into two locations:location /auth { auth_basic_user_file /etc/nginx/.htpasswd; auth_basic "Secret"; try_files DUMMY @return200; } location @return200 { return 200 'hello'; }Thetry_files-directive is evalua...
Chat project - load balance with socket.io
I am involved in a development project of a chat where we are using node.js, socket.io (rooms) and mongodb. We are at the stage of performance testing and we are very concerned if the system needs a load balance.How can we develop if our project needs it? J'a researched on NGINX looks cool, but we are in doubt whether ...
To ensure that we can scale to multiple nodes but keep up interconnectivity between different clients and different servers, I use redis. It's actually very simple to use and set up.What this does is creates a pub/sub system between your servers to keep track of your different socket clients.var io = require('socket.io...
Django - Supervisor : exited too quickly
I try to deploy my website in Django+Supervisor+NGINX on Ubuntu server 16.04.Here is my .conf (supervisor):[program:sitepro] command = /home/user/sitepro/bin/gunicorn sitepro.wsgi:application --bind mywebsite.fr:8002 user = user autostart = true autorestart = trueMy NGINX config file :server { listen 80; s...
The issue is that you are missing thedirectory=...in your config file[program:sitepro] command = /home/user/sitepro/bin/gunicorn sitepro.wsgi:application --bind mywebsite.fr:8002 directory = /home/user/sitepro/site user = user autostart = true autorestart = trueOtherwise gunicorn will not know where to findsitepro.wsgi...
Nginx - Allowing origin IP
Nginx supportsallowanddenysyntax to restrict IPs, e.g.allow 192.168.1.1;. But if traffic goes through a reverse proxy, the IP will refer to the proxy's IP. So how can it be configured to whitelist a specific origin IP and deny all other incoming requests?
remote_addr will refer to the proxy, but you can configure the proxy to send the client address with header fields X-Real-IP/X-Forwarded-For.Combined with thengx_http_realipmodule, you can modify the incoming header to use the real client address for remote_addr. I believe this will work as expected with allow/deny syn...
Why do we need nginx with thin on production setup?
Why do we need to install nginx with thin on production setup, As thin is itself a web server. Every blog post people are using ruby+rails+nginx+thin?
As stated by Michael nginx balances thin (whatever that means). But another reason to use nginx in front of any ruby server is to serve static files (if you use page caching, they also can be served by nginx), which means requests wont even touch your ruby app, and increase a lot your performance. Also nginx although i...
Installing Passenger when Nginx is already installed; Possible?
Rather a simple question I believe, is it possible to install passenger when nginx is already installed on your webserver?If the answer is Yes, I already performed these actions:At this very moment I already have nginx installed (for my PHP applications) and next I did a checkout of the passenger's git repository:mkdir...
I think your problem is that the passenger module is not present in nginx.All the passenger dependent directives you've described (passenger_root, passenger_ruby, passenger_enabled) are available only when the passenger module isattachedto nginx. This is why you have to compile nginx with--add-module='/path/to/passenge...
NGINX - Using variable in proxy_pass breaks routing
I'm trying to get NGINX's resolver to automatically update the DNS resolution cache, so I'm transitioning to using a variable as theproxy_passvalue to achieve that. However, when I do use a variable, it makes all requests go to the root endpoint of the request and cuts off any additional paths of the url. Here's my con...
There is a small point you missed in documentationWhen variables are used in proxy_pass:location /name/ { proxy_pass http://127.0.0.1$request_uri; }In this case, if URI is specified in the directive, it is passed to the server as is, replacing the original request URI.So you config needs to be changed toset $pass_url...
Prevent NGINX to remove the port
I want to keep the ServerName and Port dynamicly on my rewrite: Lets say the Firewall redirect port 8081 to 80. So, if i access the webserver for example with "192.168.1.123/frontend" or "my.domain.tld:8081/frontend" i should be redirect to "192.168.1.123/frontend/" or "my.domain.tld:8081/frontend/"If i use the normalr...
I finally found a solution to the problem you've well described. I made it work with URL rewriting, but it seemed a bit overkill.So, for anyone having the same problem, it appears the cleanest solution would be to replace this :proxy_set_header Host $host;with this :proxy_set_header Host $http_host;With this setup, Ngi...
Meteor - What is the purpose of "ROOT_URL" and to what should it be defined?
I'm getting some problems to make spiderable work with PhantomJS on my Ubuntu server. I saw this troubleshooting onMeteorpedia:Ensure that the ROOT_URL that your Meteor server is configured to use is accessible from the server itself. (Since v0.8.1.3[1])I think that this could be a possible answer to why it is not wo...
TheROOT_URLenvironment variable should be set to the URL that clients will be accessing your application with. So in your case, it would behttp://gentlenode.comorhttps://gentlenode.com.TheROOT_URLenvironment variable is read byMeteor.absoluteUrl, which is used in many (core) packages. Thus, settingROOT_URLmay be a requ...
Passenger and Nginx or Passenger Standalone only?
Excuse me if my question may seem inappropriate but i was unable to find any information regarding my question.I am currently choosing a production web server for my rails app, Passenger seems to fit my needs perfectly, although there is a small question that popped in my head.It seems that Passenger is already based o...
Passenger standalone is good enough to run in production, it may be easier to use the OS packages insteadInstallation is usually as simple asyum installorapt-get installUsually includes all the appropriate startup scripts like/etc/init.d/nginxYou don't have to write scripts to make sure it starts up after rebooting. Ub...
serving static files on Django production tutorial
Does anyone have a simple step-by-step tutorial about serving static files on a Django production app? I read the Djangodocsand it sounds really complicated... I'm trying to go the route of serving static files using a different server like lighttpd, nginx, or cherokee, but setting these up is all Greek to me. I downlo...
Sorry, don't have a step by step tutorial. But here is a high level overview that might help:You probably want to go with the Apache server (http://httpd.apache.org/) This comes with most *nix distributions.You then want to use mod python (or as the commenter pointed out mod_wsgi:http://docs.djangoproject.com/en/dev/h...
serving static files from ingress-nginx
I have aexpressweb server with static files. Let's call this myexpress-deployment.I'd like to use myingress-nginxto serve static files from myexpress-deploymentwithout ever actually hitting my express server.Innginxthis is done with thelocationdirective where you point to files locally hosted. While I see an option for...
In theory, you could have a PV in in RWX mode mounted to both express and ingress and provide custom config to the nginx-ingress pods, but that should be avoided. Ingress Controller has one responsibility - implement Ingress rules defined in your cluster. To serve static content you should have a pod that does that, wh...
Running nodejs under nginx
I'm currently trying out nginx and nodejs with connect running nodejs proxied in nginx. The problem I have is that I currently don't run nodejs under the root (/) but under /data as nginx should handle the static requests as normal. nodejs should not have to know that it's under /data but it seems to be required.In oth...
I think this solution may be better (if you are using something like Express OR something similar that uses the "middleware" logic):Add a middleware function to change the url like sorewriter.jsmodule.exports = function temp_rewrite() { return function (req, res, next) { req.url = '/data' + req.url; next(); ...
nginx and trailing slash with proxy pass
I am using the following configuration for nginx 1.4.1:server { listen 8000; server_name correct.name.gr; location /test/register { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;...
My guess is that your upstream server (either apache or your script) triggered a redirect to theabsoluteurlhttp://localhost/test/register/. Because you usehttp://127.0.0.1in yourproxy_passdirective, nginx doesn't find a match of the domain name and returns theLocationheader as is.I think the right solution is to NOT us...
Laravel+Plupload uploading to S3 response for preflight is invalid - CORS
I'm testing a plupload upload to S3 on a Nginx server. The whole project is based on Laravel.The problem is when I start upload, Chrome's console says:XMLHttpRequest cannot load http://BUCKET.s3.amazonaws.com/. Response for preflight is invalid (redirect)I have tried using PHP headers to enable CORS, but error still oc...
I found a way to achieve it poorly. Studyinghttp://laravel.com/docs/master/filesystemdeeply I didn't found a valid answer to get Plupload working. Otherwise, I found a poor solution that is using a:And use something like:foreach($request->file("files") as $file) { Storage::put( 'test'.rand(1,100), ...
Nginx + PHP-FPM 502 Bad Gateway
I am getting a502 Bad Gatewayfrom Nginx on a line of PHP code that is working fine in other places of my program ($this->provider = new OAuthProvider();), and that have worked fine before. This is the message I get in the Nginx error log for each 502:recv() failed (104: Connection reset by peer) while reading response ...
maybehttp://pecl.php.net/bugs/bug.php?id=17689or bug id #18138