Prompt stringlengths 14 160 | Instruction stringlengths 18 2k | Response stringlengths 8 2k |
|---|---|---|
Live video ffmpeg latency using RTMP | I have a video stream that I want to broadcast via RTMP.I'm using ffmpeg to do so, with the following command:ffmpeg -i http://192.168.1.77:18000/stream.flv -c copy -f flv rtmp://localhost/myapp/mystreamAs far as I know, transcoding the video stream would introduce some latency. So my question is: is it possible that I... | Well, I solved my problem!I ended up trying with a different player and different settings and managed to get some frames latency (or no latency at all), so I guess this ffmpeg command is not introducing latency at all.Just for the record, I'm using flowplayer with the following settings:$f("streams", "http://releases.... |
Why is Django sending me Invalid HTTP_HOST header with my server IP? | So Django is sending me mail with this info:[Django] ERROR: Invalid HTTP_HOST header: ''.You may need to add u'' to ALLOWED_HOSTS.
No stack trace available
Request repr() unavailable.The problem is... You can't access my website with the server IP because I only allowing domain that already is in the ALLOWED_HOST set... | Found the reason.It was when someone tried to access the server via IP over HTTPS, as in https:// (and the server-ip)The solution is to disable that option.Solution for Nginx:server {
listen 80;
listen 443 ssl;
ssl_certificate /etc/ssl/example.crt;
ssl_certificate_key /etc/ssl/example.ke... |
Redirect instead of 404 Error page - Status Code not working (Nginx) | I'm currently moving to an nginx server. I tried putting this in my 404 ErrorDocument named404.php:If I now try to accesshttp://mydomain.com/404.php, this works as expected: It redirects me to Google. But once I try to accesshttp://mydomain.com/iDoNotExist, the 404 ErrorDocument is shownwithout redirecting meto Google.... | The behavior of your browser is correct. TheLocation:response header has no meaning for status code 404 (compare14.30 Locationand10.4 Client Error 4xx).Therefore the response's hypertext body is displayed in the browser - as specified by the HTTP specs for code 404 (see10.4.5 404 Not Found).To allow changing the HTTP r... |
How to use nginx if's param $1 in rewrite statement | I have this working code in nginx config:if ($http_host ~* ^www\.(.+)$) {
set $host2 $1;
rewrite (.*) http://$host2$1;
}I think that stringset $host2 $1;may be omitted and $1 used in rewrite statement without defining some variables. But rewrite has own $1..$9 params.How I may use $1 form if in the rewrite st... | I think the regex dollar forms only apply to the most recent regular expression. So you cannot combine the$1of theifwith the$1of therewritewithout usingset. However, there are simpler solutions for your scenario.Firstly, if you know the host name (for exampleexample.com), you can do the following:server {
server_... |
NGinx config for redirecting domain | I have 2 servers on my network:one linux machine (192.168.0.2) with a website listening on port 8181 for service1.domain.com
one windows machine (192.168.0.3) with a website listening on port 8080 for service2.domain.comI want to set up an nginx reverse proxy so that I can route requests like so:service1.domain.com -->... | this works fine for me:http {
server {
listen 80;
server_name service1.domain.com;
location / {
proxy_pass http://192.168.0.2:8181;
proxy_set_header host service1.domain.com
}
}
server {
listen 80;
ser... |
E-tags missing from response headers with rails 3.2 / nginx / phusion passanger | I have a very simple controller with e-tags:class EtagsController < ApplicationController
before_filter :require_user
def index
if stale?(:etag => current_user)
render :layout => false
end
end
endWhen I run this in my local development environment, the first request is a 200 with an ETag in the re... | It seems that nginx > 1.3 will ignore the e-tag from your application server if gzip is enabled for nginx. We didn't find a solution in nginx that would allow us to pass through the e-tags from the application server and gzip the response. I believe weak e-tags might work for this, but nginx does not currently suppor... |
Nginx - Redirect www.example.com/test to www.example.com:3000/ | If I have a domain, for example,http://www.example.com, and I would like to redirect all requests fromhttp://www.example.com/testtohttp://www.example.com:3000, how do I perform it properly?I've tried the following:location /test {
proxy_pass http://www.example.com:3000;
proxy_set_header Host $host;
}But what it... | try this codelocation / {
rewrite ^/test(/.*)$ http://example.com:3000$1 permanent;
proxy_set_header Host $host;
}Updated:if you don't want to rewrite the URL , try this code..server {
--------
server_name www.example.com;
location /test {
proxy_pass http://example.com:3000;
}
} |
Removing port from nginx redirect | I'm having an issue where some redirects on a website have the proxy-pass port included, rendering them useless. My configuration is as follows:Physical server 1:server {
server_name example.com www.example.com;
location / {
proxy_pass http://1.1.1.1:50493;
proxy_set_header... | It tells you how to fix your issue in the link you provided. Change:domain->asciiName ?>:server->webserver->httpsPort : $VAR->server->webserver->httpPort ?>"todomain->asciiName ?>"You have to fix this in your application rather than in Nginx.Your application is generating links that point to port 50493like this. Unless... |
Unicorn doesn't run in production mode | I am running stack nginx+unicorn+rails 3.2When I am runningbundle exec unicorn_rails -c config/unicorn.rb -E developmentit is ok, and site running wellwhen I am trying start unicorn site in production modebundle exec unicorn_rails -c config/unicorn.rb -E productionI have "We're sorry, but something went wrong." error: | Problem was in script precompilation. It was solved by adding to "config/environments/production.rb" following line:config.assets.compile = true |
Nginx, unicorn and Heroku | I am rather new to ROR development and currently i am using Herokuo (with Thin) to run my web application.I have been reading up on Zero Downtime deployment and i came across nginx and unicorn.Can anyone explain to me what exactly is Nginx and is it used in conjunction to Heroku? Same goes for unicorn?What are the pros... | nginx is a web server; in the context of Ruby on Rails applications, it receives the request from the user and hands it off to an application server. Application servers that are popular now:thinwebrickpumaunicornIn context of heroku, you have a choice of application servers, but not a choice of web servers.When hosted... |
Load balance WebSocket connections to Tornado app using HAProxy? | I am working on a Tornado app that uses websocket handlers. I'm running multiple instances of the app using Supervisord, but I have trouble load balancing websocket connections.I know nginx does not support dealing with websockets out of the box, but I followed the instructions herehttp://www.letseehere.com/reverse-pro... | it's not difficult to implement WebSocket in haproxy, though I admit it's not yet easy to find doc on this (hopefully this response will make one example). If you're using haproxy 1.4 (which I suppose you are) then it works just like any other HTTP request without having to do anything, as the HTTP Upgrade is recognize... |
Chrome and Firefox automatically redirect to https on a certain site | I have a drupal site that runs on nginx and php-fpm with haproxy balancing between multiple servers.I have two services set up for haproxy: http and https.if i go tohttp://subdomain.domain.com, it works fine.If I go tohttps://subdomain.domain.com, it also works fine.
If I then go back to http it now redirects to https... | I have figured this out. I had a setting in nginx: add_header Strict-Transport-Security "max-age=7200"; This is a new feature supported by chrome and firefox 4: chromium.org/sts |
How does one map many URLs to a single file using nginx? | I have a static file, index.html. How would I configure nginx to serve it from every path on the domain?URL | file
-----------------
/ | index.html
/foo | index.html
/bar | index.html
/baz | index.htmlEssentially, I want a wild card match.(I realize this will be an unusual setup.) | Is this what you're looking for?rewrite ^(.*)$ index.html |
How can Nginx be upgraded without dropping any requests? | According tothe Nginx documentation:If you need to replace nginx binary
with a new one (when upgrading to a
new version or adding/removing server
modules), you can do it without any
service downtime - no incoming
requests will be lost.My coworker and I were trying to figure out:how does that work?. We know (w... | For specifics:http://www.csc.villanova.edu/~mdamian/Sockets/TcpSockets.htmdescribes the C library for TCP sockets.I think the key is that after a process forks while holding a socket file descriptor, the parent and child are both able to call accept() on it.So here's the flow. Nginx, started normally:Calls socket() an... |
Nginx Removing Upstream Servers From Pool | Our setup is standard nginx (ver 0.7.59) + thin upstream servers on Debian lenny. Right now we're on 1 beefy box for web / app and 1 db box. Recently we started noticing thins will eventually start "hanging", i.e. they will no longer receive requests from nginx. We have 15 thins running, and after 10-15 minutes, th... | We have had numerous issues with nginx's reverse proxy support and ultimately have achieved a better architecture by puttingHAProxybetween Mongrel and nginx. So our architecture is:web => nginx => haproxy => MongrelsWhat we saw earlier (before HAProxy) was that nginx would flood Mongrels with too many requests and Mong... |
HttpContext.Connection.RemoteIpAddress returns private address for asp.net core in kubernetes | I have an asp.net core 7.0 api application in a docker container hosted in Kubernetes behind an Nginx ingress controller.To get the client ip address i'm usingcontext.HttpContext.Connection.RemoteIpAddressfor all user requests I get a Private Ip address like '10.244.0.1'In such instances i'm expecting Public IP address | You need to configure nginx toforward theX-Forwarded-ForandX-Forwarded-Protoheaders. Example:server {
listen 80;
server_name example.com *.example.com;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
... |
NGINX shows "bad gateway" when upstream server restart and not back to normal | Every time when I'm restart the upstream server, my NGINX shows "bad gateway" which is ok, but later, when the upstream server restarts nginx not recover automatically and I need to restart it (the nginx) manually.Is there an option to make nginx to check every few seconds if the upstream backed to normal?upstream core... | Seems that NGINX does not do the auto recovery by default.
Changing the config part from:upstream core {
server core:3001;
}to:{
server core:3001 max_fails=1 fail_timeout=1s;
server core:3001 max_fails=1 fail_timeout=1s;
}did the trick. the duplication is not mistake. Nginx tries to resolve the first line... |
Nginx reverse proxy for Angular apps | I have created a reverse proxy using Nginx which redirects in various applications (ASP.NET API's and Angular app's).Reverse proxy nginx.conf (the most important settings):...
server {
listen 80;
server_name localhost 127.0.0.1;
location /projects/sample-app1/api {
proxy_pass http://sample-app1-api... | Part of the solution is the response of the user:Esmaeil Mazahery, but a few more steps must be taken.First, I changed the Angular application Dockerfile (passed additional build parameters like: base-href and deploy-url)RUN npm run ng build -- --prod --base-href /projects/sample-app1/ --deploy-url /projects/sample-app... |
Nginx certificate authentication of a specific location | Using Apache I created an HTTPS site that contains a folder calledsecure[which I want to access with user and password]and another folder calledverysecure[which I want to access with certificate authentication].When I access the site usinghttps://www.example.comI get the default index.html file located in the root, as ... | According tothisthread from official nginx development forum, you can't (although this thread is almost 10 years old, SSL/TLS re-handshake still doesn't supported by nginx). The only workaround suggested by Igor Sysoev is to use an optional client certificate verificationssl_verify_client optional;and then checking the... |
APIs in Cloud Run and Nginx reverse proxy in VM | I have deployed 6 different Flask based applications to Google Cloud Run. They work perfectly fine when I access them through the autogenerated URL. Now, I want to unify all 6 services under one domain name with different routes.For example,mydomain.com/user ->https://custom-user-asdtgthyju-de.a.run.appmydomain.com/pro... | @petomalina's answer is the easiest if your Cloud Run service is public. If it's not, it won't work as perthis answerIf your service isinternal, I tried OP's #1 option of putting an nginx reverse proxy in front and was getting the same error: 404.The issue is caused by theHostheader having the host of the proxy, not of... |
When combining nginx with expressJS, shall I use compression in express or nginx? | I have an app running on nodeJS/express and also using nginx. If I compress the served files on both systems, I suppose that slows the server response time. Therefore, when combining nginx with expressJS, do you usecompression in expressorcompression in nginx? Or it simply doesn't matter!?I know it may be opinion based... | NGINX supports also somewhat superior Brotli compression (aside from gzip), via3rd party module.
So having all compression done in NGINX makes more sense.TTFB should not be affected if you keep both (NGINX will figure out that the response is already compressed). But for that same reason (NGINX receiving an already com... |
Is it possible to redirect a TCP connection based on host name? | What I want to be able to do is connect to a postgres server like this:psql -h postgres-a.example.com -p 9000That connection should be received by a proxy server (like nginx or haproxy) and it will be redirected to database A because of host namepostgres-a.example.com. If I usepostgres-b.example.comand the same port, i... | Yes. You will need a certificate for TLS/SSL and you can route the requests based onreq.ssl_snito the proper backend.I'm not sure if psql uses SNI but i think this have you check.frontend public_ssl
bind :::9000 v4v6 crt /usr/local/etc/haproxy-certs
option tcplog
tcp-request inspect-delay 5s
tcp-request cont... |
How to deploy nextjs into a directory which is not a root directory | Recently I learn something about nextjs because I want to make a site which SEO friendly by using React. Everything looks great until I ran into a problem.It's about how can I deploy nextjs app into a directory which is not a root directory, for example '/next'. I use a simple config for nextjs, use the default node se... | Your current config tells nginx to map urls 1-to-1, that means that/next/what-everwill be mapped tohttp://localhost:3000/next/what-ever.To solve this you need to add an additional slash.server {
...
location /next/ {
proxy_pass http://localhost:3000/ // <---- this last slash tells to drop the prefix
}
}For m... |
How to always redirect to index.html in Nginx Docker? | I'm usingnginx:1.16.0-alpineimage of Docker for serve react app (which is built before) and I want to redirect toindex.htmlpage in any cases (in what URL is got)nginx.conffile has the following content:user nginx; worker_processes auto;
error_log /var/log/nginx/error.log warn; pid
/var/run/nginx.pid;
events... | Comment the following line# include /etc/nginx/conf.d/*.conf;Why? Due to the lineinclude /etc/nginx/conf.d/*.conf;The default.conf is loaded and your server config is ignored.In addition, you need to include the root information in your server (which previously was provided by default.confHow to reproduceput the follow... |
HTTP/2 Server Push results in duplicate requests | A response for a document with the following headers enters Nginx:link: ; as=image; rel=preload
link: ; as=script; rel=preload
link: ; as=script; rel=preload
link: ; as=script; rel=preload
link: ; as=script; rel=preload
link: ; as=script; rel=preloadWith the help of HTTP/2 Server Push the requests are Pushed to the cli... | The core of the problem is actually Chromium. This thing only fails in Chromium from what I can see.The problem with Nginx is in the implementation ofhttp2_push_preload.What Nginx seeks is a header withLink: ; as=type; rel=preload. It reads it and serves the files via push, unfortunately when the browser (I only tested... |
Sticky session for ASP.NET Core on Kubernetes deployment | I try to port an ASP.NET Core 1 application with Identity to Kubernetes. The login doesn't work and I got different errors likeThe anti-forgery token could not be decrypted. The problem is that I'm using a deployment with three replica sets so that further request were served by different pods that don't know about the... | Found out that I made two logical mistakes:Sticky sessions doesn't work this wayI assumed that Kubernetes will look into the cookie and create some mapping of cookie hashes to pods. But instead, another session is generated and append to our http header.nginx.ingress.kubernetes.io/session-cookie-nameis only the name of... |
autotools configure error when passing options using shell variable | I wish to call configure command (to compile nginx) from a bash script like this:CONF_OPTS=' --with-cc-opt="-O2 -g"'
./configure ${CONF_OPTS}but I got the following error:./configure: error: invalid option "-g"When I pass the options like:./configure --with-cc-opt="-O2 -g"I got no error.To reproduce:curl -O http://ngi... | It will work like this:$ CC_OPTS=--with-cc-opt='-O2 -g'
$ ./configure "$CC_OPTS"so that the expansion of$CC_OPTSis passed as a single argument to./configure.But if you wanted also to pass, maybe:--with-ld-opt='-Wl,-gc-sections -Wl,-Map=mapfile'through a variable, you would need:$ CC_OPTS=--with-cc-opt='-O2 -g'
$ LD_OPT... |
Using Location Blocks In Kubernetes Ingress Nginx server-snippet Causes 404 | I'm hoping someone can help me here because I'm stuck.I'm moving over our nginx config from a traditional nginx/node server config whereby both nginx and node server are on the same machine.In Kubernetes, the ingress controller (nginx) obviously lives in another container.Where I'm getting stuck is reimplementing our r... | I'm assuming that your backend is serving your assets, so I think the problem is that yourlocation {}block doesn't have an upstream like the regular paths defined in the nginx ingress.There's a lot of lua code in thenginx.confof your nginx-ingress-controller so it might take time to understand, but you can copy yourngi... |
nginx to always serve the root index.html in every path | I have currently the code below. I am wondering if it's possible to still service this root even though I go to other pages likehttp://localhost/dog. The problem with my command below is it will return 404server {
listen 80;
server_name localhost;
location / {
root /usr/src/app/angularjs/di... | It is possible. Add thetry_filesdirective to yourlocationblock, this will tell nginx to load all requests that cannot be matched to a filesystem path with yourindex.html:try_files $uri /index.html; |
Stop nginx from decoding URL | I run an nginx server which serves static files. Some filenames contain strings like%3a./var/www/testfile%3aIf I try to request those files, I get a404 Not Founderror.This seems to happen because nginxdecodes the URLand replaces%3awith:, and then does not find a file named/var/www/testfile:. I infered this from the fol... | If there is a percent sign in your URLs, just exchange the percent in your request with %25, like this:https://domain/testfile%253aThis then becomes the filehttps://domain/testfile%3a.The problem is not "Nginx decoding the URI" - you are trying to circumvent how normal URIs according to the RFC standard work, where th... |
Nginx: Punching a Hole Through My Cache Not Working as Expected | I have a single page app and am trying to use the query parameter nocahce=true to bypass Nginx cache for the first response (HTML file) and ALL subsequent requests initiated by it (to get CSS, JS, etc).According tothis, I can bypass my cache using the query parameter but it is not working as expected.Steps to reproduce... | I was able to solve this by usingcookie_nocache.Update the directive proxy_cache_bypass to:proxy_cache_bypass $cookie_nocache;If you need to bypass the cache, set a cookie named "nocache" to true (any value that isn't empty nor 0 will work). Since the browser will send the cookies to subsequent requests, this will work... |
Laravel + basic auth except one folder not working | I did some coding to get the nginx config file working.My objective is to allow all.well-knownfolder and subfolders leaving the rest with basic auth, limit_req and laravel compatible.The problem now with let's Encrypt is that it is not renewing the cert because the route.well-known/acme-challenge/wPCZZWAN8mlHLSQWr7ASZr... | easy peasylocation / {
limit_req zone=admin burst=5 nodelay;
limit_req_status 503;
try_files $uri $uri/ /index.php?$query_string;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location ~ \.php$ {
include fastcgi_params;
... |
Nginx-ingress setting annotations to work with Kubernetes Helm install values.yaml | Running on Google Cloud platform / Container Engine - How do I set it up to point to this Ingress in the following?I have installed Nginx-ingress on Kubernetes with Helm and it works for thedefault backend - 404.I want to be able to use different http uri path, like/v1,/v2and others.For my own Chart that I want to use ... | I went ahead and reproduced your use case.Assuming the installation of nginx ingress controller though helm went smoothly and when listing resources everything seems to be fine, you need to specify the paths in the ingress yaml file, as follows:apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-reso... |
Clang libFuzzer Undefined Reference to `__sanitizer_cov_trace_const_cmp8' | I can successfully compile Nginx with the following variables in the makefileCC = clang-6.0CFLAGS = -pipe -O -Wall -Wextra -Wpointer-arith -Wconditional-uninitialized -Wno-unused-parameter -Werror -gWhen attempting to use -fsanitize=fuzzer or -fsanitize=fuzzer-no-link and changing my Makefile to:CFLAGS = -pipe -f... | You have to add sanitizer flags like-fsanitize=fuzzerto yourCFLAGSandyourLDFLAGS.If they aren't passed to the linker but just to the compiler you get tons of undefined symbol errors for sanitizer runtime library functions (like the one you quoted in your question).Note that when using-fsanitizer=fuzzerit makes sense to... |
About priority of nginx location / {} and location = {} | When I study about the nginx location configuration, I have some questions.Here is my example.the files structure is like this:
test1/index.html
test2/index.htmland the nginx.conf location part is like below:location = / {
root test1;
index index.html;
# deny all;
}
location /... | When you request the URI/,nginxwill process two requests.The first request (for the URI/) is processed by thelocation = /block, because that has highest precedence. The function of that block is to change the request to/index.htmland restart the search for a matchinglocationblock.The second request (for the URI/index.h... |
How to use Nginx X-Accel with Symfony? | I would want to use Nginx X-Accel with Symfony, for the moment I've this code.$request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect');
$request->headers->set('X-Accel-Mapping', '/var/www/html/files/=/protected-files/');
$request->headers->set('X-Accel-Limit-Rate', '1k');
BinaryFileResponse::trustXSen... | Finally, I move the X-Accel part from $request to $response, and just set X-Accel-Redirect header.If we want limit the download speed, we can use$request->headers->set('X-Accel-Limit-Rate', 10000);, it works well, the number is in bytes.Then I've change the$response->headers->set('Content-Disposition', 'attachment;file... |
how to cancel a previous requests when new request come from the same user in the same session | We're building a rest api using aiohttp. Our app is designed so that user sending requests more frequently than receiving responses (because of time of calculation). For user is important the result of the latest request only. Is it possible to stop calculations on outdated requests?Thank you | You're building something very un-HTTP-like. An HTTP request should not take more than a few milliseconds to answer, and HTTP requests shouldn't be interdependent; if you need to execute calculations which take rather long, either try to speed them up by changing your architecture/model/caching/whatever, or treat it ex... |
PHP_SELF returns /index.php/index.php | Why does$_SERVER['PHP_SELF']return/index.php/index.php??requesthttp://example.comoutput/index.php/index.phpindex.php<?php
echo $_SERVER['PHP_SELF'];nginx.confserver {
listen 80;
server_name domain.com;
root /var/www/public/www;
# Add trailing slash
rewrite ^([^.\?]*[^/])$ $1/ permanent;
l... | I found a solution that works..If you change the order infastcgi.confit works and the correct values are returned byPHP_SELFandSCRIPT_NAMEfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;is moved to the top of the filefastcgi.conffastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
... |
How to use sudo commands from Symfony Process Component? | I am working on a Laravel project where I have to generate a Nginx configuration file and store it on/etc/nginx/sites-availabledirectory which only has write rights for the admin user, I have admin rights on the server, I just want to know if there is a way for doing this using theProcess Componentof Symfony stack.Than... | I would recommend using linux ACL, and give PHP process rights to write into the directory. That way you don't need sudo.Also, you will need rights to reload the nginx process. And imho having a cronjob under root user, that reloads the configuration, if it changes and is valid, is a much better option.You should read ... |
Decrypt OpenSSL binary through NGINX as it is received ( on the fly ) | I have a small embedded Linux device that has 128 MB flash storage available to work with as a scratchpad. This device runs an NGINX web server. In order to do a firmware update - the system receives an encrypted binary file as an HTTPS POST through NGINX to the scratchpad. The system then decrypts the file and flashes... | First of all, you need to understand one thing. While nginx will decrypt file - all other request will be blocked. That's why nginx does not support CGI, only FastCGI.If it ok for you (for example, nginx used only for update purposes), you can use perl or lua extension:http://nginx.org/en/docs/http/ngx_http_perl_module... |
How to configure nginx to pass user info to wsgi/flask | I have an nginx http server which authenticates users and passes the authenticated request to a Flask app via wsgi. When I print the entire header from the flask app no user information is available.Is it possible to get nginx to include the username in the request header?Here is the server block with the authenticatio... | Here you are using http basic authentication option, after a successful feedback given by nginx server, browser sends a base64 ofusername:password.
just use python base64 module to get username & password,>>> from base64 import b64decode
>>> authorization_header = "dXNlcm5hbWU6cGFzc3dvcmQ=" # value from flask request h... |
Vagrantfile PHP v5.6 specified but v5.5 installed | I have a Vaprobash VagrantFile building a Ubuntu Nginx stack.In it I specify PHP v5.6:php_version = "5.6" //Options: 5.5 | 5.6However, I run$ vagrant upwhen I ssh into the box and do$ php -vit shows PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct 3 2016 13:00:37).Why wasn't5.6installed? | I am not sure this repo has been updated for php after the ppa has been migrated (seehttps://github.com/oerdnj/deb.sury.org/wiki/PPA-migration-to-ppa:ondrej-php)basically inscripts/php.shyou need to replace ppa bysudo add-apt-repository ppa:ondrej/php(make sure to runsudo apt-get updateif you're running this command di... |
ServiceStack Docker architecture | I'm wondering if anyone with bigger brains has tackled this.I have an application where each customer has a separate webapp in Azure. It is Asp.net MVC with a separate virtual directory that houses ServiceStack. The MVC isn't really used, the app is 99% powered by ServiceStack.The architecture works fine, but as we g... | Whilst it isn't Azure-specific we've published a step-by-step guide to publishingServiceStack .NET Core Docker Apps to Amazon EC2 Container Servicewhich includes no-touch nginx virtual host management byrunning an Instance of jwilder/nginx-proxy Docker Appto automatically generate new nginx Virtual Hosts for newly depl... |
Laravel 5.3, using api.example.com to example.com/api | How to route api.example.com to example.com/api so i can justapi.example.com/v1/usersthan usingexample.com/api/v1/users.I'm using nginx, thank you. | Ensure these 2 steps are in place.Check your nginx configuration/etc/nginx/conf.d/example.confand include the domain in theserver_namelike so:server_name example.com api.example.com;Check that you have a route setup within theroutes/api.phpfile. Using the sub-domain group is optional but be sure that you have the corre... |
Enable HTTPS self signed cert for GitLab Community Edition for Ominbus installer | I have an Omnibus gitlab installer. I am trying to setup an HTTPS url with self signed cert. I am using Ubuntu 14.04 as my Host OS. The steps im following are:Modified gitlab.rbexternal_url 'https://gitlab.example.com'
nginx['redirect_http_to_https'] = trueCreate Self signed cert with proper name and place it under /et... | The official documentation is "Settings NGiNXd"Check ifissue 1374is relevant in your case.gitlab_rails['registry_key_path'] = "/etc/gitlab/ssl/gitlab.example.com.key"
registry['rootcertbundle'] = "/etc/gitlab/ssl/gitlab.example.com.crt"You do not need to specify these two as per documentation on enabling Registry. Thes... |
nginx SSL handshake fails on requests from mobile devices with "SSL_BYTES_TO_CIPHER_LIST:inappropriate fallback" | I am trying to find a solution for this error (full error message is[crit] 556#0: *1940 SSL_do_handshake() failed (SSL: error:140A1175:SSL routines:SSL_BYTES_TO_CIPHER_LIST:inappropriate fallback) while SSL handshaking, client: xx.xx.xx.xx, server: 0.0.0.0:443)I have read multiple similar questions (likethis oneorthis ... | So, thanks toTom, things started working out :)
The steps he indicated were the following, and I suggest this approach for everyone, not just those who have errors.Go tothe Mozilla SSL Configuration Generatorand generate a configuration for your server.Modify the file accordingly for your needs.Go toSSL labsand do a se... |
How can I see unavailable servers in Nginx logs? | Where in the Nginx logs will it say that a server is unavailable because it failedxtimes inyseconds?I have a set of servers in an upstream block in nginx, each one has afail_timeoutandmax_failsvalue set like so:upstream loadbalancer {
server ip1:80 max_fails=3 fail_timeout=60s;
server ip2:80 max_fails=3 fail_ti... | There is now a log message when the server has exceeded max_fails.
It has been added in 1.9.1.
Log level is warning, the message says "upstream server temporarily disabled". |
If I'm using a reverse proxy on Nginx do I need an SSL certificate for the reverse proxy and the server? | so I'm starting to learn about nginx and reverse proxy's and I have a question about SSL, the thing is that I have a reverse proxy server like this:upstream vnoApp {
server vyno.mx:81;
}
server {
listen 80;
server_name app.vno.mx;
location / {
proxy_pass http://vnoApp/;
proxy_... | No problem, you just need a certificate for the user-facing host.As a side note, unless circumstances justify, it is generally ill-advised to forward anything to a publicly available port and host.So that - unless there is a reason not to do so - you should firewall port 81 onvyno.mxto accept connections only from thea... |
Apache and Nginx together, why? | I have installed a popular control panel service called VestaCP (https://vestacp.com/) for my remote linux server.
By default it installed both apache and nginx, but despite my best efforts I still can't work out why I need both. I'm familiar with apache and how to configure it, but I've never used nginx before. It app... | Nginx isfaster and lighter, but many people find it easier to work with Apache because of.htaccesssupport (Nginx does not have an analog due to performance concern).The typical scheme is following: you bind Nginx on port80, configure it to serve static files (jpg, png, js, css, ttf, etc.), and make it proxy to Apache o... |
NGINX - Regex - Search entire location for non alphanumeric | I have the following regex in my vhost conf:location ~* ^/!/[^a-zA-Z0-9] {
return 301 $scheme://$http_host;
}But it only appears to match the first character:# Redirects to https://shouttag.com correctly
https://shouttag.com/!/!pink
# Does not redirect as expected
https://shouttag.com/!/p!nkVariations I have tried... | You can try this rule:location ~ ^/!/[a-zA-Z0-9]*[^a-zA-Z0-9].*$ {
return 301 $scheme://$http_host;
} |
How can I see console.log output in a node express app when using nginx + passenger | Currently using nginx passenger to serve an express app in production. I can get the error.log and access.log from nginx. But how can I see console.log output that set in the codes? | All console.log output goes to stderr, which is redirected to the global Nginx error log:https://www.phusionpassenger.com/library/admin/nginx/log_file/ |
How to config nginx to proxy to rails app? so that i dont have to say domain.com:port | Update:Currently i visit my app at domain.com:3000, but i would like to visit domain.com to see my appI have setup nginx at 80 to proxy my rails app at 3000. below is the configurationupstream railsapp {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name APP;
# Tell Nginx and Passenger where your app's ... | I was trying to run unicorn so i can fork my app to multiple instances. I guess the issue here was, i set passenger_enabled on and was actually running unicorn on 3000.so instead i ran passengerpassenger start -a 127.0.0.1 -p 3000 -d -e productionand my nginx conf like this,server {
listen 80;
server_name www.APPNAME.c... |
Nginx configuration not updating for browser | I am trying to serve a website with nginx. I have noticed that when I make changes to my/etc/nginx/sites-available/game, runsudo service nginx restart, it is not reflected when I try to pull it up in the browser.The browser just hangs and waits for a response and then timesout.However, it works perfectly fine if I try ... | You can disable adding or modifying of “Expires” and “Cache-Control” response header usingexpiresparam:expires off;nginx docs |
hhvm nginx toString server error with Magento Magmi | I'm trying to run magmi product import plugin on a Magento app which is running on an aws ec2 instance that has NGINX & HHVM on it. When I try to run the the magmi product import app on Magento I get the below server error in myhhvm error log./var/log/hhvm/error.log\nCatchable fatal error: Object of class Magmi_Produc... | I had the same issue. My solution was to simply comment out the offending line.public function bind($caller)
{
$this->_callers[]=$caller;
// $this->_callers=array_unique($this->_callers); // LINE 9
}You may also find Magmi is getting a "500 hphp_invoke" error on /magmi/web/magmi_run.php. To get around this... |
Odoo (on Debian) - longpolling port is never used/opened | There seems to be a problem with Debian distributions (tested for both Wheezy and Squeeze) using Odoo for longpolling port. longpolling port is never used. It supposed to be used wenworkersparameter is set to be greater than0, but it is not used anyway. But testing same thing on Ubuntu, longpolling port is used normall... | The problem was quite simple, but yet disguised. It was missing python packagepsycogreen. But it was not mentioned as dependency and when installingim_chatit didn't require such package. So if you were running Odoo with--workers=0, then installedim_chatand later switched to for example--workers=2, Odoo would not throw ... |
Express js app with nginx - a conflict with static files when serving a subfolder | upstream app {
server localhost:3000;
}
server {
...
# If I comment this location out, images are displayed on the website
location ~* \.(?:jpg|jpeg|png|gif|swf|xml|txt|css|js)$ {
expires 6004800;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, prox... | Regex locations have precedence over prefixed location blocks in nginx request processing. Hereinafter are relevant excerpts of nginx'slocation directive documentation.I strongly encourage you to read them carefully as many people don't do it and miss the basics.A few examples before to understand keywords :prefixed lo... |
Reject certain subdomains on port 80 on nginx | I have a few domains/subdomains, and I have aserverblock to properly redirect them to port 443. But what I'm also trying to do is for a couple of those subdomains, I don't want it to connect at all on port 80.So below is an example of the values I'm redirecting to port 443.server {
listen 80;
server_name ... | Don't listen on port 80 for these domainsReturn nginx's special HTTP code444in a default vhost.server {
listen 80 default_server;
return 444;
}
server {
listen 80;
server_name ~^(?sub1|sub2|sub3)\.example\.com$;
return 301 https://$subvar.example.com$request_uri;
} |
How to use django-sslify to force https on my Django+nginx+gunicorn web app, and rely on Cloudflare's new free SSL? | IntroCloudflare's providing SSL for freenow, and I would be a fool to not take advantage of this on my site, and a downright dickhead to break everything in the process of trying to.I can code apps just fine, but when it comes to setting up or configuring https/nginx/gunicorn/etc/idon'tknowtheterminology, I know barely... | CloudFlare allows you to enable specificpage rules, one of which is to force SSL (bydoing a hard redirect). This is a great thing to usein addition todjango-sslifyordjango-secureIn addition to setting up your SSL redirect, you also need to tell Django to handle secure requests. Luckily,Django provides a decent guidefor... |
Set Environment Variables - nginx + uWSGI | I want to be able to access environment variables (for passwords and such) in a Flask app.I'm running nginx and uWSGI. Where is the correct place to set them so they're available?Should I just add auwsgi_param PARAM_NAME 'param_value';line to the config for the site (in/etc/nginx/sites-enabled/mysite? | Somewhere nearuwsgi_pass, for example:location / {
uwsgi_pass unix:///tmp/uwsgi.sock;
include uwsgi_params;
uwsgi_param UWSGI_SCRIPT webapp;
uwsgi_param UWSGI_CHDIR /usr/local/www/app1;
} |
Nginx not displaying 404 page, instead serving index file in root | My Nginx server is not displaying my 404 page. Instead, whenever trying to access a non-existent page or directory, it merely serves my index(.php) in the root of my web folder (without the corresponding stylesheet).Here's my own 'default' file under /etc/nginx/sites-available:server {
listen 80;
listen [::]:80 ipv6onl... | you are rewriting to index.php if the file doesn't exist, so it never makes it to your try_files or errorpage...if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}^ should be removed, unless you have a specific purpose for it |
PHP 5.5 FastCGI Caching | I've implemented FastCGI caching on our site, and have seen great speed improvements. However the FastCGI cache key does not seem to be unique enough. If I login, my name appears in the header. However the next person to login still sees my name in the header, assuming the cache is still valid.Is there a way to make... | I was able to solve the above problem using theNginx ngx_http_userid_module. The hardest part was actually finding the module, implementing the solution was quite trivial.I used their example configuration:userid on;
userid_name uid;
userid_domain example.com;
userid_path /;
userid_expires 365d;
userid_... |
Should I block HTTP 1.0 request? [closed] | Closed.This question does not meetStack Overflow guidelines. It is not currently accepting answers.This question does not appear to be about programming within the scope defined in thehelp center.Closed9 years ago.Improve this questionI use $_SERVER['HTTP_HOST'] for absolute url paths in my website. But, often, I find ... | Is it advisable to block these requests?If your application cannot serve anything meaningful without the host, then it's IMO advisable. Furthermore I couldn't find anything in HTTP 1.1 which says applications have to be backward compatible.What's the best way to block them?Answer them with505 HTTP Version Not Supported... |
Running Python Eve Rest API in Production | It is no time to move my Python Eve Api into a production environment. There are several ways to do this and the most common requirements are:Error LoggingAutomatic RespawnMultiple Processes (if possible)The best solution I found is to have a nginx server as frontend server.
Withpython eve running on the uWSGI middlew... | WSGI containers expect a callable/function to run, they do not execute your 'main' entry. With run:Eve you are asking uWSGI to execute (at every request) the "Eve" function in the "run" module (that is obviously wrong)Moveapp = Eve(auth=globalauth.TokenAuth)out of the__main__check and tell uWSGI to use the 'app' callab... |
Nginx: serving static files by URL path | Is there any way of serving static files by only some URL path? For example, next URL patternhttp://host/static/*.pnghas/static/substring (path), and Nginx will serve any statics from there.In the web server documentation I found an example:location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js)$ { ...and defined my Nginx confi... | location ~* ^/static/.+\.(png|whatever-else)$ {
alias /var/www/some_static;
expires 24h;
}
location / {
# regular rules
}Hand written, may contain mistakes.If you want to extend the rules to matchanything/something/static/*.pngjust remove the^in the patten. |
Nginx and FastCGI downloads PHP files instead of processing them | I'm running on Windows 7 (64-bit), with PHP 5.4.12, and Nginx 1.5.8.I have read many tutorials on setting this up, and troubleshooting this issue, which is that when requesting a PHP file from my localhost, it downloads it as a file instead of displaying the PHP page. Below is my nginx.conf file:worker_processes 1;
e... | Try to changedefault_type application/octet-stream;todefault_type text/html;Maybe your php-script does not set a content MIME type and it goes from nginx. |
Spring MVC “redirect:/” prefix redirects with port number included | I am using tomcat and nginx together to serve my web application.
nginx listens to port 8085 and forwards requests to tomcat which is running on port 8084.If I do a redirect like the following:@RequestMapping("/test")
public String test() {
return "redirect:/";
}the page gets redirected to port 8084 (Tomcat port) ... | use$server_portinstead of$proxy_portpart in you configuration.change this lineproxy_set_header Host $host:$proxy_port;toproxy_set_header Host $host:$server_port;Catalina'sHttpServletResponse.sendRedirectimplementation uses thegetServerPortmethod to build anabsoluteredirect url (LocationHeader-Value).getServerPortreturn... |
nginx rewrite: everything but empty base url | After about 2 hours of googling and trying various things out, I turn to you for help.Task:
Rewrite the blank url to something, and everything else to something different in nginx.So, if I navigate to subdomain.somedomain.tld, I want to get served the index.php, and if I go to subdomain.somedomain.tld/BlAaA, I get redi... | I would suggest avoidingifand working with different locations making use of the precedence related to the pattern matching methods used (docs):#blank url
location = / {
return 302 http://subdomain.domain.tld/index.php;
}
#just /index.php
location = /index.php {
include common_settings;
}
#anything starting w... |
launching adhoc docker instances: Is it recommended to launch a docker instance per request? | Is it recommended to launch a docker instance per request?I have either lighttpd or Nginx running on my web server as a reverse proxy. I support a number of subdomains with very low usage. When a request for the subdomain arrives I want to start the docker instance. Preferable I'd like to launch them dynamically so tha... | Originally I said this should work well for low traffic sites, but upon further thought, no, this is a bad idea.Each time you launch a Docker container, it adds a read-write layer to the image. Even if there is very little data written, the layer exists, and each request will generate one. When a single user visits a w... |
Flask + uwsgi + nginx + debug. 502 error instead of debugger page | Run Flask on server with uWsgi.uWsgi config
/tmp/flask.sock
/home/reweb/flask/
publicist:app
python27
reweb
/home/reweb/reload
nginx configupstream flask_serv {
server unix:/tmp/flask.sock;
}
server {
listen 80;
server_name some-domain.com;
access_log /home/reweb/log/nginx-access.log;
error_log /h... | All you need to know:https://stackoverflow.com/a/10460399/814470https://stackoverflow.com/a/17839750/814470Two answers from duplicated question |
Flask send_from_directory for media files | I have a small Flask application destined from home network use.At the moment I have Flask running with uWSGI and nginx.The app basically scans a location and serves media files. Below is the code for rendering these files:@app.route('/get_media/', methods=['GET'])
def get_media(filename):
return send_from_... | If you already using nginx you should serve media and static files using nginx, no reason to serve them with uWSGI and flask, too much overhead.#in case you have structure /path/to/your/media_dir/media
location /media {
root /path/to/your/media_dir;
}
#in case you have structure /path/to/your/media_dir
location /me... |
Capifony setfacl permissions: "Operation not permitted" | I have a userdidongo(user & groupdidongo), and the nginx server (user & groupwww-data). I've setup Capifony to login asdidongouser: the first time I deploysetfaclcommand works ok (while the logs folder is empty). But after the web application, served by nginx, has generated some logs (prod.log) the very next deploy fai... | Finally I managed this creating different PHP-FPM pools with the same permissions as the user. This way I can have different users separated from each other. And as a bonus deploy.rb is simplified. |
Nginx proxy redirect to another URI | Our site is an image repository of sorts. Each image has the notion of an external URL and an internal URL. External URL's are seen by clients and they change as we experiment with SEO. The internal URL's are permanent URL's that point to our image hosting service. We use our Ruby on Rails app to provide the URL transl... | Use theX-Accel-Redirectheader in combination with a special Nginxlocationto have Nginx proxy the remote file.Here is thelocationto add to your Nginx configuration:# Proxy download
location ~* ^/internal_redirect/(.*?)/(.*) {
# Do not allow people to mess with this location directly
# Only internal redirects are al... |
Replacing Nginx with node.js for the import of large files? | I've already foundEvent loop for large files?, but it's mostly about downloads. The conclusion I take from that post is node.js might have been adequate for downloads, but Nginx is a battle-hardened solution that "ain't broke."But what about uploads? We have enormous files being uploaded. We do genomics, and human g... | As the other answer states,formidableis a very solid library for handling uploads. By default it buffers to disk, but you can override that behavior and handle the data as it comes if, if you need. So if you wanted to write your own proxy, node.js + formidable would be a great way to get uploads to stream as they com... |
Multiple apps on nginx | I'm trying to route traffic across multiple upstream servers on nginx like so:upstream app_a {
server unix:/tmp/app_a.sock fail_timeout=10;
# For a TCP configuration:
# server localhost:8000 fail_timeout=0;
}
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:... | location /app_a/ {
rewrite /app_a/(.*) /$1 break;
proxy_set_header Host $http_host;
proxy_pass http://app_a;
} |
How do I use nginx to reverse-proxy an IP camera's mjpeg stream? | I'm using nginx on OpenWRT to reverse-proxy a motion-jpeg feed from an IP camera, but I'm experiencing lag of up to 10-15 seconds, even at quite low frame sizes and rates. With the OpenWRT device removed from the path, the camera can be accessed with no lag at all.Because of the length of the delay (and the fact that i... | I never got this working to my satisfaction with nginx. Depending on your specific needs, two solutions which may be adequate:if you can tolerate the stream being on a different port, pass it through using the port forwarding feature of OpenWRT's built-in firewall.use the reverse-proxy capabilities of tinyproxy. The de... |
Sporadic 400 Bad Request Error nginx/0.7.67 with Heroku and Rails 3 | UPDATE: This bug appears to be Browser Specific to Chrome. I've clicked the link about 50 times each in Firefox and IE and I can't seem to cause it. Also, once it is occurring, I can switch to FF or IE and it'll work fine on those two.I have a particular page in my Rails 3 application on heroku that loads fine for aw... | So after a long back and forth with the Heroku Support staff we finally found the issue. I was using Datatables in various places around my site and using cookies to store user state settings. That cookie was getting longer and longer and longer as a user navigated around the site until my header surpassed the maximu... |
Nginx vs Node.js - reverse proxy for multiple web-sockets servers | I want to host MULTIPLE WEBSOCKETS node servers (separate processes). It may be >1000 simultaneous connections. Also I want to log and control each connection and want to make it MEMORY efficient.
Is it a good idea to write reverse proxy in node.js?
Is it worse in anything than Nginx, pure Erlang or Scala?
Can even Ngi... | Easy answer: nginx does not currently do HTTP/1.1 to upstreams, and thus definitely not websockets (nor does it have threads, but that's another story). A custom websockets proxy based on node.js is probably a good solution. You could also build something in Java; there are plenty of people building websockets services... |
Running Lua scripts using FastCGI | I am currently trying to figure out ways to run Lua scripts using FastCGI with either lighttpd or Nginx. The only thing I was able to dig up yet wasWSAPIof the Kepler project. But I wonder if there are other possibilities. Important for me is:should be as lightweight as possibleshould be stable enough to use in a produ... | I would recommend taking a look at this project:http://github.com/STPeters/luafcgidThere are instructions on how to use it with nginx. |
how to excluded directory from nginx conf? | in nginx conf file,i use:location ~ \.jsp {
proxy_pass http://127.0.0.1:86;
}to parse my jsp file, now,i want excluded directory/upload/this directory is user upload file directory ,don't need parse JSP file.(http://example.com/upload/)how to change mylocation ~ \.jsp {?i need parse JSP*.jspbut excluded/upload/an... | Here is a list of Nginx Core Directives:http://wiki.nginx.org/NginxHttpCoreModuleBy skimming through these I can see there's probably more than one way to achieve this. I can't test it, but here's something that may work:error_page 403 /forbidden.html;
location ^~ /upload/ {
deny all;
}However, I would advise again... |
Rate limiting Django admin login with Nginx to prevent dictionary attack | I'm looking into the various methods of rate limiting the Django admin login to prevent dictionary attacks.One solution is explained here:http://simonwillison.net/2009/Jan/7/ratelimitcache/However, I would prefer to do the rate limiting at the web server side, using Nginx.Nginx'slimit_reqmodule does just that - allowin... | first of all: to secure the django admin a little bit, i always use a url for the admin different to /admin/ a good idea would be to deploy the admin as a second application on another domain or subdomainyou can limit the requests per minute to the whole webapp via IPTABLES/NETFILTER. a tutorial how this is done can b... |
How can I get the remote IP / Client IP using NGINX in Docker ?? Also using Laravel | I am running NGINX as part of a Docker package. It is both a webserver and a reverse proxy, and the container has PHP bundled in with it. The front-end web application is built with Laravel. There are some instances where I want to get the client's IP address, and this seems to a little problematic in some cases. T... | The nginx proxy at the office can be configured to pass the client's IP address using theproxy_set_headerdirective.The nginxreverse proxydocs here show an example:location /some/path/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8000;
}In the config blo... |
Static files not loading for deployed django rest framework | I have built and successfully deployed a django rest framework using gunicorn and nginx on Ubuntu 18.04. However, the static files are not being pulled up.Django web app without loaded static filesHere is my nginx configuration:server {
listen 80 default_server;
listen [::]:80 default_server;
s... | You don't need equals sign here:location = /static/ {
root /home/ubuntu/myprojectdir;
}Instead try this:location /static/ {
root /home/ubuntu/myprojectdir;
} |
Nginx to serve contents of S3 files in browser | I want to open files from S3 served by Nginx in a browser. Was unable to get it working with following configFiles in S3 buckets are text files with extension.manefiestlocation /manefiest/ {
proxy_pass http://my-bucket.s3-website-us-west-2.amazonaws.com/;
types {
text/html manefiest;
text/plain ... | SettingcontentType:"text/plain"for uploaded file solved the problem.Thanks @ofirule |
AWS ElasticBeanstalk Amazon Linux 2 .platform folder not copying NGINX conf | I've been moving over to ElasticBeanstalk using Amazon Linux 2 and I'm having a problem overwriting the default nginx.conf file. I'm following theAL2 docsfor the reverse proxy.They say, "To override the Elastic Beanstalk default nginx configuration completely, include a configuration in your source bundle at .platform/... | Based on the comments.The issue was caused byduplicate locationsof thenginxconfig file. This was due to deleting the nginx default path in.ebextensions, while EB re-creating it.Since this seems as a bug, AWS support ticked was created. |
WebSocket opening handshake timed out in https | WebSocket connection to 'wss://ip_address:8008/ws/events?subscribe-broadcast' failed: WebSocket opening handshake timed outits timed out only when open UI in HTTPS, in HTTP its working...I have generated the certificate using OpenSSL in ubuntumy uwsgi configuration issocket = /tmp/uwsgi.sock
chmod-socket = 666
soc... | For web-sockets to work over Tls(wss) protocol you would need to generate ssl certificates, after generating the certificates add the following line to uwsgi.ini file.https-socket=[ip]:[port], /path_to_server_certificate, /path_to_keyand restart the server (optionally you can also pass 2 more fields [,ciphers,ca])
more... |
How to point iframe to a url within a docker network? | I have two docker containers:web, contains nginx with some static htmlshiny, contains an R Shiny web applicationWhen run, the shiny web-application is accessible through localhost:3838 on the host machine, while the static html site is accessed through localhost:80.My goal is to make a multi-container application throu... | The answer is in your question already:the shiny web-application is accessible through localhost:3838 on the host machineSo start the URL withhttp://localhost:3838. If you need this to be accessible from other hosts or you expect that published port number ever might change, you'll need to pass in a configuration opti... |
How to get NGINX to execute all URL's in a folder via index.php | I have done a load of searching for an answer for this and I cannot find a suitable answer.Basically, I have a site built in SilverStripe running on NGINX. It all works pretty well, but I want any files/images uploaded via the admin (to the assets folder) to be resolved via index.php in the site root (so we can check p... | try_filesneeds two parameters, so you could use a dummy value to replace thefileterm. For example:try_files nonexistent /index.php$is_args$args;Seethis documentfor details.But the neater solution is probably arewrite...laststatement:rewrite ^ /index.php last;Therewritedirective will automatically append the query strin... |
How to run c++ CGI script on NGINX server | I have written below lines in configuration file created in /etc/nginx/conf.d named as "helloworld.local.conf".server{
listen 80 default_server;
server_name hello_world;
location / {
root /var/www/helloworld;
fastcgi_pass 127.0.0.1:9000;
}
}There is an index.html file in /var/ww... | UPDATETake a look at thisblog post. It explains how to setup C++/FCGI/nginx quite thoroughly.ORIGINAL ANSWERYour C++ code should be a listener (when it's running, it should listen to a port and return responses upon incoming requests).
This part doesn't have anything to do with nginx. So first make sure that your code ... |
Vue Router: access page directly from browser address bar | I'm using Vue Router history mode for my Vue.js app. My problem is that, when I try to refresh a page that is not the root page, or enter its URL in the browser address bar, "page not found" 404 is displayed.Now, in the Vue Router guide they warn about this (seehttps://router.vuejs.org/guide/essentials/history-mode.htm... | If you use the aforementioned configuration. Your backend will route all requests to index.html. Then when the Vue-Router is mounted, it will check the URL and provide the corresponding component. The implementation above will work. |
How to install nginx 1.14.X inside docker? | # 1. use ubuntu 16.04 as base image
FROM ubuntu:16.04
# defining user root
USER root
# OS update
RUN apt-get update
# Installing PHP and NginX
RUN apt-get install -y nginx=1.4.* php7.0
# Remove the default Nginx configuration file
RUN rm -v /etc/nginx/nginx.conf
# Copy a configuration file from the current directo... | As pointed out by @larsksUbuntu 16.04supports nginx only till version1.10.3Official wikiwith more detailSo best/safe option would be either move your base OS to18.04or use nginx1.10.3Just for reference how you can install Nginx from src.wget https://nginx.org/download/nginx-1.14.0.tar.gz
tar zxf nginx-1.14.0.tar.gz
cd ... |
Nginx too many redirects when redirecting http to https | I'm trying to redirect http to https. I use letsencrypt for ssl certificates. My config looks like thisserver {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificat... | After I didwget -S https://wellcode.comI assumed that the problem was on the dns so in Cloudflare I changed SSL to full and the problem was solved.Explanation:The-Sflag will output headers and therefore show you the redirects. Example:HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 05 Jan 2021 12:26:55 GMT... |
Nginx: 502 Bad Gateway within docker stack | I have docker stack running 2 containers, first is Nginx, second - application.The problem is that nginx shows Bad Gateway error:Here is nginx conf:upstream example {
server mystack_app1;
# Also tried with just 'app1'
# server mystack_app2;
keepalive 32;
}
server {
listen 80;
server_name example;
... | It looks like your upstream definition is not correct. It's trying to connect to port 80 instead of port 9000.Tryupstream example {
server mystack_app1:9000;
# Also tried with just 'app1'
# server mystack_app2;
keepalive 32;
}Btw, I suggest you to use the container_name in your docker-compose file. |
Where to put nginx configuration file? | I understand that i should put this code in order to make HTML5 History fallback:location / {
try_files $uri $uri/ /index.html;
}https://router.vuejs.org/en/essentials/history-mode.htmlbut to which file? tried search google, nothing works, put above code in /etc/nginx/nginx.conf will make nginx not working.im using v... | Finally, i get nginx work with html5 fallback.open /etc/nginx/site-available/homestead.app, or any domain your specified in your homestead.yaml file.put/replace "location" section withlocation / {
try_files $uri $uri/ /index.php;
}then save, and open laravel web.php (router). put this code:Route::get('/{vue?}... |
Azure Web Application Gateway performance with load test [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, ... | I had to completely disable the firewall to get the consistent performance. I also ran into other issues with the firewall, where it gave us max entity size errors from a security module and after discussing with Azure Support this entity size can not be configured so keeping the firewall would mean some large pages wo... |
Routing behing nginx | I have an angular2 application. All works fine, if I using localwebpack dev server.When I deploy application on the server behindnginxI can navigate using application links. But ifI enter URL to browser URL bar I get404 Not Founderror.Here is an Nginx config for site:server {
listen 80;
server_name mydomain;
... | I have solved my problem by addinguseHashto my router:RouterModule.forRoot(appRoutes, { useHash: true }), |
Too many open files exception on AwS machine with high configuration | My sincere apologies if the question is stupid but I am a novice here (front end developer, recently working on backend).I have my app running on Amazon aws machine. What I want is to efficiently utilize my resources so that more requests are served.I am running a Java vertx server that serves GET and websocket request... | I am assuming that your hard limit and soft limit is set properly. But you are getting this error because the vertx is not able to utilize the full ulimits that you have set.Check what is the maximum limit, your vertx server can use by:cat /proc/PID/limitsMax open files 700000 700000 filesis the line that te... |
Nginx Yii2 configuration in different folders | I faced with problem in configuring nginx server for yii2 basic app.Here is my service block file :server {
listen 80 ;
access_log /var/log/nginx/access-server.log;
error_log /var/log/nginx/error-server.log;
charset utf-8;
location /fetch {
root /usr/share/nginx/html/another_fo... | Further to your comment, any URI beginning with/fetchthat does not match a static file within the aliased path, should be redirected to/fetch/index.php.location ^~ /fetch {
alias /usr/share/nginx/html/another_folder/web;
if (!-e $request_filename) { rewrite ^ /fetch/index.php last; }
location ~ \.php$ {
... |
serving flask via nginx and gunicorn in docker | Playing around with flask I would like to get a real setup up and running in docker. This means flask should be served via nginx and gunicorn. I set up a sample code repositoryhttps://github.com/geoHeil/pythonServingbut so far can't get nginx to work properly.Flask is served onapplication:5000, docker should resolve ap... | Yournginxconfig file is in a wrong location.Steps to fix:sudo docker-compose downDelete nginx image:sudo docker images
sudo docker rmi
REPOSITORY TAG IMAGE ID CREATED SIZE
pythonserving_nginx latest 152698f13c7a About a minu... |
How can I deploy an ingress controller for my Kubernetes cluster | So I built my Kubernetes cluster on AWS usingKOPSI then deployed SocketCluster on my K8s cluster usingBaasilwhich deploys 7YAML filesMy problem is: thescc-ingressisn't getting any IP or endpoint as I have not deployed anyingress controller.According toingress controllerdocs, I am recommended to deploy annginx ingress c... | The answer is herehttps://github.com/kubernetes/kops/tree/master/addons/ingress-nginxkubectl apply -fhttps://raw.githubusercontent.com/kubernetes/kops/master/addons/ingress-nginx/v1.4.0.yamlBut obviously the scc-ingress file needed to be changed to have a host such as foo.bar.comAlso, need to generate a self-signed SSL... |
Docker nginx redirect HTTP to HTTPS | I'm setting up a server using Docker. One container runs an nginx image with SSL configured. A second container runs with a simple node app (on port 3001). I've got the two containers communicating with a --link docker parameter.I need to redirect all HTTP requests to HTTPS. Looking at other threads and online sources,... | Looks like everything was okay. Tried some curl calls to make sure headers were being set correctly (credits to @RichardSmith for recommendation). Also tested in different browsers. Everything worked! Turns out I needed to clear my primary browser's cache. Not sure why, but it resolved the issue!For anyone interested i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.