Prompt stringlengths 14 160 | Instruction stringlengths 18 2k | Response stringlengths 8 2k |
|---|---|---|
3rd Party Script Caching in Rails 3.1 | I have a script 3rd party websites are using:/assets/script.js. For obvious reasons, I can't ask them to change the link every time I deploy to point to the latest fingerprinted version of the script. I got a few caching issues where users still see old versions of/script.js. Are there any ways to make the cache go awa... | If you have a script with a name that is part of your public interface then you need to start versioning this script explicitly, and keeping old versions around for older clients.e.g. /assets/script.1.0.js, /assets/script.1.1.js etcThe key part is that you need to be keeping the old ones around, and the code doesn't ch... |
vue-router, nginx and direct link | I'm trying to setup a vue-router on my nginx server. The issue I'm having is that my route doesn't work if I enter url directly to the browsermyapp.com/mypath.I've tried server configuration as described in thevue router docsas well as suggested similar configurations on stack overflow. My current nginx location config... | I've found 1 possible solution with the suggestion from a co-worker.I'm now passing URI as a query parameter in nginx. So my config is now this:location / {
try_files $uri $uri/ /index.html?uri=$uri
}Then in my router configuration in VueJS:const routes = [
{
path: '/',
component: Landing,
beforeEnter: ... |
Why does running Flask with Nginx require a WSGI wrapper? | So from the Python/Flask docs, they both recommend not running the Flask web server as the production web server which makes sense. My question is, am I then able to run my Flask application on top of an Nginx server? Why do all the guides on the internet recommend wrapping Flask around uWSGI, Tornado, or some other WS... | Nginx is a web server and is concerned with web server stuff, not with how to run Python programs. uWSGI is an application server and knows how to speak WSGI with Python (and other languages now). Both Nginx and uWSGI speak the uWSGI protocol, which is an efficient protocol over UNIX sockets.Nginx deals with http reque... |
How to run django with nginx on a windows machine? | I have a django project. I have installed nginx server. I want to run nginx along with django on windows machine. I have tried a few blogsNginx Django Uwsgi. But all of them required uwsgi. But the uwsgi is not installing on windows and gives "uname" error. Is there any way to install and run nginx and django on window... | Best way (IMHO) is using apache+mod_wsgi. Both uWSGI and Gunicorn are not windows-friendly (albeit uWSGI has cygwin support, so you can eventually try it [if you are brave enough]).Another approach would be installing a linux vm (virtualbox, vmware...) on the windows machine to host your application and proxy requests ... |
From apache to nginx: wordpress rewrite rule | I'm migrating from apache2 to nginx. I cant figure out how to to rewrite thisrewrite rulesfor wordpress.This is actually my configuration fileserver {
listen 80;
root /usr/share/nginx/blog.com/public_html;
index index.html index.htm index.php;
server_name blog.com www.blog.com;
... | You should readhttp://wiki.nginx.org/WordPresse.g.location /blog {
try_files $uri $uri/ /blog/index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(/blog)(/.*)$;
} |
How to run two commands on Dockerfile? | I have to execute two commands on the docker file, but both these commands are attached to the terminal and block the execution from the next.dockerfile:FROM sinet/nginx-node:latest
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
RUN git clone https://name:[email protected]/joaocromg/front-web-alferes.git
WORKDIR /usr/s... | I suggest you try supervisord in this case.http://supervisord.org/Edit: Here is an dockerized example of httpd and ssh daemon:https://riptutorial.com/docker/example/14132/dockerfile-plus-supervisord-conf |
How can I edit the NGINX configuration on Google App Engine flexible environment? | How can I edit the Google App EngineNGINXconfiguration?There doesn't seem to be much support in the Google docs in regards to the NGINX configuration for apps running in the Google App Engine flexible environment.My app is running fine, but I get this 413 error when I try and upload an audio file (.wav or .mp3).413 Req... | You should be able to create anginx-app.conffile in the same directory as your app.yaml file. There is an example of using the nginx configuration file in a Flex environment located here:https://github.com/GoogleCloudPlatform/getting-started-php/tree/master/4-auth.This same file is referenced in Google's documentation ... |
curl: (7) Failed to connect to localhost port 8090: Connection refused | Need help. Have been trying for a solution to this issue and could not see an answer or rather I have not come across any.I have a docker container with NGINX, acting as a reverse proxy. Docker for Windows version 1.12.5(9503).upstream mysite {
server 127.0.0.1:8090;
#server localhost:8090; (have also tried thi... | Inside a docker container thelocalhostand127.0.0.1refer to the container itself. In order to access the host machine running dockerd with your container you must refer to the host by its public hostname/IP as if it was another machine on the network. |
NGINX: How to setup multiple port in one server or domain name? | I am new to nginx. I am having trouble with my setup, I want my server to run with multiple port on public.For example:server {
listen 443 ssl;
server_name ;
ssl_certificate ;
ssl_certificate_key ;
location /tags.txt {
add_header 'Access-Control-Allow-Origin' '*';
}
}From the above setup I am now ... | You can have multiplelistendirectives perserver:server {
listen 5005 ssl;
listen 6006 ssl;
server_name ;
ssl_certificate ;
ssl_certificate_key ;
location /tags.txt {
add_header 'Access-Control-Allow-Origin' '*';
}
} |
What is the relationship between HTTP connection and a request? | While I am configuring my nginx, I found two modules:ngx_http_limit_conn_moduleandngx_http_limit_req_moduleone is for limiting connection per defined key, and one for limiting request.My question is what is the relationship (and difference) between
a HTTP connection and a request.
It seems that multiple HTTP requests c... | Basically connections are established to make requests using it. So for instance endpoint for given key may accept 5 connections per hour from given IP address. But it doesn't mean only 5 requests can be made but much more - if the connection is not closed after a request (from HTTP 1.1 it's by default kept alive).E.g.... |
Node Express Unix Domain Socket Permissions | I am running an nginx server and a node express web server, using daemontools, setup to communicate over Unix Domain Sockets. There's just a few problems:The socket file stays present on shutdown, so I have to delete it when bringing the server back up, otherwise I will get the EADDRINUSE error.The nginx server runs a... | Maybe I am too late.As a complement of your own answer there is a solution not having to add the nginx user to the node group.Create a directory only for the socket file, assign it to the node user and www-data (or whatever group the nginx is) group and set the group-id bit (SGID) on that directory.mkdir -p /var/lib/yo... |
Nginx add_header and cache control | When you use the add_header directive in nginx, the header is added to the response coming from the origin server.Say the origin server returns cache-control public, max-age=60. But in the nginx reverse proxy location you set something like:add_header cache-control public, max-age=10What does this do exactly? There are... | Nginx adds its header just before the origin server, so you will have:cache-control: public, max-age=10
cache-control: public, max-age=60and the origin header will replace the nginx header.The solution? Use nginx v1.4.3 that has the module more_set_headers and more_clear_headers in order to replace or clear the headers... |
which server side language nginx webserver supports | which server side language nginx webserver do support? For example apachi-tomcat is for java, wammp is for php. and secondly it is installed on my pc i need to know that how can i access it via http and in which do i need to put my applications | No language. It is primarily designed as a static and front-end proxy server.The server itself is written in C and supports C-compatible plug-ins, but the plug-in architecture is heavily geared towards interfacing with other servers on the back end, not to add, e.g., PHP support. |
how to connect nginx to php-fpm using unix socket in docker | There is my docker-compose.ymlversion: '2'
services:
web:
image: nginx:latest
ports:
- "8018:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/default.conf
- /private/var/log/nginx:/var/log/nginx
- /private/var/run/php7-f... | After I check theHow to set up Apache2 and PHP-FPM via unix socket?, I changed my docker-compose.yml toversion: '2'
services:
web:
image: nginx:latest
ports:
- "8018:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/default.conf
- /p... |
Nginx: you should increase server_names_hash_bucket_size: 32 - did this but no effect | When I runnginx -tI get errornginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32Then I go and update nginx.conf file, line server_names_hash_bucket_size to 32.Then I runservice nginx reloadThen run againnginx -tand I am getting the same error.Why it does not take ... | Setting to 64 does not throw this error anymore. Probably it was showing current value - 32 which was not enough. |
Nginx: Redirect non-www to www https | I have my below nginx config, I'm trying to redirect everything tohttps://wwwregardless of what comes in for examplehttp://example.com,http://www.example.comorhttps://example.com.I've looked at numerous topics on SO and tried a couple of things but still stumped, I can't ever gethttps://example.comto redirect to thehtt... | Make oneserverblock a default server and give the otherserverblock the one trueserver_name.server {
listen 80 default_server;
listen 443 ssl default_server;
ssl_certificate ...;
ssl_certificate_key ...;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl;
server_n... |
NGINX: serve ONLY specific file types in all directories | I need toonlyserve .vmdk and .vmx files on a virtual server, no matter what directory level. This is my current configuration (right now it serves all, but if I uncomment the lower part it serves nothing):server {
listen 80;
server_name vmdk;
access_log /var/log/nginx/localhost.access.log;
root /srv/... | This should workserver {
listen 80;
server_name vmdk;
access_log /var/log/nginx/localhost.access.log;
root /srv/vmdk/public;
location / {
deny all; # deny by default
location ~ "\.(vmdk|vmx)$" {
allow all; # allow vm disk images, ... |
NGINX: remove part of url permanantly | I have redesigned a website and changed the url formats too.
Now i need to change the old url to new one.Here is my old url:http://www.example.com/forum/showPost/2556/Urgent-ResposeThe new url will be:http://www.example.com/2556/Urgent-ResposeHow to redirect to new url using nginx by removing/forum/showPostfrom url?Edi... | server
{
listen 80; ## Listen on port 80 ##
server_name example.com; ## Domain Name ##
index index.html index.php; ## Set the index for site to use ##
charset utf-8; ## Set the charset ##
location ^~ /forum/showPost {
rewrite ^/forum/showPost(.*)$ $1 permanent;
}
location ^~ /busi... |
Nginx - Search for static content in multiple directories? | Because of the way that our git repos are setup I have some static content that might be in one directory - and other content that might be in another directory. How can I ask nginx to search in two places for a static file like a stylesheet?I originally thought that try_files had my answer - but I can't seem to get it... | location ~* ^/just_test/(.+)$ {
root /some/path/to/web/root;
try_files /just_test/1/$1 /just_test/2/$1 /just_test/3/$1 @missing;
} |
Automatically append docker container to upstream config of nginx load balancer | I'm running Docker Compose (v2) and have a node service (website) and python based api deployed with nginx sitting in front of them.One thing I would like to do is be able to scale the services by adding more containers. If I know ahead of time how many containers I will have, I can hardcode the nginx upstream config w... | There are a couple ways to achieve this. What you are referring to is usually calledservice discoveryand comes in many forms. I'll describe two of them that I have used before.The first and simplest one (which works fine for single servers or only discovering containers locally on one server) is a local proxy which mak... |
How can I host multiple Rails apps with nginx and Unicorn? | How can I host multiple Rails apps with nginx and Unicorn?I currently have one site up and running thanks to "Deploying to a VPS".I have searched but I need a step-by-step guide to get this working. The results I found are not so well explained to help me understand how to accomplish this. | Basically, you do the same thing you did to get everything for your first application running minus the Nginx installation. So, however you got your Unicorn instance for your first application running, do it again for your next application.You can then just add another server block into your Nginx config with an upstre... |
Change PHP version used by Composer on Windows | I have already use WAMP 2.5 with PHP 5.5.12, and with Composer.
The php is on:C:\wamp\bin\php\php5.5.12For new project, I need to use nginx and installed PHP 7.
The php is on:C:\nginx\phpNow, using GitBash MINGW32, I tried to install laravel 5.3 using Composercreate-projectbut it said[InvalidArgumentException]
Could no... | Three ways to do this, really.Create an alias in.bashrcto always run composer with the corresponding versionSomething likealias ncomposer=`/path/to/php /path/to/composer.phar `Specify the path to PHP version insidecomposer.pharitselfThis is specified at the start of the file:#!/path/to/php php. Then composer should run... |
Can't access docker container on port 80 on OSX | In my current job we have development environment made with docker-compose.
One container is nginx, which provide routing to other containers.
Everything seems fine and work to my colleague on windows and osx. But on my system (osx El Capitan), there is problem with accessing nginx container on port 80.There is setup o... | Solved!Problem was, that long long time ago I installed pow (super simple automated rails server which run application on app_name.local domain). And this beast left LaunchAgent script which updatepfto forward port 80 to pow port. |
how does nginx picks a resolver when there are multiple defined? | How does nginx picks a resolver if you define several like:...
resolver 108.x.x.x 120.x.x.x 19.x.x.x valid=30s;
...Is it in a round-robin fashion? or there is some failover logic in there? | According to the nginx documenthttp://nginx.org/en/docs/http/ngx_http_core_module.html#resolverName servers are queried in a round-robin fashion.They are using RR. |
PM2 and Nginx: 502 Bad Gateway | I've been trying to deploy my Node project on a brand new DO droplet, but i'm having some problems with PM2.My steps are a follows:Node came installed on the Droplet image (Ubuntu, Node v4.4.4)Installed PM2 globallySetup Nginx to reverse proxy 127.0.0.1:3000Cloned my project and did npm installAll i get is Nginx compla... | I just had to start PM2 withbin/wwwinstead ofapp.js. Express generator and everything... |
Patching Nginx to ip_hash 4 octets instead of 3 | I'm currently running two back end servers on my network and load balancing with Nginx on Windows.I am load testing the system at the moment however all of my traffic is directed at one server. This is because the ip_hash algorithm sorts traffics by the first 3 octets i.e. 111.222.333.XXXThis is a problem because all o... | Nginx open source version supports thehashdirective that may work similarly (not exactly the same though) to the sticky session mechanism provided by commercial version:The generic hash method: the server to which a request is sent is
determined from a user-defined key which may be a text, variable, or
their combin... |
How to comment out multiple lines in a Linux config file? | Given:codein/etc/nginx/sites-available/mySite.conf. We know that#Codemeans it will get ignored. But how if I want to comment out:Code
Code
Code
Codewithout using#? I have people see use'''in python to comment out multiple lines. Does this work for Linux config files as well? | There's no standard "Linux config file" -- the syntax is totally dependent on what program is reading the file and how that program is parsing it.Nginx recognizes only lines beginning with#as comments.http://nginx.org/en/docs/beginners_guide.html#conf_structure |
lookahead regex in nginx location | I'm trying to match/category/anything, except/category/paidin nginx location.I have the following regex, but it's not working. Google tells me that I can use lookahead in nginx. Am I doing something wrong?location ^/category(?!/paid)/ {
} | You either need a slash before it or an escaped slash.location ~ (category/(?!paid)) { .. }
location ~ (category\/(?!paid)) { .. } |
Nginx - Redirect domain to localhost:port content | I installed Nginx on my server (my server uses WHM). And on this server has two accounts. Each account will run a server a NextJS site and each account has its own domain.Site1will run on port 3000Site2will run on port 3004What I want to do is:I want to accessdomain1I see the content of mysite1in NextJS that runs onloc... | Tryupstream app1_server {
server app1:8501;
}
upstream app2_server {
server app2:8501;
}
server {
listen 80;
listen [::]:80;
server_name trace.devops.rightsense.ai;
location / {
proxy_pass http://app1_server;
proxy_set_header Host $host;
proxy_set_header ... |
Can kubernetes Ingress Nginx be autoscaled? | When the Ingress Nginx controller reach its full capacity does it auto scale?
Is Kubernetes Ingress even scalable? | In principle, the NGINX ingress controller is indeed scalable -- it pulls its entire configuration from the Kubernetes API server and is in itself basically stateless.In practice, this depends very much on how your ingress controller is set up. First of all, the ingress controller will not auto-scale by itself. If you ... |
How to redirect HTTP to HTTPS with Nginx Ingress Controller, AWS NLB and TLS certificate managed by AWS Certificate Manager? | I've tried the following to get HTTP to redirect to HTTPS. I'm not sure where I'm going wrong.ingress-nginxobject:apiVersion: v1
kind: Service
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
annotations:
se... | I believe you do need to move the SSL termination to the ingress controller because I am having the same issue and I appear to be in a permanent redirect situation. The traffic comes into the NLB on 443 and is terminated and sends to the backend instances over port 80. The ingress sees the traffic on port 80 and redire... |
How to enable h2c in Nginx? | Is there a way to enable h2c aka HTTP2 cleartext in Nginx 1.9.5 onward?I've tried using h2 over TLs inhttps://chronic101.xyzand it works, however I would like to implement h2c on port 80 as well.Thanks,chrone | It should be as simple as addinghttp2in the end of yourlistendirective.Example:server {
listen 80 http2;However, keep in mind that most browsers do not support unencrypted HTTP/2, and so will still serve content as HTTP/1.1. |
Doing SSL client authentication in python | OK, I am trying to use client certificates to authenticate a python client to an Nginx server. Here is what I tried so far:Created a local CAopenssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crtCreated server key and certificateopenssl genrsa -des3 -out server.key 1024
openssl r... | It seems that my problem was that I did not create the CA properly and wasn't signing keys the right way. A CA cert needs to be signed and if you pretend to be top level CA you self-sign your CA cert.openssl req -new -newkey rsa:2048 -keyout ca.key -out ca.pem
openssl ca -create_serial -out cacert.pem -days 365 -keyfil... |
Upload large file nginx + uwsgi | stack: flask 0.10 + uwsgi 1.4.5 + nginx 1.2.3I can upload small files (<100k) through my application but larger ones fail.
uwsgi log shows:Invalid (too big) CONTENT_LENGTH. skip.nginx log does not show anything useful.I tried the following, without success:[nginx conf] client_max_body_size 0 or 20M[uwsgi conf] limit-po... | Your problem in uwsgilimit-postparams. Look atsource. This variable can be overridden by other configs. For example on debian config from/usr/share/uwsgi/conf/default.iniare also loaded. |
Multiple server processes using nginx and uWSGI | I've noticed that you can start multiple processes within one uWSGI instance behind nginx:uwsgi --processes 4 --socket /tmp/uwsgi.sockOr you can start multiple uWSGI instances on different sockets and load balance between them using nginx:upstream my_servers {
server unix:///tmp.uwsgi1.sock;
server unix:///tmp.... | The difference is that in the case of uWSGI there is no "real" load balancing. The first free process will always respond, so this approach is way better than having nginx load balacing between multiple instances (this is obviously true only for local instances). What you need to take in account is the "thundering herd... |
How to use Porkbun SSL Certificate Files with Nginx? | I'm trying to figure out how to use the Porkbun Let's Encrypt Files with Nginx.They have generated a zip file with the following files for me to usedomain.cert.pem,intermediate.cert.pem,private.key.pem,public.key.pemFrom this sitehttps://wbxpress.net/install-porkbun-ssl-nginx-wordpress/I've worked out thatssl_certifica... | If you used the certbot you will get these files:READMEcert.pemchain.pemfullchain.pemprivkey.pemssl_certificateshould point tofullchain.pemssl_certificate_keyshould point toprivkey.pemssl_trusted_certificateshould point tochain.pemFrom what I see, the PorkBun generated files are just renamed and mapped like this:fullch... |
gunicorn does not start after boot | I'm running a Debian web server with nginx and gunicorn running a django app. I've got everything up and running just fine but after rebooting the server I get a 502 bad gateway error. I've traced the issue back to gunicorn being inactive after the reboot. If I start the service the problem is fixed until I reboot the ... | You have a small typo in yourgunicorn.servicefile. Change to:WantedBy=multi-user.targetAlso, you may want to change to:Restart=always |
Running a Spring Boot app behind nginx | I have a Spring Boot + MVC app up and running on my server and it's bound tohttp://localhost:8000.There is an nginx proxy (or is it a reverse proxy, not sure about the name) that listens to the outside world on ports 80 and 443. The root ( / ) will resolve correctly, but anything under it will not resolve and results i... | You can't combineproxy_passwithtry_filesin the way that you have attempted. As the comment in your configuration describes, thetry_filesdirective causes nginx to look for a file that matches the URI and then look for a directory that matches the URI. If it doesn't find either, it responds with a 404. You can read more ... |
How to loop over array containing template variables with ansible? | I'm setting up an automated provisioning process for a webserver using Ansible. For this, I have an array containing dictionaries with vhosts to setup:vhosts:
-
name: 'vhost1'
server_name: 'domain1.com'
-
name: 'vhost2'
server_name: 'domain2.com'I prepared a template with some generic nginx vhost co... | turns out that the code above works absolutly perfect. there was another problem in my variables YAML file. |
Nginx reverse proxy - passthrough basic authenication | I am trying to setup nginx as a reverse rpoxy server in front off several IIS web servers who are authenticating using Basic authentication.(note - this is not the same asnginx providing the auth using a password file- it should just be marshelling everythnig between the browser/server)Its working kind off - but gettin... | This exact situation took me forever to figure out, but OSS is like that I guess. This post is a year old so maybe the original poster figured it out, or gave up?Anyway, the problem for me at least was caused by a few things:IIS expects the realm string to be the same as what it sent to Nginx, but if your Nginx server... |
Using CherryPy/Cherryd to launch multiple Flask instances | Per suggestions on SO/SF and other sites, I am using CherryPy as the WSGI server to launch multiple instances of a Python web server I built with Flask. Each instance runs on its own port and sits behind Nginx. I should note that the below does work for me, but I'm troubled that I have gone about things the wrong way... | I can't speak for Flask, but I can for CherryPy. That looks like the "proper way"...mostly. That line about a MethodDispatcher is a no-op since it only affects CherryPy Applications, and you don't appear to have mounted any (just a single Flask app instead).Regarding point 3, you have it right. CherryPy allows you to r... |
Running jasperserver behind nginx: Potential CSRF attack | We are using nginx for https traffic offloading, proxying to a locally installed jasperserver (5.2) running on port 8080.internet ---(https/443)---> nginx ---(http/8080)---> tomcat/jasperserverWhen accessing the jasperserver directly on its port everything is fine. When accessing the service through nginx some function... | Answered it myself - hopefully this is of some use to others,too |
My nginx + fastcgi configuration downloads php files instead of executing them | I'm using this configuration on a fresh install of php5-fpm and nginx on ubuntu 13.04:server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri ... | Your php code is being displayed directly because it's not being sent to the php engine, that means the location block is being matched and the php file is being served, but the php file isn't being captured by the php block, so your problem is in the php block.In that block you have 2fastcgi_pass, one with a port (900... |
How to configure Nginx behind a corporate proxy | Is there an equivalent of Apache'sProxyRemotedirective for NginX?So the scenario is I am behind a corporate proxy and I want to do proxy passes for various services with NginX. I would do it in Apache with the following:ProxyPass /localStackOverflow/ https://stackoverflow.com/
ProxyPassReverse /localStackOverflo... | The servers you proxy behind an Nginx front-end web server are referred to as upstream servers. You will want to refer to the documentation for theHttpUpstreamModule. It's very similair to what you are familiar with. If you don't need load-balancing, you just setup the one upstream server in the configuration and it wi... |
Making a POST request to an external URL from a django + gunicorn + nginx setup | I am sending a post request from a method inside a web application running on django+nginx+gunicorn. I have no issues receiving 200 response from the same code when executed on django's own server (using runserver).try:
response = requests.post(post_url, data=some_data)
if response.status_code == OK and respons... | In my gunicorn settings, settingworkers=2solved this issue.When I was sending a request to the external URL, the external application would send a request back. This new request would occupy the one and only worker in the application. The original request that I sent out is workerless, and so it get's stuck.
With 2 wor... |
nginx reverse proxy to a set of pages with an additional path in the URL based on http referer? | I have a 3rd-party ui server running in a docker container, exposed on port 8080.It seems to expect to load resources with an absolute path:http://localhost:8080/index.html,http://localhost:8080/js/some_jsfilesetc.I want to create a reverse proxy to it so it looks like it is coming from a different path:https://myserve... | I was having similar issues while setting up nginx reverse proxy forStorm-UIAfter digging for sometime, I got it working.server {
listen 80;
server_name example.com;
location ^~ /css/ {
rewrite /(.*) /storm-ui/$1;
}
location ^~ /js/ {
rewrite /(.*) /storm-ui/$1;
}
locat... |
Server Sent Events and Rails Streaming | I'm experimenting with Rails 4ActionController::Liveand Server Sent Events. I'm using MRI 2.0.0 and Puma.For what I can see, each connected client keeps an active connection to the server. I was wondering if it is possible to leverage SSEs without keeping all response streams running.Puma manages multiple connections u... | The way that SSEs are built is by the client opening a connection to the server, which is then left open until the server has some data to send. This is part of the SSE spec, and not a thing specific to ActionController::Live. It's effectively the same as long-polling, but with the connection not being closed after the... |
uninstalling nginx? | I've gone pretty badly wrong and I want to just uninstall and then reinstall a fresh copy to start over.I've tried#sudo apt-get nginx uninstallthat didn't work as well ascd /usr/local/src
wget http://nginxcp.com/nginxadmin2.3-stable.tar
tar xf nginxadmin2.3-stable.tar
cd publicnginx
./nginxinstaller uninstallwith no lu... | To get rid of everything nginx related (configs etc.) do:sudo apt-get purge nginx |
Can not access nginx container on a local windows machine | I'm running an nginx container on a windows 10 machine. I've stripped it down to a bare minimum - an nginx image provided in the Docker hub. I'm running it using:docker run --name ng -d -P nginxThis is the output ofdocker ps:b5411ff47ca6 nginx "nginx -g 'daemon off" 22 seconds ago Up 21 seco... | On windows, you are using Docker Toolbox, and the IP you need is192.168.99.100(which is the IP of the Docker Toolbox VM). The IP you got is the IP of the containerinsidethe VM, which is not accessible directly from Windows. |
Jenkins/Nginx - Double prompted for basic auth, why? Why is there an internal Jenkins auth? | Below is my nginx configuration file for Jenkins. Most of it is exactly as per I've read in the documentation.Config file:upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name sub.mydomain.net;
location ^~ /jenkins/ {
pro... | Found the solution to my issue by searching for Nginx used as a reverse proxy for any other application with basic_auth.Solution was the answer found here:https://serverfault.com/questions/511846/basic-auth-for-a-tomcat-app-jira-with-nginx-as-reverse-proxyThe line I was missing from my nginx configuration was:# Don't f... |
How to benchmark apache/nginx setup | I am planning to setup nginx as reverse proxy. I will have apache to deliver my dynamic content, and nginx will deliver the static content.My configuration i have now is just Apache with fastCGI. This gives me no configuration problems and runs great.After I have set up nginx I want to run some benchmarks to see if I r... | Better solution?Siege.More accurate benchmarking tool than ab |
RabbitMQ connection through Nginx | I am trying to setup rabbitmq it can be accessed externally (from non-localhost) through nginx.nginx-rabbitmq.conf:server {
listen 5672;
server_name x.x.x.x;
location / {
proxy_pass http://localhost:55672/;
}
}rabbitmq.conf:[
{rabbit,
[
{tcp_listeners, [{"127.0.0.1", 55672}]}
]
}... | You have configured nginx as an HTTP reverse proxy, however rabbitmq is configured to use the AMQP protocol (see description of tcp_listeners athttps://www.rabbitmq.com/configure.html)In order for nginx to do anything meaningful you will need to reconfigure rabbitmq to use HTTP - for examplehttp://www.rabbitmq.com/web-... |
Nginx wont leave! how to remove it [closed] | Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed11 years ago.Improve this questionI've run nginx once and now I cannot get rid of it. when I run apache on my server localhost still point to that welcome to n... | To kill nginx process.If you are sure nginx is actually running, You just need to killnginx.exeprocess and re-runapache.OpenRun(Window key + R) ORcommend prompt(cmd.exe) and Paste below command,taskkill /F /IM nginx.exeTo find which process is holding port 80.Here isnetstatcommand & output to find which process is hold... |
Why doesn't Chrome browser recognize my http2 server? | I setup my Nginx conf as perDigital Ocean paper,
and now http2 is available.But in Chrome (Version 54.0.2840.98 (64-bit)) Dev tool, it's always on HTTP 1/1:NAME METHOD STATUS PROTOCOL
shell.js?v=xx.. GET 200 http/1/1My server is running Ubuntu 16.04 LTS which supports both ALPN & NPN, and the o... | Will likely be one of two reasons:You are using anti-virus software and it is MITM your traffic and so downgrading you to HTTP/1.1. Turn off https traffic monitoring on your AV to connect directly to the server. You can check if this is the case by usingan online tool to test your site for HTTP/2 support.You are using ... |
nginx conf /w multiple map(s) to same variable | we have a multisite set-up and need to map domains and domains/subfolders to a variable. This way the programming knows which version to load.We have stores that have separate domains and that can be captured by$http_hostbut also domain.com/-string-locale-here- and are captured by$http_host$uriand a match commandSomeho... | Whendefaultis not specified in a map block, the default resulting value will be an empty string. So, in your case, whatever value$storecodeis set with in the first map block, it is replaced with an empty string in the second one.Since map variables are evaluated when they are used, you cannot set$storecodeas the defaul... |
Cannot change upload_max_filesize or post_max_size in php.ini | Bear in mind, I am no sysadmin, I am just a developer. I cannot find anyone with theexactproblem as me, just similar, and none of their "fixes" seem to work.I am currently running an Amazon EC2 instance running.CentOS 6.2
Nginx 1.2.2
PHP 5.3.16 with APC
Percona 5.5.24 // not currently using this as I am using an RDSI h... | I got in contact with the guys who made the AMI and found out there are additional configuration files that override thephp.iniThere are 2 files which hold settings/etc/php-fpm.d/www.conf // This is the file which holds upload_max_filesize and post_max_size, among others
/etc/php-fpm.confObviously the locations may dif... |
multiple rails apps on nginx and unicorn | I successfully setup a rails site using the Screencast 335 deploy to a VPS tutorial. Now I want to add another rails app on a new domain but I am confused about the steps required.In the above setup, there are no changes to sites-available or /etc/nginx/nginx.conf. The only configuration is in unicorn.rb, unicorn_init.... | It is really easy to host different apps on one host with Nginx and Unicorn.The separation you can get by defining different names of thesocketfiles of each application. Of course you should point the rightcurrent/publicdirectories in theserversection ofnginx.conf.The last touch is in theunicorn_init.shfile: on the top... |
nginx subdomain and domain rewrite w proxy pass | I need these two types of rewrites:subdomain.domain.com => domain.com/website/subdomainotherdomain.com => domain.com/userdomain/otherdomain.comMy problem is that I want the user to seesubdomain.domain.com, andotherdomain.com, not the redirected version. My current rewrite in nginx works, but the user's URL shows the re... | With nginx you don't need rewrites at all.upstream domain_server { server localhost:8000 fail_timeout=0; }
proxy_set_header Host domain.com;
proxy_set_header X-forwarded-for $proxy_add_x_forwarded_for;
server {
listen 80 default_server;
location / {
proxy_pass http://domain_server/userdomain/$http_h... |
Nginx how to completly disable Proxy caching | For what i understandproxy_cachecan only be disable by changing the incoming request headers to somtehing like Cache-Control': 'no-cache'. This seems to not be working for me, is there any way to completly disble caching for that proxy ?proxy_cache off didn t work either response headers always come back like that:Cach... | Just needed to setexpires off;within my proxy location block.. |
Removing start of path from nginx proxy_pass | To remove the use of ports on several of the applications running on this server, I've been using nginx's proxy_pass to do this. However, for some reason the actual url is being passed to the application. Is there a way so that it thinks/panelis really just/?location /panel {
proxy_set_header X-Real-IP $remote_ad... | You need to add the trailing slashlocation /panel/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8082/;
} |
Laravel Valet logs | I'm using laravel valet to serve sites in my local dev env, which is great. However, there's only one file in the expected location of~/.valet/Log:➜ ls ~/.valet/Log
nginx-error.logI've tinkered with php-fpm log settings and the nginx log settings, but I'm not sure that I'm even using the right config files, since I su... | Hopefully this helps with your question about the nginx config files. You can find the nginx configuration for your sites by runningcd ~/.config/valet/Nginxin your terminal. To get to the base nginx config for valet usecd /usr/local/etc/nginx/valet. You should then seevalet.conf, inside you can update the following lin... |
Gitlab on port 8080 | I'm currently in the process of trying to get Gitlab omnibus installed on my private Debian server, and it works perfectly on port 80, the problem is I also have an Apache server listening on port 80. So I'm trying to get Nginx listening on port 8080 but for some reason I'm getting a
"502
Gitlab is not responding" Er... | Most likely you have another service listening on 8080, I think the omnibus install have some service hooking 8080 - just use 8081 instead.Edit:I just did a quick search and found that it's the unicorn server that is listening to 8080 with the original omnibus installer.Note:You will only need to change the external_ur... |
Password protecting Rails site running on Nginx and Phusion Passenger | I want to protect my newly deployed Rails 3 app with the basic http authentication. It's running on the latest Nginx/Passenger and I'm using the following Nginx directive to protect the web root directory:location = / {
auth_basic "Restricted";
auth_basic_user_file htpasswd;
}htpasswd file was generated using Apach... | You need to re-specify passenger_enabled in the location block. |
Django Admin Panel Content Posting Error | While I was adding content for my django web site on admin panel,I get the error.After I added 10-15 content,site give the this error. "The page you are looking for is temporarily unavailable."I analysed nginx and uwsgi logs.Nginx log contains to below line.2012/06/02 22:02:53 [error] 5203#0: *602 recv() failed (104: C... | Looks like the request headers may have exceeded the default uwsgi maximum buffer size of 4k. Try increasing the buffer size by addingbuffer-size=32768to youruwsgi.inifile. |
Nginx return an empty json object with fake 200 status code | We've got an API running on Nginx, supposed to return JSON objects. This server has a lot of load so we did a lot of performance improvements.The API recieves an ID from the client. The server has a bunch of files representing these IDs. So if the ID is found as a file, the contents of that file (Which is JSON) will be... | error_page 404 =200 @empty_json;
location @empty_json {
return 200 "{}";
}Reference:http://nginx.org/r/error_pagehttp://nginx.org/r/returnhttp://nginx.org/r/location |
How to silence ActionController::UnknownHttpMethod errors? | On my Rails production website I sometimes get a dozen or so errors along the lines of:An ActionController::UnknownHttpMethod occurred in #:TRACK, accepted HTTP methods are OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL, REPORT, CHECKOUT, CHE... | Actually, what bothers me the most is theException NotificationsI am getting from Rails when a bot hits my site with an unknown HTTP method. (Sometimes I get a dozen or so exception emails à laAn ActionController::UnknownHttpMethod occurred in ...within a matter of seconds.)So in myproduction.rbI added one extra line:c... |
Nginx - how to access Client Certificate's Subject Alternative Name (SAN) field | I have an Nginx server which clients make requests to with a Client certificate containing a specific CN and SAN. I want to be able to extract the CN (Common Name) and SAN (Subject Alternative Names) fields of that client cert.rough example config:server {
listen 443 ssl;
ssl_client_certificate /etc/nginx/certs/client.... | You can do it through OpenResty + Lua-OpenSSL and parse the raw certificate to get it.Refer this:https://github.com/Seb35/nginx-ssl-variables/blob/master/COMPATIBILITY.md#ssl_client_s_dn_x509Just like this:local varibleName = string.match(require("openssl").x509.read(ngx.var.ssl_client_raw_cert):issuer():oneline(),"/C=... |
TeamCity behind nginx proxy | I am trying to set up TeamCity behind nginx. I'd likehttps://public.address.com/teamcity/... to redirect tohttp://127.0.0.1:8111/..., but even though nginx does this successfully, the login page comes back with references that look like this:Obviously, this won't do, and fiddling with therootURLsetting (Server URL:inSe... | (I eventually tracked down a solution myself...)Install tomcat, then install the WAR version of TeamCity, which is in the download area above theJava EE Containertab. This exposes TeamCity under a base URL that you can choose at the time you install the WAR.The simplest approach is to copy the .war file into Tomcat's w... |
How to block referral spam using Nginx? | I'm running two mongrels under an Nginx server. I keep getting requests for a nonexistent file. The IP addresses change frequently but the referring URL stays the same. I'd like to resolve this. | https://calomel.org/nginx.htmlBlock most "referrer spam" -- "more of an annoyance than a problem"nginx.conf## Deny certain Referers (case insensitive)
## The ~* makes it case insensitive as opposed to just a ~
if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversof... |
In PHP 7.0 Fatal error: Uncaught Error: Call to undefined function json_encode() | My server configurations:[root@server ~]# php -v
PHP 7.0.22 (cli) (built: Aug 7 2017 16:18:27) ( NTS )
[root@server ~]# nginx -v
nginx version: nginx/1.10.2OS: CentOS 7.3.1611 (Core)Details of my YUM installation:[root@server ~]# yum list installed | grep php
php70u-cli.x86_64 7.0.22-2.ius.cen... | I run the following command to install json for php7 and it worked perfectly fine.[root@server dbs]# sudo yum install php70u-json |
Flask app gives ubiquitous 404 when proxied through nginx | I've got a flask app daemonized via supervisor. I want to proxy_pass a subfolder on the localhost to the flask app. The flask app runs correctly when run directly, however it gives 404 errors when called through the proxy. Here is the config file for nginx:upstream apiserver {
server 127.0.0.1:5000;
}
location /ap... | Since Flask is handling the request, you could just add a little bit of information to the 404 error to help you understand what's passing through to the application and give you some real feedback about what effect your nginx configuration changes cause.from flask import request
@app.errorhandler(404)
def page_not_fo... |
How exactly do I server static files with nginx and gunicorn for a Django app? | Right now, I'm trying to follow this tutorial:http://honza.ca/2011/05/deploying-django-with-nginx-and-gunicornThe template site loads correctly, but the images don't load. Here is part of my config.py file for my application:# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/ho... | Turns out I fixed my own problem... misunderstood how Nginx worked. :Dserver {
listen 1234; //port that Nginx listens on
server_name xxx.xx.xx.xx; #the actual IP of the server; it has a public IP address
access_log /home/lilo/textImageSite/access.log;
error_log /home/lilo/textImageSite/error.log;
location /static {
... |
Nginx 502 Bad Gateway error ONLY in Firefox | I am running a website locally, all the traffic is routed through NGinx which then dispatches requests to PHP pages to Apache and serves static files. Works perfectly in Chrome, Safari, IE, etc.However, whenever I open the website in Firefox I get the following error:502 Bad Gateway
nginx/0.7.65If I clear out cache an... | I seem to have found a work around that fixed my problem. After some additional Google research, I added the following lines to my Nginx config:proxy_buffers 8 16k;
proxy_buffer_size 32k;However, I still don't knowwhythis worked and why only Firefox seemed to have problems. If anyone can shed light on this, or offer ... |
InvalidAuthenticityToken in Rails 5 behind Nginx using SSL | I've got a really weird issue with Rails 5 (beta1) and it's preventing me from safely submitting any forms.When running in production mode behind an Nginx (1.4.6 on Ubuntu 12.04) reverse proxy which decrypts SSL, Rails is rejecting my CSRF tokens saying they are invalid despite the fact that the correct token is being ... | Fix by adding more headers in Nginx (X-Forwarded-Ssl on,X-Forwarded-Port 443andX-Forwarded-Host "your hostname",X-Forwarded-Proto https). The problem was actually in the new way CSRF tokens are checked by ActionController (compares the request.base_url with the origin header) |
Check if cookie does NOT contain specified content NGINX | There are countless tutorials on checking if a cookie exists and contains my content, in this casefoobar.How do I do the following assuming mycookie is the cookie that I want set.if ($cookie_mycookie does not equal "foobar") {
return 401;
}I have tried the following to no avail.if (!$http_mycookie ~* "foorbar" ) {
... | In Nginx, each cookie is available in embedded variable$cookie_CookieName. In case you want to check cookie with namemycookie, you can do it using this configuration snippet:if ($cookie_mycookie != "foobar") {
return 401;
}From nginxmanualfor theifcommand:A condition maybe (among others):Comparison of a variable with... |
nginx error location for all servers | Is it possible to define a common location for all servers? Fromnginx locationdocumentation I've seen that location depends on server. I would like to do something like this:...
http {
error_page 404 /error/404.html;
error_page 500 501 502 503 504 /error/50x.html;
location ^~ /error... | Is it possible to define a common location for all servers?No.You could make separate file andincludeit into all your servers./etc/nginx/error-location.inc:location ^~ /error/ {
internal;
root /var/www/nginx/errors;
}And then:server {
...
include error-location.inc;
}
server {
...
include error... |
How to change $request_uri in nginx? | We get information from$_SERVER['REQUEST_URI']not from$_GETor$_POST.I want to define$request_urito change/exampleto/module/controller/action. Please note that I do not want to trigger a redirect.I tried the code below to do this, but it doesn't work.location /example {
rewrite /module/controller/action;
} | set $request_url $request_uri;
if ($request_uri ~ ^/example(.*)$ ) {
set $request_url /module/controller/action;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9090;
#include fastcgi.conf;
fastcgi_param REQUEST_URI $request_url;
#fastcgi_param REQUEST_URI $request_uri;
} |
ICU version compatibility Symfony 3.1 | I have a problem installing symfony 3.1 in php7, nginx and ubuntu 16.04, i have this error:intl ICU version installed on your system is outdated (55.1) and does not match the ICU data bundled with Symfony (57.1)
To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.How c... | I presume you get this when you run:php bin/symfony_requirementsThis is just a warning and you can safely ignore the message. I've response to similar questions on this. See this URL for more details:https://github.com/symfony/symfony/issues/15007 |
Can I use Clojure with nginx? | This is a follow up to my questionhere. I've set up a home server (just my other laptop running ubuntu and nginx) and I want to serve clojure files.I am asking help for understanding how this process works. I am sorry at this point I am confused and I think I need to start over. I am asking a new question because I wan... | For starters, don't useleinto run things in production. You can uselein uberjarto create a jar file with all your deps ready to run, andjava -jarto run the app from the resulting jar. There is also the option of runninglein ring uberwarto create a war archive to be run inside tomcat, which provides some other convenien... |
Converting .htaccess to nginx (mod_rewrite) | I've got the following .htaccess file for my apache:
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.... | http://web.archive.org/web/20180812021847/https://blog.martinfjordvald.com/2011/02/nginx-primer-2-from-apache-to-nginx/Everything is inside. No more .htaccess, no more complex rules use try_files.EDIT: And if it is not obvious, do not trust online converters. |
How to parse logs ( nginx/apache access.log ) with mix of delimiters i.e. square bracket, space and double quotes? and optionally convert to json | nginx access.log. It is delimited by 1) white space 2) [ ] and 3) double quotes.::1 - - [12/Oct/2021:15:26:25 +0530] "GET / HTTP/1.1" 200 1717 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
::1 - - [12/Oct/2021:15:26:25 +0530] "GET /css/custom.css HTTP/1.1... | If you can usegnu-awkyou can make use ofFPATto specify the column data:awk -v FPAT='\\[[^][]*]|"[^"]*"|\\S+' '{
for(i=1; i<=NF; i++) {
print "$"i" = ", $i
}
}' fileThe pattern matches:\\[[^][]*]Match from an opening[till closing]using anegated character class|Or"[^"]*"Match from an opening till closing double q... |
How to config nginx for Vue-router on Docker | I'm setting up a docker image fromnginxto serve a Vue app as static files.
My vue app uses Vue-Router and it works perfectly on an other server.
My nginx config is just like this:https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurationsAnd now I wanna migrate to docker, and this is myDoc... | This is how I solved my problem.# Add nginx config
COPY .docker/nginx/prod.conf /temp/prod.conf
RUN envsubst /app < /temp/prod.conf > /etc/nginx/conf.d/default.conf |
Nginx - encoding (normalizing) part of URI | I have nginxlocationdirective which purpose is to "remove" localization prefix from the URI for theproxy_passdirective.For example, to make URIhttp://example.com/en/lalalause proxy_passhttp://example.com/lalalalocation ~ '^/(?[\w]{2})(/(?.*))?$' {
...
proxy_pass http://example/$rest;
...
}This w... | Yes, this behaviour is expected although docs also say:If proxy_pass is specified without a URI, the request URI is passed to the server in the same form as sent by a client when the original request is processed, or the full normalized request URI is passed when processing the changed URI:location /some/path/ {
pr... |
Peformance: Does SSL trust chain order matter? [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, ... | It's not just a matter of performance, but a matter of compliance with the TLS specifications.I guess that most browsers can parse through these files and figure out what the correct order of the chain should be.Some browsers may be tolerant, but theTLS specification explicitly says that you MUST present the certificat... |
Nginx downloads php instead of running it | Iv'e setup an Nginx php server on a linux REHL machine.
When accessing html files all goes well, but trying to access php file, the file is downloaded instead of being executed.This is my nginx.conf:user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
... | I just had this exact same problem. I was using Ubuntu 12.04 and Linux Mint 14 so different OS but likely to have the same issues.A couple of issues may happening. Firstly, you need to have php5-fpm installed (FastCGI Process Manager). I was trying to run it with my standard version of PHP but it was not working -http:... |
Nginx proxy_pass to Minecraft server | I'm trying to run two Minecraft servers on the same machine on two different ports. I want to reference them based on subdomains:one.example.com -> :25500
two.example.com -> :25501I have used nginx for things like this before, but it's not working with Minecraft. It's responding with http status 400. Here is a sample f... | As Dag Nabbit stated, a Minecraft server does not talk http. You would typically do this via NAT. A proxy server needs to know the protocol, because as the name suggests, it acts on behalf of the the client. Nginx knows various protocols, not just http, but Minecraft is not one of them. You can however write a proxy mo... |
Which is most efficient : serving static files directly by nginx or by node via nginx reverse proxy? | I already usenginxasreverse proxyto serve mynode.jswebapps3000<->80for example. Actually, I serve my assets in the node app, usingexpress.staticmiddleware.I read and read again that nginx is extremely efficient to serve static files.The question is, what is the best ? Serving assets as I already do or configuring nginx... | The best way is to use nginx server to serve you static file and let you node.js server handle the dynamic content.It is usually the most optimized solution to reduce the amount of requests on your node.js server that is slower to server static files than nginx for example :The configuration to achieve that is very eas... |
IIS Equivalent of "proxy_set_header X-Forwarded-Proto https;" | What is the IIS equivalent of this configuration in NGINX?proxy_set_header X-Forwarded-Proto https;I am running JetBrains YouTrack on Windows server, using IIS as a terminating SSL proxy, and get this error when trying to log in:HTTP ERROR 405
Problem accessing /hub/auth/login. Reason:
HTTP method POST is ... | Resolved after findinghttps://confluence.jetbrains.com/display/YTD65/Configuring+Proxy#ConfiguringProxy-IISreverseproxy
|
Is it necessary to put Unicorn behind Nginx ( or Apache) | I'm a bit confused about this architecture. On one of the projects I'm working on, Unicorn was chosen as a Rails server. And it is put behind Nginx web server. As I understand Unicorn is fully functional web server and we don't plan to host any other Rails applications on the same server instance.So my question would b... | Unicorn was not designed to handle "slow clients". You can read more about this in thePHILOSOPHYhelp file:Most benchmarks we’ve seen don’t tell you this, and unicorn doesn’t care about slow clients… but you should.A “slow client” can be any client outside of your datacenter. Network traffic within a local network is al... |
Using gzip in AWS ElasticBeanstalk Nginx | I have an AWS EB environment of Python 3.7 running Amazon Linux 2/3.1.2 using Nginx as a proxy server. I'm trying to add a gzip compression for my application. I tried out several tutorials online but they all don't appear to work for me. I'm also new to AWS so might not be familiar with some of its services.Currently,... | Big idea: To gain full control of your nginx configurations, you need to override the default settings in the.platform/nginx/nginx.conffile in your project directory.The problem: When I ssh'd into my EB instance, I found that in the file/etc/nginx/nginx.confstill includes the default settinggzip off. For some reason my... |
mTLS setup using self-signed cert in Kubernetes and NGINX | I have a Kubernetes cluster (AKS) that is hosting a REST echo service. The service runs fine via HTTP. I am using NGINX ingress to route traffic. I now want to set up this service via HTTPS and with mTLS, so forcing the client to specify a certificate to be able to communicate with the echo service. This is a POC, so I... | First, mTLS and TLS/SSL termination are not exactly the same thing. mTLS ismutual authentication🤝 meaning the client authenticates the server and the server authenticates the client.Typically the SSL termination takes care of the server authenticating the client but it takes client support for the server to be able to... |
nginx won't resolve hostname in K8S [duplicate] | This question already has answers here:DNS does not resolve with NGINX in Kubernetes(3 answers)Closed5 years ago.So, I would like to havenginxresolve hostnames for backends at request time. I expect to getHTTP 502 Bad Gatewaywhen back-end service is down and I expect service response, when it's up.I usenginx:1.15-alpi... | It fails because you need to use the FQDN to Resolve the name.Using just the hostname will usually work because in kubernetes the resolv.conf is configured with search domains so that you don't usually need to provide a service's FQDN.However, specifying the FQDN is necessary when you tell nginx to use a custom name se... |
Flask Gunicorn app can't get __name__ to equal '__main__' | I have this from/home/myname/myapp/app.py:from flask import Flask
app = Flask(__name__)
print __name__
@app.route('/')
def index():
return "Hello world!"
if __name__ == '__main__':
print 'in if'
app.run()When I run:$ gunicorn app:app -b 127.0.0.2:8000It says:2013-03-01 11:26:56 [21907] [INFO] Starting g... | Python sets__name__to"__main__"when the script is the entry point for the Python interpreter. Since Gunicorn imports the script it is runningthatscript will not be the entry point and so will not have__name__set to"__main__". |
running Tornado and Nginx on same server | I have a static website served up by nginx right now, and I want to develop an app with Tornado on the same server.The Tornado documentation mentions that wsgi doesn't support non-blocking requests.Is there a way for me to get them to work together (on the same server)? | Sure you can. Take a look at thenginx.conf example on tornado's homepage.The relevant bits in your case would be:http {
# Enumerate all the Tornado servers here
upstream frontends {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
... |
How can I run Perl scripts using FastCGI on Nginx? | So I am following this guide:http://technotes.1000lines.net/?p=23and I am going through the steps. I have a VPN (slicehost.com) with Debian Etch, serving a website (static so far) with nginx. I used wget to download FastCGI and I did the usual make make install routine.So I guess since FastCGI can't normally run CGI sc... | The webserver needs a Unix domain socket to connect to the FastCGI application, but the socket can't be created. Most likely the directory you want it to be in doesn't exist (because they are automatically created when you do abind). |
Django, why would I need nginx and uWSGI during hosting? | I have experience in hosting simple Django projects in Pythonanywhere platform(I did't have to install nginx and uWSGI).Many people use nginx+Uwsgi with Django, why would that required ?I hope nginx is a web server, load balancer, mail proxy and HTTP cache. Uwsgi is a webs server gateway interface.Does all those thing... | PythonAnywhere developer here: yes, that's right -- we do have nginx and uWSGI installed. When you create a website on the "Web" page on our site, what happens under the hood is (simplifying a bit) that we generate the appropriate nginx/uWSGI configuration files for you and start everything up so that you only need to... |
How to proxy RDP via Nginx | I'm using the below config in nginx to proxy RDP connection:server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://192.168.0.100:3389;
}
}but the connection doesn't go through. My guess is that the problem ishttpinproxy_pass. Googling "Nginx RDP" didn't yi... | Well actually you are right thehttpis the problem but not exactly that one in your code block. Lets explain it a bit:In yournginx.conffile you have something similar to this:http {
...
...
...
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}So everything you write in your c... |
configure Angular 2 Webpack App in Docker container environment specific | We want to deploy ourAngular 2app usingDocker imagesin different environments (staging/test, production, ...)When developing locally we are connecting to the backend REST API viahttp://localhost:8080but when we deploy in the different environments we want to use thesame Docker imageand connect to adifferent REST API en... | After having some discussions in this post and on twitter it looks like there is no easy way to achieve what I want via Webpack. The files are only served as static files at runtime and it is not possible to exclude a file at build time and include it at runtime.So I decided to go with the solution/workaround I had in ... |
Nginx reverse proxy setting | I am totally new to Nginx and need your help.
Basically I have a single server with single IP address, but I want to host two different web application within the server with different domain name. So, basically, for each domain name, I want it to redirect to different port number. I tried below and got an error[root@m... | If you check the docs forproxy_pass,proxy_passneeds to be in alocation,if in locationorlimit_exceptblock. You have it in aserverblock.Try replacing your usage ofproxy_passwithlocation / {
proxy_pass ...
} |
nginx directive is not allowed here in unicorn's example nginx.conf | I'm using nginx 1.4.1. After copyingunicorn's example ofnginx.conf, I found out the settings must be moved to different directives. I still couldn't manage to place the following settings in thenginx.conffile:worker_processes,user,pidandeventsblock. When I place them as it is now, the log showsdirective is not allowed ... | The original example cannot be used directly, because the main configuration is at/etc/nginx/nginx.conf./etc/nginx/nginx.confhashttpdirectives, which includes thesites-enabled/*directives. The only changes to be made on/etc/nginx/nginx.confare:work_processes 4;
worker_connections 1024;Also, removetext/htmlfrom it becau... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.