Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
Getting Common Name from Distinguished Name of client certificate in NGINX
I need to get the CN of a client certificate in NGINX to append it to the proxy headers.I already found the following map code for this.map $ssl_client_s_dn $ssl_client_s_dn_cn { default ""; ~/CN=(?[^/]+) $CN; }But sadly it only returns an empty string for the following $ssl_client_s_dn: CN=testcn,O=Test Organi...
The pattern you use requires the legacy DN, since it assumes the/to separate the RDNs. So (since nginx v1.11.6) the following works:map $ssl_client_s_dn_legacy $ssl_client_s_dn_cn { default ""; ~/CN=(?[^/]+) $CN; }With $ssl_client_s_dn_legacy: /O=Test Organization/CN=testcn
Angular i18n json cache issues using nginx
I'm using angular with i18n translations in json files like de.json and en.json. In my production environment (nginx) I have the problem that these JSON files are cached by the web browser. After an upgrade, Chrome will not download the new version of the current json file even though the date header has changed.Reques...
Not specifically a fix for Angular/nginx, but a practice I often use is to append a query string parameter to the resource when you load it. For me, this is typically derived from version number of the .js file / application, e.g. using it as a seed for a RNGSo, instead of:useBonus points- in your Angular application, ...
NGINX loadbalancing on Kubernetes
I have some services running in Kubernetes. I need an NGINX in front of them, to redirect traffic according to the URLs, handle SSL encryption and load balancing.There is a working nginx.conf for that scenario. What I´m missing is the right way to set up the architecture on gcloud.Is it correct to launch a StatefulSet ...
You don't really need aStatefulSet, aDeploymentwill do since nginx is already being fronted by a gcloud TCP load balancer, if for any reason one of your nginx pods is down the gcloud load balancer will not forward traffic to it. Since you already have a gcloud load balancer you will have to use aNodePortServicetype and...
How to redirect all request to index.php even with .php in the url
I have this nginx vhost config:server { listen 8081; server_name blocked_server; root /home/gian/blocked_server; access_log off; error_log off; index index.php index.html index.htm index.nginx-debian.html; location ~ \.php$ { include snippets/fast...
I already solved the problem. First you should comment out this line or remove this line from thesnippets/fastcgi-php.conffiletry_files $fastcgi_script_name =404;then on your virtualhost config puttry_files $uri $uri /index.php;before theinclude snippets/fastcgi-php.conf;on thelocation ~\.php$block.thelocation ~\.php$b...
Serving flask application with Nginx and gunicorn: permission denied when connecting to webpage.sock
I am trying to setup a simple flask application served by Nginx and Gunicorn and have mostly followed thistutorial. When trying to access the webpage, I get a 502 Bad Gateway error.The nginx log (/var/log/nginx/error.log) says :[crit] 23472#0: *1 connect() to unix:/home/crawforc3/webpage/webpage.sock failed (13: Permis...
I discovered that there was a discrepancy with/etc/nginx/nginx.confI had the user set as www-data and I should have set it as crawforc3. Making this change and restarting nginx and gunicorn resolved the issue.
Client authentication with HttpClient
Trying to implement client key authentication (with self signed ca).Code looks like:KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore.load(new FileInputStream("client.p12"), "changeit".toCharArray()) SSLContext sslcontext = SSLContexts.custom() .loadTrustMaterial(null, new TrustSelfSignedStrateg...
The problem was that my client key was also including signing certificates in key chain. Not only my client certificate (which is required for authentication), but whole chain of certificates (without keys of course, just certificates)It was:> Root CA cert -> Client CA cert -> Client key + certI guess Java uses a wrong...
How to run symfony via docker-composer
I git cloned this repository:docker-symfonyand followed the installation instructions.When I visitedsymfony.dev:81, I saw kibana 4.My problem is, I don't understand where I should put the Symfony project.My OS is Ubuntu 14.04
The instructions mention:put your Symfony application intosymfonyfolderand do not forget to addsymfony.devin your/etc/hostsfile.Then, run:$ docker-compose upYou are done,you can visite your Symfony application on the following URL:http://symfony.dev(and access Kibana onhttp://symfony.dev:81)That "symfonyfolder" comes f...
Using gzip_types/ssi_types in NGINX with "wildcard" media types
We have an application, serving json with media type:application/vnd.example.v1.0+jsonandapplication/vnd.example.v2.0+jsonand so on.If we want to use nginx'shttp://nginx.org/en/docs/http/ngx_http_ssi_module.html#ssi_typesandhttp://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_types. Do we have to append every p...
According to NGINX source codesrc/http/ngx_http.c:if (value[i].len == 1 && value[i].data[0] == '*') {No, you can't
NGinx & Django, serving large files (3gb+)
I'm having some problems to serve large file downloads/uploads (3gb+).As I'm using Django I guess that the problem to serve the file can become from Django or NGinx.In my NGinx enabled site I haveserver { ... client_max_body_size 4G; ... }And at django I'm serving the files in chunk sizes:def return_file(pa...
Don't use django to deliver static content, specially not when it's static content that's as large as this. Nginx is ideal for delivering them. All you need to do is to create a mapping such as this in your nginx configuration file:location /static/ { try_files $uri =404 ; root /var/www/myapp/; gzip on; ...
What's the "atomic disk write" for a Linux filesystem?
From the nginx config file readme:access_log:An optional third parameter indicates the size of the bufferIf write buffering is used, this size cannot exceed the size of the atomic disk write for that filesystem.
This actually depends on the filesystem being used. This is probably referring to the stat.blksize filesystem attribute.From thestat(2)manual page:struct stat { /* ... */ blksize_t st_blksize; /* blocksize for filesystem I/O */The -f option to thestat(1)appears to display this information, a...
Creating a POST request with X-Accel-Redirect with Rails?
I'm using rails 4 and I'm proxying a GET request to another server like this:def proxy_video(path) self.status = 200 response.headers["X-Accel-Redirect"] = "/proxy/#{path}" render text: 'ok' endIn my nginx config, I have this:location ~* ^/proxy/(.*?)/(.*) { internal; resolver 127.0.0.1; # Compose do...
I'm pretty sure you can't do this out-of-the-box with nginx. This feature is really designed for accelerating file downloads, so it's pretty focused on GET requests.That said, youmightbe able to do something fancy with the lua module. After you've compiled a version of nginx that includes the module, something like thi...
proxy_pass in nginx to private IP of EC2 instance
I have two Amazon EC2 instances. Let me call them X and Y. I have nginx installed on both of them. Y hasresquerunning on port3000. Only X has a public IP and domain example.com. Suppose private IP of Y is15.0.0.10What I want is that all the requests come to X. And only if the request url matches the pattern/resque, the...
Turns out that the server should be running on 0.0.0.0 if it needs to be reachable by addressing the IP of the instance.So to solve my problem, I stopped the server running resque on 127.0.0.1:3000 and restarted it to bind to 0.0.0.0:3000. Rest everything remains the same as above and it works. Thanks.For reference :Cu...
Cross-domain jQuery AJAX file upload
So the point is I have a subdomain which is API endpoint for uploading files. But when I'm trying to upload anything with jQuery to this subdomain (from main www domain) I'm getting errorXMLHttpRequest cannot loadhttp://1.storage.site.net/upload. Originhttp://www.site.netis not allowed by Access-Control-Allow-Origin.I ...
My bet is that the 5MB file is too large for Apache'smax_request_bodysetting (or whatever its name was), leading to the PHP script not being executed, thus never getting to send those headers, which in turns generates the misleading cross domain error.If this assumption is true, you should be seeing more details in yo...
How do webserver and cgi process communicate with each other?
I want to understand how the webserver (for example: nginx) and cgi/fastcgi communicate with each other. How does the webserver pass cgi script to cgi process and how does the cgi process respond to the request.In Nginx, we configure like this to let nginx passes PHP scripts to php-fpmlocation / { root /h...
A CGI application is simply a standard executable or script - each HTTP request to the web server corresponds to a single execution / instance of that executable or script where environment variables are used to pass information about the request (such as the request URL and request method) and the HTTP request body is...
Compilation of nginx fails due to struct 'crypt_data' has no member named 'current_salt'
I am trying to compile nginx on Ubuntu machine with GCC. My Glibc version is 2.31.m@feynman:~/Junk/nginx-1.9.9 $ /lib/x86_64-linux-gnu/libc.so.6 --version GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.2) stable release version 2.31.I have downloaded a bunch of different versions fromhttps://nginx.org/download/and tried wit...
In case anyone was looking for asolutionto the problem itself:The fieldcurrent_saltis no longer the name of the field where the result is stored and needs to be updated.Instead, the field name isoutput, as defined in/usr/include/crypt.hon such a system:/* Memory area used by crypt_r. */ struct crypt_data { /* crypt_...
How to find out why Nginx return 400 while use it as http/2 load balancer?
I'm implementing a http/2 proxy myself, and I'm using Nginx as load balancer.When I use Nginx as h2c load balancer, it works:server { listen 8443 http2; location / { error_log /Users/jiajun/nginx_error_log.log debug; grpc_pass grpc://127.0.0.1:2017; } }Run it:$ go run example/grpc_client/ma...
Looks like Nginx doesn’t think it’s talking HTTP/2 as the go client is sending the connection preface message ("PRI * HTTP/2.0") which Nginx thinks is a real message.The likely issue is that Nginx has not stated in the SSL/TLS handshake that it supports HTTP/2 via ALPN (or the older NPN). Which version of OpenSSL (or e...
ngnix transfers data to a unix domain socket incompletely
My application is listening on a unix domain socket (UDS) for incoming data while nginx is sending data using PHP. Sending smaller data chunks of several KB works perfectly but as soon as it gets to certain limit, the browser gets the error504 Gateway Time-out, nginx logsupstream timed out (110: Connection timed out) w...
Ok for staters Nginx has nothing to do with this question it's that is quite clearly PHP sending and receiving data.It is more than likely your remote system is not closing the socket at the correct time or is just taking far to long to respond.while (($chunk = socket_read($this->socket, 2048, PHP_BINARY_READ)) !== FAL...
Running multiple instances of daphne behind a load balancer: django-channels
I am usingdjango-channelsto addHTTP2&WebSocketsupport for my application. I could not find a lot of documentation as to how to scale channels. Below is mynginxconfiguration that load balances multiple instances ofdaphnerunning on the same machine but different ports. Is this the correct way to do it?upstream socket { ...
There are a few things here. To start, I don't think you're going to see much gain with running different types of requests in different processes. Your disconnect handlers are probably going to be very light - not doing much besides cleanup. Connect might not do much either and receive will get most of the load.You're...
No incoming connection for PhpStorm with xdebug (nginx / php-fpm)
I figured I'd try using nginx instead of Apache and see how that works, and I'm up and running, but I cannot for the sake of my life figure out how to make PhpStorm capture the incoming xdebug connection. It worked perfectly when I was running Apache.Usually, you'd get an "incoming connection"-window in PhpStorm - this...
It seems there was one thing I missed when I changed the settings - stopping to listen for breakpoints and then trying again. This seems to have fixed the issue...
Add headers in a Flask app with unicode_literals
Adding headers with unicode_literals enabled seems to fail with Nginx, uWSGI and a simple Flask app:# -*- coding: utf-8 -*- from __future__ import unicode_literals from flask import Flask, make_response app = Flask('test') @app.route('/') def index(): response = make_response() response.status_code = 401 ...
This problem is indeed due to a bug inWerkzeug. As you noticed, this is now corrected since Jun 4, 2013 (cf. therelated commiton Github). You can have a bug free version of Werkzeug by using the version0.9.5instead of the0.9.4.Moreover, to troubleshoot your problem, I addedapp.debug = Truejust after the initialization ...
Rewrite nginx host and proxypass to squid
I want to achieve the following:Request Host:http://example.com.proxy.myserver.comShould be rewritten tohttp://example.comand passed to a squid server via nginx proxypass.server { listen 80; server_name ~^(?.*)\.proxy\.myserver\.com$; location / { rewrite ^ $scheme://$subdub break; proxy_set_header X-Rea...
301 redirect is exactly what nginx shall do with that rewrite rule: because you put $scheme://$subdub at the replacement part, nginx will do a 301, ignoring that "break" flag.If the replacement string begins with http:// then the client will be redirected, and any further rewrite directives are terminated.Are you tryin...
node.js deployment questions
Ive been given the task of localising a facebook app that is built in Node.js that am told uses Nginx for SSL.This is my first foray into the world of Node.js and I have hit a wall in understanding the deployment process involved in pushing an node app to the world wide web (in order to access it through facebook).I ha...
So, you probably won't be able to use Node.js on a typical 'hosted server'. These servers are typically running Apache and only support a limited set of languages. There are several providers that offer Node.JS hosting, including the creators: Joyent.Otherwise, you'll need control of the actual server so that you can r...
Use Redis to serve URL map to nginx
I want to maintain a dynamic database in Redis with SEO-friendly URLs as keys and nasty querystring URLs as values. I want to call this directly from Nginx when the request comes in, get the nasty querystring URL and pass that along to Apache to serve content.I have thought about just having a flat map file, but that w...
You are right about HttpRedis being more geared towards caching. You would be better served using the redis2 module. The commands you need to execute are better provided by the more general case that redis2 provides
Deploying ASP.Net Web Forms project to Fedora 24
Here is my current setup:My Local Computer: This is where I created and programmed my ASP.Net WebForms project with Cloudflare Flexible SSL enabled using visual studio 2015 professional on Windows 10. I also have the team explorer enabled meaning my project is synced to Github and all of my files are also stored there ...
Your code isFull NETand not evenNET Coreand trying to deploy it toMono Framework. This may not work, Convert your project intoMonoorNET Coreand retry.
Gunicorn Upstart File Not Starting
I am trying to launch an app withgunicornandnginxand have had to double back to delete and change files a few times. This time, I ran into issues.I first created an upstart file...sudo nano /etc/init/gunicorn.confdescription "Gunicorn application server handling flowershop" start on runlevel [2345] stop on runlevel [!...
Easy way is try to reload your dropletsudo shutdown -r now
how to enable WebSocket with nginx on AWS Elastic Beanstalk server?
I deploy a nodejs application on the aws beanstalk servers and want to use socket.io feature based on WebSocket protocol. I know there's a discussionhereto directly connect to nodejs servers instead of using nginx as an proxy server. But if I still want to have the nginx as proxy server because of extra features provid...
We use elastic beanstalk with multiple docker containers(allows you custom nginx version) with following1.Nginx configlocation /ws/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://unix:/<>; }Enable TCP mode load balancing in elastic loa...
Static file versioning with Django
I am setting far-future expires headers for my CSS/Javascript so that the browsers don't ever ask for the files again once they get cached. I also have a simple versioning mechanism so that if the files change, the clients will know.Basically I have a template tag and I do something likewhich will become.The template t...
Will add another step to my pre-commit script to replace all direct links with links to versioned files in the minimized CSS.Seems there is no better way to do it. If you think of any, let me know and I'll consider marking that one as accepted answer.Thanks for your comments!
How can I configure react-router to with nginx/cherrypy and my current reactjs app
I have a working web app served by nginx with cherrypy in the backend and ReactJS for the front-end.The app grew so I want to use react-router to provide quick access to pages with URLs. For example I want that my.domain.name/user will get the part in my app that manages user.My single index.html includes the js bundl...
Found my own answer... Here is is:Basically nginx configuration needed redirect urls to /index.html (not to my bundle.js, of course)The addition oftry_filesin nginx conf takes care of that:location / { root /var/www; index index.html; try_files $uri $uri/ /index.html; }Additionally I modified the router's...
nginx case insensitive URL redirection [closed]
Closed.This question does not meetStack Overflow guidelines. It is not currently accepting answers.Closed10 years ago.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 St...
Use(?i)to match case-insensitively -http://perldoc.perl.org/perlretut.htmlLocation block is not necessary. Try this.rewrite (?i)^/WapsiteDataFetch(.*) http://images.xample.com/xyz/images$1 permanent;
Pylons: address already in use when trying to serve
I'm running pylons and I did this: paster server development.ini It's running on :5000But when I try to run the command again: paster serve development.iniI get this message: socket.error: [Errno 98] Address already in useAny ideas?
Normally that means it's still running, but that should only happen if it's in daemon mode. After you started it, do you get a command prompt, or do you have to stop it with Ctrl-C?If you get a command prompt back it's deamon mode and you have to stop it withpaster server development.ini stopIf you have stopped it with...
Why Nodejs serves a file with 80x more CPU usage than Nginx?
Take the same code that sits on nodejs.org home page. Serve a static file that is 1.8Mb. And do the same with Nginx, and watch the difference.Code :http://pastie.org/3730760Screencast :http://screencast.com/t/Or44Xie11FnpPlease share if you know anything that'd prevent this from happening, so we don't need to dep...
The problem with your node benchmark is that you store the static file in a variable inside the V8 heap. Due to the way how V8 handles memory it can't directly send data contained in javascript variables to the network, because addresses of allocated objects may change during runtime, therefore V8 has to make a copy of...
NGINX as proxy of Node.js
I'm using NODE.js behind NGINX server, this is my Nginx configuration:upstream example.it { server 127.0.0.1:8000; } server { server_name www.example.it; location / { proxy_pass http://example.it; proxy_redirect off; proxy_set_header Host...
That's correct, as nginx will be the remote host. You need to specify a custom log format to log theX-Forwarded-Forheader, see theconnect logger documentation.app.use(express.logger(':req[X-Forwarded-For] - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'));
Issue with Passenger - Apache
Running in a Linode slice with Ubuntu 10.04 LTS. I am getting a 500 Internal Server Error.The Apache log has:Apache/2.2.14 (Ubuntu) Phusion_Passenger/2.2.7 configured -- resuming normal operationscaught SIGTERM, shutting down*Passenger could not be initialized because of this error: The Passenger spawn server script, '...
Try (re)installing the native apache module (after installing the gem)apt-get install libapache2-mod-passengerI think I had the same problem and it worked after that.Good luck!
How to block countries from server when using cloudflare? [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, ...
CloudFlare allows you to block certain countries from accessing your website at the CloudFlare level. To do so:Select your domain in your CloudFlare Control PanelSelect the "Firewall" tabOn the "IP Firewall" tab, you can enter a IP, IP range, orCountryand click block.This will block the country from all your websites o...
application.css and application.js net::ERR_CONTENT_LENGTH_MISMATCH
I just upgraded my nginx from 1.4.2 (/usr/local) to 1.4.7 (yum) on AWS EC2. I now have a pair of errors occuring on the client side:GET https://subdomain.mysite.com/assets/application.css net::ERR_CONTENT_LENGTH_MISMATCH GET https://subdomain.mysite.com/assets/application.js net::ERR_CONTENT_LENGTH_MISMATCHI am at a l...
I can confirm answer 1 addresses the underlying problem (I'm a new SE user so I can't upvote it yet). Here is more detail for search engines:From/var/log/nginx/error.log2014/04/30 08:07:48 [crit] 35135#0: *116437 open() "/var/lib/nginx/proxy/7/09/0000001097" failed (13: Permission denied) while reading upstreamIn my ca...
Django Bad Request(400) Error in Deployment with Apache/NginX
I'm trying to lunch my app on VPS inDebug=Falsemode.Debug=Trueworks fine but when I change it to false I got this error. I'm using Apache for rendering python pages and Nginx to serve my static files. I tried using this [answer]:Debugging Apache/Django/WSGI Bad Request (400) Errorbut it's not working at least for me. A...
To discover your problem, first insettings.pysetALLOWED_HOSTStemporarily to:ALLOWED_HOSTS = '*'And then in somewhere in yourview, try to print out and see output of this command:print(request.META['HTTP_HOST']) # or print(request.get_host())Then according to output, set that (just domain of it as an list) to yourALLOWE...
Configure Nginx with a Subdomain
I've done my prior research, but cannot seem to find how to properly configure nginx to accept a subdomain.I currently have it properly configured for mydomain.com, but not analytix.mydomain.com:server { listen 80; server_name *.mydomain.com; access_log /home/ubuntu/virtualenv/mydomain...
Create a newserverblock where you set theserver_nameto the desired domain. The normal directory and file structure of nginx looks as follows:/etc/nginx | |---- /sites-available | | | |---- default.conf | |---- /sites-enabled | |---- default.conf -> ../sites-available/default.confYou have to create a...
How can I enable gzip text compression in universal angular and nginx?
does anyone know how to enable gzip text compression in nginx and universal angular? I don't know where to start doing it
The gzip has nothing to do with Angular, it's a server thing. In nginx you can enable it by settinggzip on;Like below:server { gzip on; gzip_types text/plain application/xml; gzip_proxied no-cache no-store private expired auth; gzip_min_length 1000; ... }See the article below for more detail...
Dokku (Digital Ocean) client_max_body_size node.js
So I've just pushed my app to Dokku (Digital Ocean) - and get the following error returned from an ajax post:POSThttp://example.com/foo413 (Request Entity Too Large)A quick google shows this problem is due to client_max_body_size being too low. So I've SSH'd into the server, opened up the apps nginx.conf and increased ...
This has been updated in Dokku and can be done from the CLI:dokku nginx:set node-js-app client-max-body-size 50m.https://dokku.com/docs/networking/proxies/nginx/#specifying-a-custom-client_max_body_size
Nginx unknown directive "if($http_user_agent"
I try to return 503 status code when the user agent header has a specific value. I tried outside and inside the location block. But when I reload the this config nginx failes to reload:upstream api{ server 127.0.0.1:1336; } # the nginx server instance server { listen 0.0.0.0:80; server_name api.project.com...
Add a space between if and (. that should do the trick!
Having trouble running nginx on EC2 instance
I installed Nginx with phusion passenger, but I am having trouble accessing the server. I am using the default configuration file, yet I never get a response from the server when I try to visit the IP address in my browser. On my server I can do :curl 127.0.0.1To get a response, but visiting the IP address in the brows...
Possible error-sources:You use the internal EC2 ip and not the public.You don't have any security policies set and you are hitting the EC2 firewall.iptables is not configured correctly, disable it until it works without.Nginx does not listen on the correct port. Use the default config.
With nginx, how do I run SSI on a page returned from another server?
I'm trying out nginx. I would like to use it to perform the following:Retrieve a page from a server1 which includes some SSI commandsProcess the SSI commands, eventually including content from server2Return the resultant pageI've got SSI working when using a local file, but not when using the page from a server1 using ...
Make sure that server1 is not returning compressed content. if its being returned gzipped, nginx won't uncompress it to apply the ssi rules to it.you can ensure the reponse is returned in plain text by clearing the Accept-Encoding header:location /hello-world.html { ssi on; proxy_set_header Accept-Encoding ""; ...
Nginx - passanger displays 404 not found for rails controllers
This is my first rails app i am deploying to a server other than heroku.I deployed my rails app to digitalocean successfuly. When i type the ipaddress in browser, home page shows up. But when i try to redirect to other controllers likexxx.xxx.xxx.xx/users/sign_init show404 Not Found. Also none of the images are showing...
I fixed it. Removed alllocationand addedpassenger_enabled on;outside.
Why is NGINX wanting to use ./logs/error.log as default?
I am currently wanting to use NGINX in my Rails setup. I have placed the configuration files in the directoryRAILS_ROOT/config/nginx. Here is my config-file placed nameddevelopment.confand themime.types-file.I am wanting to place my logs in theRAILS_ROOT/log-directory.This is mydevelopment.conf:worker_processes 1; ev...
http://nginx.org/en/docs/ngx_core_module.html#error_logindicates that:the default value iserror_log logs/error.log error;that for debug logging to work, nginx needs to be built with --with-debug.`what's happening is that you're falling through to the default value, I'm not spotting any syntax errors so my guess is that...
Avoiding Django's 500 error for not allowed host with Nginx
I'm using Django 1.5.1 in a production website but I'm having a huge number of 500's reports because of not allowed hosts requests. My website's Nginx vhost is configured as follows:server { listen 80; server_name mywebsite.com.br; location / { uwsgi_pass unix:/opt/project/run/brmed_web.sock; ...
It depends on your default configuration, but fromthis answer on ServerFaultyou must define a default vhost in Nginx, otherwise it will use the first one as a default.Basically, your configuration should look like this in order to allow only requests to "mywebsite.com.br" to pass:server { listen 80 default_server; ...
How do I configure nginx to put its error.log file somewhere I have write privileges?
I assume I simply have to insert an entry into annginx.conffile to resolve the error that is plaguing me (see below), but so far I haven’t had any luck figuring out the syntax. Any help would be appreciated.I want to run nginx as a regular user while having installed it using homebrew as a user with administrative pri...
The whole problem stems from trying to run nginx as my ordinary user self despite the fact that nginx was installed by my user self with administrative privileges. I was able to resolve both the errors shown here with the following commands executed as a user with administrative privileges:sudo chmod a+w /usr/local/va...
How can you get a user's IP in PlayFramework2 ?
For security reasons, sometimes it is needed to block users by IP. In my case, I would like to manage the IP blacklist in a (SQL) database. I guess I can handle the filter part based on Action Composition but for that I need the user's IP.So, how can I get the user's IP?PS : The application is running behind a nginx pr...
It's now possible with Play2.0.2+:RequestHeader.remoteAddress()Java :String ip = request().remoteAddress();Scala :Action { request => val ip = request.remoteAddress() }
Can a http request be sent with the nginx location directive?
Maybe this is trivial, but I haven't found anything meaningful or I didn't know where to look...(How) is it possible to to send a curl / whatever command as soon as a certain path is requested?Something along these lines, but that would actually work:location / { curl --data 'v=1&t=pageview&tid=UA-XXXXXXXX-X&cid=123&dp...
Here's how I did it eventually - proxy_pass instead of curl - based on this:https://github.com/vorodevops/nginx-analytics-measurement-protocol/tree/master/lua. The code assumes openresty or just lua installed. Not sure if the comments format is compatible (didn't test) so it may be best to delete them before using it.#...
How to run a Go http server with nginx
I have a simple HTTP server written in Go.In development It works fine but for production, where this server has to handle 100 requests at a time I need a proper web server like nginx.How can I put it behind nginx?
I'm guessing you need a simple reverse proxy config.Lets say your go http server is listening onhttp://example.com:8080:server { listen 80; server_name example.com; location / { proxy_pass http://example.com:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;...
Installing curl inside nginx docker image
The following Dockerfile few lines suppose to install curl inside the nginx custom image to run under ubuntu.The second group of code is an attempt to convert the task to do the same but to run on Amazon Linux.Any suggestion as to what would be the yum equivalent to the rest of the apt-get command?-no-install-recommend...
if you're asking how to get the Amazon Linux-based Dockerfile to install curl without prompting you, you can add -y to yum update://Dockerfile for Amazon linux FROM nginx RUN yum -y update && yum install -y curl
How to redirect all request to same file in nginx?
My root directory/web/app/srcIn this directory I have 2 directories /js/ and /assets/ and one file index.htmlThis is what I need to achieve:Any request to /js/ or /assets/ or /index.html just serve files from root directory For example myapp.com/js/app.js servers app.js from /web/app/src/js/ directory Same with request...
Sir, please try below code. :)server { ... root /web/app/src; ... location / { try_files $uri $uri/ /index.html; } }
Laravel routes overwriting phpmyadmin path with nginx
I have the following nginx config on my LEMP droplet:server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/html/public; index index.php index.html index.htm; server_name server_domain_or_IP; location / { try_files $uri $uri/ /index.php?$query_stri...
The following code worked for me (added before the "location ~ \.php$ {"-part:location /phpmyadmin { root /usr/share/nginx/html; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/nginx/html; fastcgi_pass unix:/va...
Collectd and Nginx plugin not working
My collectd config looks like:LoadPlugin nginx ... URL "http://localhost:8080/nginx_status?auto" Nginx conf looks like:server { listen 8080; index index.html index.htm; server_name localhost; root /var/www/default/; location / { try_files $uri $uri/ /index.html; } location /nginx_status { ...
Finaly resolved. After logfile plugin turned on:LoadPlugin logfile LogLevel info File "/var/log/collectd.log" Timestamp true I found that nginx plugin is not installed:[2014-10-14 06:30:59] plugin_load: Could not find plugin "nginx" in /usr/lib64/collectd [2014-10-14 06:30:59] Found a configuration for th...
Nginx + LUA, how to output file?
Having trouble with file output in Nginx + Lua. I chosen LUA, because nginx logic is pretty complicated, based on referrer or subdomains, etc.Having request like /img/am1/s/1.jpg I need to check if file exists in /somepath/am1/1.jpg. If it exists, then output it, otherwise proxy request to backend.
Ok, found itcontent_by_lua ' local file = "/path..." local f = io.open(file, "rb") local content = f:read("*all") f:close() ngx.print(content) ';
Content-Length Header missing from Nginx-backed Rails app
I've a rails app that serves large static files to registered users. I was able to implement it by following the excellent guide here:Protected downloads with nginx, Rails 3.0, and #send_file. The downloads and everything else is working great, but there is just this problem - TheContent-Lengthheader isn't being sent.I...
Okay, here's something. I don't know if it's the right way or not but I was able to fix the issue by manually sending theContent-LengthHeader from my RailsController. Here's what I'm doing:def download @file = Attachment.find(params[:id]) response.headers['Content-Length'] = @file.size.to_s send_file(@file...
How to serve Clojure pages with nginx
I set up a home server with ubuntu and ngingx and I can serve static files. Now I want to test some clojure files but I am not clear about how to do this. For php this seems very easy, for instancein this tutorialhe adds a location for php files. Is that all I need to do, just indicate where Clojure files are in the co...
Consider next setup:nginx -> ring server (jetty)You need to startlein ring server(usinglein-ringplugin) on some port (say 8080). Nginx will listen at 80 port and forward requests to 8080. Here is a sample nginx config:upstream ring { server 127.0.0.1:8080 fail_timeout=0; } server { root ; # Make site access...
Error with Chef build-essential cookbook on ubuntu 12.04
I am trying to get an nginx/unicorn ruby app server configured with chef. The problem I am running into is a dependency on the build-essential cookbook which when run, results in the output:================================================================================ Error executing action `install` on resource 'pa...
As soon as I posted this it occurred to me that maybe apt wasn't updating first. Sure enough, I needed to have the apt cookbook installed and in the run list ahead of nginx. This solves the problem.
header variables go missing in production
I'm running Rails 3.1 with PhusionPassenger and NGINX in the back. I'm sending requests via a simple HttpClient (GrahpicalHttpClient for OS X). My code expects a token and an ID in the header to verify the authenticity of the caller. In developement mode this is no problem, but once I move it into production the hea...
Nginx defaults to considering underscores in request headers invalid and subsequently removes them, seehttp://wiki.nginx.org/HttpCoreModule#underscores_in_headersfor how to fix this.
Django channels "ERROR Y of N channels over capacity in group subscriptions"
I'm doing load testing with my Django app providing GraphQL Subscriptions using Django channels and a redis Channels layer (django,graphene-django,channels,graphene-subscriptions,channels-redis). As ASGI server I'm usingdaphneright now. I usenginxas proxy. The periodicity with which the backend publishes messages via G...
The default capacity is 100 messages and the default message expiration time is 60 seconds. So if the the channel is never read within these capacity / time constraints, it will fill up.One reason why a channel might fill up is when the connection is never properly closed. In this case the channel will remain in the gr...
Nginx Rate limit GET or POST requests only at a location
I have a server in nginx configured and have the following code to create my rate limit zone:limit_req_zone $key zone=six_zone:10m rate=60r/m;In my location, I use a module to serve the requests. This location supports GET, POST and DELETE methods. I am trying to rate limit only GET requests to that location. This is ...
Hope this helps,In the http context of your NGINX configuration, add these lines:http { ... # your nginx.conf here # Maps ip address to $limit variable if request is of type POST map $request_method $limit { default ""; POST $binary_remote_addr; } # Creates 10mb zone in memory...
Running nginx on Alpine
I would like to run nginx and php-fpm on container start, however I can't seem to do that. Here is myDockerfile:FROM php:7-fpm-alpine EXPOSE 9080 8000 EXPOSE 9088 80 WORKDIR /var/www COPY . . RUN apk add nginx composer php7-fpm && \ composer install --no-progress && \ mkdir -p /etc/nginx /etc/nginx/sites-ava...
you can add a script and use it in yourCMD:script :#!/bin/bash service nginx start php-fpm7add the script to yourDockerfile:COPY /PATH/TO/script.sh /path/in/container/script.sh RUN chmod +x /path/in/container/script.sh CMD ["/path/in/container/script.sh"]
Kubernetes Nginx Ingress removing part of URL
I'm deploying a simple app in Kubernetes (on AKS) which is sat behind an Ingress using Nginx, deployed using the Nginx helm chart. I have a problem that for some reason Nginx doesn't seem to be passing on the full URL to the backend service.For example, my Ingress is setup with the URL ofhttp://app.client.comand a path...
So I found the answer to this. It seems that as of Nginx v0.22.0 you are required to use capture groups to capture any substrings in the request URI. Prior to 0.22.0 using justnginx.ingress.kubernetes.io/rewrite-target: /worked for any substring. Now it does not. I needed to ammend my ingress to use this:apiVersion: ex...
500 error with Nginx and WordPress pretty permalinks
Ran into a 500 issue when running Nginx and WP together and setting pretty permalinks. I've been trying a bunch of different methods from Google but none seems to help.Config -server { listen 80; root /var/www/mydomain.com/public_html; index index.php index.html index.htm; server_nam...
try:try_files $uri $uri/ /index.php?q=$uri&$args;AND:fastcgi_index /index.php;(note the / )
How do I find and stop the process that is running a server on port 443
I get this when I try to start nginx on ubuntu.[emerg]: bind() to 0.0.0.0:443 failed (98: Address already in use)How do I find and destroy process responsible?
As root:lsof -i :443...should reveal the offending process ID, assuming you have lsof on your operating system.
Problems with nginx.conf
This is my first time using nginx and I'm having some problems configuring an nginx.conf file. What I have isserver { location ~ /(application|system) { deny all; return 404; } rewrite ^(.*)$ /index.php/$1 break; }In case it's not clear; I'm trying to block access to the directories appl...
You need to make sure the server directive is inside of the http directive if I recall.eg:http { //various nginx settings here server { //server stuff here } }
How can I remove server header in nginx docker container?
I install nginx:1.15.6 container by docker-compose file and I want to remove Server header from all nginx responses, by the search I found bellow way set "more_set_headers 'Server: custom';" in nginx configuration but there is an error to respond . How can I remove server header in nginx docker? I think I should insta...
more_set_headersis a part of theheaders_moremodule, so it needs an additional nginx package to work properly.nginx-extrascould be installed while building docker image for nginx container:FROM nginx:1.15.6 RUN apt-get update && apt-get install -y nginx-extrasHope this helps.
nginx make node-red Lost connection to server but deploy works
Greetings I am configuring a node-red server and after apply Nginx redirect I got the following issue.After Using Nginx to redrect subdomain node-red.domain.com to localhost:1880Nginx redirect config:server { listen 80; server_name sub1.domain.com; location / { proxy_pass "https...
You need to enable WebSocket proxying to allow the editor to connect back to the runtime.To do that you need to add some additional options to yourlocationconfigs:location / { proxy_pass "https://127.0.0.1:8080"; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_h...
kibana service not running
I am trying to install Elastic search, Nginx, Kibana and Sense.I am following this guide:https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elk-stack-on-ubuntu-14-04I successfully installed Elastic search.However I am stuck at Kibana.I successfully followed all steps howev...
Use curl localhost:5601 to test if kibana is really working. If not working , go to etc/kibana/ to modify the config to check if host is 0.0.0.0 and port is 5601 And the other problem is that your server'memories are not enough for kibana starting. Hope you can provider the kibana log.try use:journalctl -u kibana.serv...
Jelastic Nginx http to https redirect
I have an account in Jelastic and I want to force my site to work only over https. I've created environment nginx + php with nginx balancer and enabled Jelastic SSL (as it describedhere).Whenever I tried to setup 301 redirect from http to https with no luck. Using mod_rewrite didn't work for me, the only thing I've got...
Indeed, when you are enabling Jelastic SSL (means you can't use public IP) shared resolvers processing all requests to your server but between resolver and your server requests are not https. So with redirect, you tried to set up, your server redirected incoming http requests to https and sent it back to resolver, as r...
Securing a Docker container with HTTP BASIC AUTH
Consider running a Docker container with a web application exposing a certain port. How to apply the additional security layer before accessing the URL (HTTP BASIC AUTH)?Docker Engine version >= 1.9.1
Typically, you dedicate a container for authentication, with for instance NGiNX.This is described in "Authenticating proxy with nginx", which not only adds the basic authentication, but also ssl (https)That web server will then reverse proxy to your container.You have a more generic solution (based on a reverse-proxy N...
NGINX proxy_pass not caching content
I'm having issues getting NGINX to cache thumbnails that I'm pulling from Dropbox using the proxy_pass command. On the same server that NGINX is running I run the following command multiple timeswget --server-response --spider http://localhost:8181/1/thumbnails/auto/test.jpg?access_token=123and get the exact same res...
Turns out that thumbnail requests returned from Dropbox include the headerCache-Control: no-cacheand Nginx will adhere to these headersunless they are explicitly ignoredwhich can be done by simply using the following config line that will ignore any caching control.proxy_ignore_headers X-Accel-Expires Expires Cache-...
Laravel 5 - NGINX Server Config Issue with URL Query Strings
Laravel is not receiving any $_GET variables from the URL query string. The $_GET and Input::all() are empty.Example:example.app/ex/login.php?country=USThe "country=US" never shows up in my $_GET variableAfter much research and trying many different NGINX configurations, I can now only produce results when this exampl...
This is the sites-enabled NGINX server configuration that ended up working for me...server { listen 80; server_name registration.app; root /home/vagrant/Code/registration/public; charset utf-8; location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log ...
HHVM with Nginx fastcgi not working properly
I would like to use HHVM via Nginx. (Ubuntu 12.04.2 LTS, PHP 5.3.10)I've followed the steps mentioned here:http://www.hhvm.com/blog/1817/fastercgi-with-hhvmThis is how my Nginx setup looks:server { listen 80; server_name demo1.dev server_name_in_redirect off; root /var/www/demo1; ...
Everything looks right. Can you try usingphp-fpmwith the exact same ngingx config and see if it works? Maybe you have a directory permission issue or something. Also make sure you are actually starting thehhvm-fastcgiprocess using/etc/init.d/hhvm-fastcgi startand that nothing was listening on port 9000 before you ran t...
How do I clear fastcgi_cache with PHP?
Is there a built-in way to clear the Nginx fastcgi_cache with PHP? I know I can write a PHP script that goes through and manually deletes all the cache files, but that seems too much like a hack.
If you havefastcgi_cache_path /tmp/nginx keys_zone=myzone:8mjust callrm -Rf /tmp/nginx/*It's really as simple as this: When you want to clean the cache, clean the cache :) (That in this case is just a folder)
Nginx v Apache for high traffic sites
Wouldnginxbe a more suitable choice as a web server for high traffic websites?The site we will be building is an e-commerce site, if that makes a difference.I am really interested in the actual 'why' from a technical point of view either way. i.e., why wouldnginxbe a better choice for this type of site from a technica...
Martin,In general, Nginx is better for high-traffic sites due to its event-driven architecture. Rather than handling each request in a distinct thread, it uses non-blocking I/O to service many requests in each thread.The important aspect of this architecture is the reduced use of processes or threads. A thread can co...
How dangerous is Django's built in test server when run remotely?
Concerning the built in debugging server started with themanage.py runservercommand, the Django docs state, "DON’T use this server in anything resembling a production environment."If I wanted to develop a Django application over ssh on a remote machine, would using Nginx as a proxy to a running Django debug server be a...
Fromthe Django docs:DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that's how it's gonna stay. We're in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope ...
Regex to block url in nginx
I want to block access to urls that have excess characters at its end.E.g. I want nginx to block requests tohttps://www.example.com/url-pattern/amp/extra-chars/more-extrabut want it to allowhttps://www.example.com/url-pattern/amporhttps://www.example.com/url-pattern/amp/Will this work?location .*\/amp\/. { deny all ...
Solved it myself. If anyone is looking for the same solutionlocation ~* /amp/. { deny all; }
Configuring nginx client_max_body_size on Elastic Beanstalk Node
I have a Node 10 app running on Elastic Beanstalk, and it throws 413 errors when the request payload is larger than ~1MB. 413 Request Entity Too Large 413 Request Entity Too Large nginx/1.16.1 The request is not hitting my app at all; it's being rejected by nginx.I have tried configuring AWS to increase the size...
Thenginxsetting you are trying to use (/etc/nginx/conf.d/proxy.conf) is forAmazon Linux 1.Since you are usingAmazon Linux 2you should be using different files for setting nginx. For AL2, the nginx settings should be in.platform/nginx/conf.d/, not in.ebextentionsas shown in thedocs.Therefore, you could have the followin...
Define specific cache control header for selected file only
I'm setting up a Nginx sever (version 1.17.1) for Gatsby following up the recommendation athttps://www.gatsbyjs.org/docs/caching/.The snippet below is the portion myserver {}block attempting implementing the recommended caching configuration;location ~* \.(?:html)$ { add_header Cache-Control "public, max-age=0, mus...
The order of precedence oflocationis described herehttps://nginx.org/en/docs/http/ngx_http_core_module.html#locationWhen an exact match is found (using the=modifier) the search terminates and regular expressions will not be checked, so you can use that for yoursw.js:location = /sw.js { add_header Cache-Control "pub...
open() "" failed (2: No such file or directory)
When I request a linkhttp://abc.example.com/images/default-thumbnail.jpga 404 error occurs while seeing the log file output[error] 1244#0: *1 open() "/tmp/upload-dir/images/default-thumbnail.jpg" failed (2: No such file or directory),But in fact this file is there,And the authority is 777[root@localhost nginx]# ll /tmp...
As Terrence said: Nginx alias path Cannot be a temporary path. eg:/tmp/**
How to expose ports only within the docker network?
I have a few apps running in a Docker network with their ports (3000,4200, etc) exposed. I also have an nginx container running within the same Docker network which hosts these apps on port80with different domain names (site1.com,site2.com).But right now if I go directly to the ports the apps are running on (localhost:...
But right now if I go directly to the ports the apps are running on (localhost:3000) I can access them that way too.Thats because you are using-paka--publishcommand in yourdocker runExplanation:If you want to expose ports between containers only, Do Not use-por--publishjust put them on the same docker network.Example...
why does nginx fail to start?
Yet starting nginx fails and my log shows:[emerg] 55#55: "server" directive is not allowed here in /etc/nginx/nginx.conf:1What am I doing wrong? Not sure if it matters but this is inside a docker container.
/etc/nginx/nginx.confis not the place to store your server setups. This file should contain information on the user it will run under and other global settings. Typically it will contain stuff like this:user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; } http { sendfile o...
How to do HTTP request logging as a means of troubleshooting login errors
I develop and maintain a paywalled publication with 2000+ users. The most common support request relates to log in. Most times these can be solved with a couple of support emails. Every once in a while though, there's that odd user that just can't log in. As a last resort the support person resets the users password, v...
I think the best option is to use a suite of Logstash (event collecting) + Elasticsearch (event storage) + Kibana (analytics). All three are really good opensource projects with a lot of documentation and very active communities.And if you need commercial support for any you can request help from:http://www.elasticsear...
URL Rewrite is not working in Nginx
URL rewrite is not working in Nginx and operating system is Ubuntu 12.4 Ltswhen openhttp://mvc.locit is working but when i try to openhttp://mvc.loc/loginNot working404 Not Foundnginx/1.1.19.htaccess ErrorDocument 500 "mod_rewrite must be enabled" RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond...
location / { rewrite ^(.*)$ /index.php?u=$1 last; }
Setting up read-only http access to git repo
how can I have a remote git repo which is accessible via httpbut only for cloning? Maybe with the help of nginx (already running) andgit-http-backend(git-http-fetch?).
NOTE: I assume that you meant anonymous read-only access; there is no way to distinguish between clone and fetch in git, I think.Do you want to set up "smart" HTTP (recommended), or "dumb" HTTP one?For "dumb" HTTP it is enough to forbid (or just do not set up) WebDAV - this is how pushes come with "dumb" HTTP (no git o...
Django keeps changing URL from http://localhost/ to http://127.0.0.1:8080/
As the title described, Django keeps changing my URL from/localhost/to/127.0.0.1:8080/which keeps messing up my serving static files by Nginx. Any ideas why its doing this? Thanks!/**EDIT**/ Here is the Nginx configuration:server { listen 80; ## listen for ipv4 listen [::]:80 default ipv6only=on; ## listen...
edit2:http://wiki.nginx.org/HttpProxyModule#proxy_redirecthttp://wiki.nginx.org/HttpProxyModule#proxy_passWhat I think is happening is when you use yourhttpresponseredirect, theHTTP_HOSTheader is giving it the127.0.0.1:8080, because of yourproxy_passsetting.Django's HttpResponseRedirect seems to strip off my subdomain?...
Blazor WASM styling missing when hosted in docker using nginx
I have a strange issue, where my styling is broken when I try to host my blazor WASM project using Nginx. I tried to follow a couple of different guides and they were similar and had same issue for me.I have the code here:https://github.com/TopSwagCode/Dotnet.IdentityServer/tree/master/src/BlazorClientWhen I debug loca...
After way to long time spending debugging this issue, I finally got it working. I found this project:https://github.com/waelkdouh/DockerizedClientSideBlazor/and started comparing. Only thing different I could see, what he had a .dockerignore I made a copy of it and it all started working. Have no idea what was the issu...
client intended to send too large body EB Nginx
I'm trying to increase the size of uploadable files to the server. However it seems there's a cap that prevents anything over 1MB of being uploaded.I've read a lot of answers and none have worked for me.I've done everything in this questionStackoverflow questionI did everything here as well.AWS resourceHere's what I ha...
Update:Beanstalk on Amazon Linux 2 AMI has a little different path for NGINX config extensions:.platform/nginx/conf.dThere you can place NGINX config extension files with*.confextension, for example:.platform/nginx/conf.d/upload_size.conf:client_max_body_size 20M;Documentation for this ishere.Original answer:Nginx norm...
Install nginx on an existing asp.net core docker container
I'm currently running a docker container for an ASP.NET Core WebAPI project. This web service is currently exposed on port 80.My dockerfile looks like this:FROM microsoft/dotnet:2.1-aspnetcore-runtime ARG source WORKDIR /app EXPOSE 80 COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", "testapi.dll"]I'd like to ...
The Docker way to do this would be to have two containers for the two services. Docker-compose is a tool that helps manage multi-container applications.The following docker-compose.yml should work for you:version: '3' services: app: build: context: ./dotnet dockerfile: Dockerfile expose: - ...
How to set DOCUMENT_ROOT and SCRIPT_NAME correctly for fcgiwrap
I've got a simple script cpuinfo.sh that works and is executable.I'm getting an error*224 FastCGI sent in stderr: "Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?" while reading response header from upstream, client: 86.44.146.39, server: staging.example....
I discovered that DOCUMENT_ROOT can not be reset. I normally have scripts directories away from publicly accessible paths. I knew that the scripts directory was the same level the web directory so I tried.location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ { gzip off; autoindex on; fastcgi_pass unix:/var/run/fcgiwrap....
Create custom pages on Ghost
I'm looking to add some more .hbs files to ghost/custom/themes/casper, such as an about page and landing page. This way, all files are using the same default layout and I have a /blog destination for my blog.However, when I create an .hbs file, such as about.hbs, and give it the same code as in page.hbs, and upload it ...
Create the page with the specific slug in the Ghost backend.Create the.hbs-file named like this:page-about.hbs.FromGhost Documentation on custom pages:For example, if you have an 'About' page with the url/about/, adding a template calledpage-about.hbswill cause that template to be used for the about page, instead ofpag...
502 Bad Gateway nginx (1.9.7) in Homestead [ Laravel 5 ]
Did google and various other search engines but still could not sort it out. Here is my scenario:Larave 5 on homestead1)ps -eo pid,comm,euser,supgrp | grep nginx[following is the output ]2333 nginx root root 2335 nginx vagrant adm,cdrom,sudo,dip,www-data,plugdev,lpadmin,sambashare,vagrant2)...
Finally solved thishere. I want to thank Miguel from laracast discussion.You need to change your configuration file under:/etc/nginx/sites-enabledchange linefastcgi_passforfastcgi_pass unix:/run/php/php7.0-fpm.sock;php7.0-fpm.sockis located under:/var/run/phpSince the new VM uses php 7.* and your configuration file mig...
Nginx proxy_pass doesn't work on port 80
I am using a DigitalOcean VPS hosting a meteor app. I don't have a domain name yet, so just use the plain IP address. When I set below config and usemyipaddress:3000andmyipaddress:8080, both of them worked well; but if I change the 8080 to 80, onlymyipaddress:3000works. Using onlymyipaddressormyipaddress:80will show "W...
You probably still have the default.conf still in the directory that nginx is using to serve up the sites. either that or check in nginx.conf. Somewhere there is a server setup already using 80 that is being served first.
Nginx - Different proxy pass based on IP ranges
I've got a case where I need to do a different proxy pass in Nginx depending on which CIDR the client's IP address is part of.So, for example, let's say I have the following CIDRs:10.50.0.0/16 10.51.0.0/16 10.52.0.0/16Each of those client addresses needs to have a different proxy_pass in Nginx. How would I go about...
You could useGeo module. Your configuration then would look somewhat like this:geo $upstream { default default_upstream; 10.50.0.0/16 some_upstream; 10.51.0.0/16 another_upstream; } upstream default_upstream { server 192.168.0.1:80; } upstream some_upstream { server 192.168.0.2:80; } upstream a...
Show image with Express, instead of downloading it
Asimple serverI'm working can serve images. When browsing to the image URL directly, Chrome offers to download the image, rather than just showing it in the browser. Why is that? Presumably it is something in the headers?The relevant code is this:tilestore.getTile(req.param("z"), req.param("x"), req.param("y"), functio...
Ok, it's easy. Just set thecontent-type:if (!err) { res.contentType('image/png'); res.send(tile); } else { res.send("Tile rendering error: " + err + "\n"); }These images are always.png.New headers:HTTP/1.1 200 OK Server: nginx/1.4.6 (Ubuntu) Date: Mon, 01 Sep 2014 07:33:22 GMT Content-Type: image/png Co...
Increase buffer timeout size on nginx
I have a nodejs program that connects to cloudstack apis. Creating a Virtual Machine on cloudstack takes almost 20 secs.The program works fine on my local nodejs installation and also on apigee cloud. However when I deploy the same on customer's OPDK, Nginx returns a 502 - Bad gateway. This linkhttp://www.nginxtips.com...
You may need to look at the proxy timeout configs in nginx if using nginx as a proxy:http://www.nginxtips.com/504-gateway-time-out-using-nginx/http://wiki.nginx.org/HttpProxyModuleproxy_connect_timeout 60; proxy_read_timeout 120;Apigee timeout defaults:Connect timeout - 60s -connect.timeout.millisRead t...
Tornado SSL certs
I have a question about tornado SSL configuration. I wanna handle HTTPS protocol. I also read docs and stackoverflow same issues. I have a SSL certificate & key files. Code looks likesettings = dict( ... ssl_options = { "certfile": os.path.join("certs/myserver.crt"), "keyfile": os.path.join("cer...
You are passing the settings totornado.web.Application()instead oftornado.httpserver.HTTPServerTry this,settings = dict( ... ssl_options = { "certfile": os.path.join("certs/myserver.crt"), "keyfile": os.path.join("certs/myserver.key"), }, ... ) def main(): http_server = tornado.https...
Express.js (Node.js): How does static file serving really work?
I thought serving static files (html, mov, css, jpg, etc.) with Express was going to require some hacks in nginx.But it seems that static files "just work" with Express. No special thing is required.How does Express static file serving really work?Why do some people advocate using nginx for static files? There must be ...
If the url does not belong to any paths that you registered viaapp.get(/...(or POST etc.) methods, Express sends the file if the static path is set and the path that you give belongs to some files path under static files directory. File sending is nothing more thanstreams, they do not block the event queue completely, ...
How to connect nginx to my java module
I am a really beginner on this topic, I need some helpful articles and your guidance. I want to buildRESTFulAPI web service. As a http server chosennginx. But I don't know (couldnt find any article) anything about how I can redirect my query to my java module, which handles request and gives back inJSONtonginx. If my t...
You will need to build your Java service in its own app server -- Tomcat would be a good choice for this. From there, it's a simple matter of configuringnginxto act as a proxy to Tomcat. Yournginxconfiguration will look something like the following:user www-data; worker_processes 4; pid /var/run/nginx.pid; events { ...
Rails/Nginx not serving JS and CSS
I deployed a Rails 3.2.8 application via Capistrano, with asset pipeline enabled, to my Linode server.It is running nginx + unicorn.When I visit my application, the minimised JS and CSS are not being served, although the assets are present in/public/assets.$ tree assets assets |-- application-66e477d6fd8cf088e8be44affe...
location ^~ /assets/should belocation ~ ^/assets/.The former isdoes not match /assets/, the latter ismatches a pattern that starts with /assets/Update your nginx config to get caching and pre-gzipped file serving working again.