Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
How to get oauth2_proxy running in kubernetes under one domain to redirect back to original domain that required authentication?
I've been setting up a kubernetes cluster and want to protect the dashboard (running atkube.example.com) behind thebitly/oauth2_proxy(running atexample.com/oauth2on imagea5huynh/oauth2_proxy:latest) as I want to re-use the OAuth proxy for other services I will be running. Authentication is working perfectly but after a...
After searching for a bit I came across ablog postabout performing this in a super simple manor. Unfortunately I found the providedyamldid not quite work correctly as the oauth2_proxy was never being hit due to nginx intercepting all requests (I am not sure if mine was not working due to me wanting the oauth-proxy url ...
nginx ingress Jenkins path rewrite configuration not working
I have deployed Jenkins on Kubernetes and am trying to configure the nginx ingress for it.Assume I want it to be available athttps://myip/jenkinsThis is my initial ingress configuration:apiVersion: extensions/v1beta1 kind: Ingress metadata: name: jenkins-ingress annotations: kubernetes.io/ingress.class: nginx ...
This is how I solved it configuring the Jenkins image context path without the need to use the ingress rewrite annotations:kind: Deployment metadata: creationTimestamp: null labels: app: jenkins name: jenkins spec: replicas: 1 selector: matchLabels: app: jenkins strategy: {} template: me...
NGINX randomly stops working, required manual restart
I have an issue I am not sure how to troubleshoot. My setup:Amazon EC2 (t2.medium) running Ubuntu Linux 16.04 (fully up to date)NGINX 1.10.38 websites running Node JS (Express) that are bound to ports 3000-3007 through pm2, with NGINX as the reverse proxy (proxy_passin virtual host files)PHP 7.1 (to power a Wordpress s...
I encountered a similar issue when using nginx with certbot. I am hosting under Ubuntu 16.04 LTS and certbot is quite outdated (0.10.2).Asdescribed herethis version of certbot suffers an issue when emiting a certificate. The standard commands don't works,specific commandsmust be used.Certbot comes with an auto updater ...
Why should I use a proxy server with Kestrel?
The officialMS-documentationsays that if I want to host an ASP.NET core app on linux I should either put an apache or nginx reverse proxy in front of it. However I cant find any reasons why I should do that.Why should I do that? Why can't it just run on kestrel? Why is the reverse proxy needed?
Kestrel is a very simple web server and doesn't offer the features of something like IIS, Apache, or Nginx. If you want to do things like SSL, Load Balancing, Rate Limiting, etc adding an extra layer in front of it can come in handy.Another benefit is you can host multiple applications on port 80. Nginx will handle t...
Nginx reverse proxy for Docker containers
I have a problem with reverse proxy to my Docker services. I have a local machine with IP 10.0.0.163 and with Docker stack running on it with nginx and portainer (for this question only they matter).docker-compose.yml:... portainer: image: portainer/portainer ports: - "9000:9000" volumes: - "/v...
Try to change nginx configurationserver { listen 80; allow all; location / { proxy_pass http://portainer:9000/; resolver 127.0.0.11; } }portaineris container name defined into yourdocker-compose.ymlfile127.0.0.11is embedded docker DNS serverAlso. Alternative way. You can usejw...
Setting up nginx with multiple IPs
I have my nginx configuration file under /etc/nginx/sites-available/ with two upstreams sayupstream test1 { server 1.1.1.1:50; server 1.1.1.2:50; } upstream test2 { server 2.2.2.1:60; server 2.2.2.2:60; } server { location / { proxy_pass http://test1; } location / { proxy_pass http://test2; } }Sending a curl request ...
You have to have two server directives to accomplish this task:upstream test1 { server 1.1.1.1:50; server 1.1.1.2:50; } upstream test2 { server 2.2.2.1:60; server 2.2.2.2:60; } server { listen 80 server_name location / { proxy_pass http://test1; } } server { ...
How to change the status code of a proxied server response in nginx?
I'm having a hard time configuring nginx to act as a proxy of a public S3 endpoint. My use case necessitates altering the status code of the S3 response, while preserving the response payload.The possible status codes returned by S3 include 200 and 403. For my use case, I need to map those status codes to 503.I have tr...
I found a more or less suitable solution. It's a bit hackish but it works.The key was to set the index document of my S3 bucket to a non-existing filename. This causes requests to / on the S3 bucket endpoint to result in 403.Since the nginx proxy maps all incoming requests to / on the S3 bucket endpoint, the result is ...
nginx proxy_pass dynamic hostname part
When nginx proxy_pass is a dynamic value expected to be build by substituting hostname part in URL, nginx is failing to proxy request with error:no resolver defined to resolveservicewhereservice=$1. Instead of trying to resolve service.abcd.local, it seems it is trying to resolve justservice. Is there solution to this ...
As specified in nginx's docproxy_pass:A server name, its port and the passed URI can also be specified using variables:proxy_pass http://$host$uri;[…]In this case, the server name is searched among the describedserver groups, and, if not found, is determined using aresolver.
How do I run uWSGI as a limited-access user?
I have Django setup in NGINX + uWSGI. I'm able to get it running fine under my current logged in user (with help from aquestionI asked few days back) but now I want torunuwsgi --ini uwsgi.inias a limited-access user.Here is what I've done so far:1. Created a userdjangouserwithout login access and without a home directo...
If you want to run uWSGI as particular user, there are only 2 options:run uWSGI server directly from this userrun uWSGI as root and add uid and gid options.
Nginx page displaying instead of home page (Digital Ocean - LEMP)
I recently bought a DigitalOcean account, and am attempting to set up my web site. However, whenever I enter the IP address of my site, I get this page:Welcome to nginx!If you see this page, the nginx web server is successfully installed and working. Further configuration is required.For online documentation and suppor...
SimplifyCreate a "Hello world" index.html and copy it into your project's root directory*.Divide and conquerMy suggestion to you is to strip your nginx.conf down to a very simple form, like the one below.server { listen 80 default; server_name yourdomainname.com; root /home/your_app_name/public; try_files $uri...
Django + Gunicorn + Nginx: Bad Request (400) in Debug=True
I'm trying to run my server with Django, nginx and gunicorn. On the development Server, everything went fine. But on the production server, gunicorn always returns a Bad Request (400).I'm aware that I need to set myALLOWED_HOSTSvariable, and I did. I tried the correct domain, an asterisk, or even setting DEBUG to True....
You should tell Nginx to pass the host to Gunicorn like this:proxy_set_header Host $host;Additionally I would pass these values (example) also so you have access to the IP of the request:proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarde...
nginx - rewrite or internal redirection cycle while internally redirecting to "/index.html" [closed]
Closed.This question isnot reproducible or was caused by typos. It is not currently accepting answers.This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may beon-topichere, this one was resolved in a way less likely to help future readers.Closed10 years ago.Improve...
Okay resolved. The issue was thelocation @handler { rewrite / /index.php }Removed it and all is well again.
nginx proxy_pass to localhost
I'm trying to use proxy_pass in nginx to forward requests to another port on localhost like this:location /foo { rewrite ^/foo/(.*) /$1 break; proxy_pass http://127.0.0.1:8080/; } location /bar { rewrite ^/bar/(.*) /$1 break; proxy_pass http://localhost:8080/; } location /blah { rewrite ^/blah/(.*) ...
This worked:location /blah { rewrite ^/blah/(.*) /$1 break; proxy_pass http://$server_addr:8080; }
does nginx support compress the request to the upstream?
Dose nginx supprt this ? Whoul you please show me some configuration of it?[Client] [Nginx Reverse Proxy] [BackEnd] | [Raw Post] | [gzip encoded request] | |--------------------> | ----------------------------->| | | ...
Apparently there is some way to do this. Nginx has agunzipmodule that gzip decompresses responses:The ngx_http_gunzip_module module is a filter that decompresses responses with “Content-Encoding: gzip” for clients that do not support “gzip” encoding method. The module will be useful when it is desirable to store ...
Foreman Cannot Start Nginx, But I Can Start it Manually. Why?
I am currently runningForemanon staging (Ubuntu) and once I get it working will switch to using upstart.My Procfile.staging looks like this:nginx: sudo service nginx start unicorn: bundle exec unicorn -c ./config/unicorn.rb redis: bundle exec redis-server sidekiq: bundle exec sidekiq -v -C ./config/sidekiq.ymlI can suc...
The is a problem in your Procfile.Thenginxcommand can't usesudoinsideforeman, because it willalways ask for a passwordand then it will fail. That's why you are not startingnginxand the logs are empty.If you really need to use sudo inside a procfile you could use something like this:sudo_app: echo "sudo_password" | sudo...
How to configure nginx to serve gitlabhq on a SubURI
The nginx configuration for gitlab is:# GITLAB # Maintainer: @randx # App Version: 3.0 upstream gitlab { server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket; } server { listen YOUR_SERVER_IP:80; # e.g., listen 192.168.1.1:80; server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com...
As of Gitlab 5.3 you can configure it to run in a suburi out of the box using the official installation document.Uncomment line 8 of config/puma.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/"Similarly for line 23 in config/gitlab.yml: relative_url_root: /I didn't have to modify my nginx config at all for it to work.
Nginx redirect to an external URL
What I'm trying to do is route all requests to/rdr/extern_urlto redirect toextern_urlthrough my web server instead of doing it through PHP.location /rdr { rewrite ^/rdr/(.*)$ $1 permanent; }What's wrong here is it if I accesshttp://localhost/rdr/http://google.commy browser is telling me:Error 310 (net::ERR_TOO_MANY...
Trivial check:$ curl -si 'http://localhost/rdr/http://www.google.com' | head -8 HTTP/1.1 301 Moved Permanently Server: nginx/1.2.0 Date: Sun, 05 Aug 2012 09:33:14 GMT Content-Type: text/html Content-Length: 184 Connection: keep-alive Location: http:/www.google.comAs you can see, there is only one slash after scheme inL...
Running capybara with nginx
Is is possible to run capybara with nginx and passenger? instead or webrick? Capybara is installed with cucumber in a rails app.
It is easy - the only thing you have to do is to switch your mind - neither capybara nor cucumber are not tied to local environment you can test application that is located in internet and it will not care about it - you can even test google.com if you want.For your particular problem you'll have to setCapybara.run_ser...
nginx and proxy_pass - send Connection: close headers
nginx seems to be replacing theConnection: closeheader that upstream is sending, and replacing it with aConnection: keep-aliveheader. Is there any way I can override it?http { upstream main { server 127.0.0.1:8000; } server { listen 443; ssl on; ssl_certificate server.crt; ssl_certificate_key ...
Settingkeepalive_requests 0;convinced nginx to sendConnection: close.
Nginx as a reverse-proxy while long-polling
I've got apache as a back-end server, which runs php scripts and nginx as a reverse-proxy server which deals with static content. A php-script, which gives me ID of some process and then performs this process (pretty long). I need to pass to browser only the ID of that proccess.// ... ob_start(); echo json_encode(...
Have you tried proxy_buffering off in nginx? Not sure it will close the connection but at least the response will be transmited as is to the client. :-)
Deploy angular application on nginx server with Docker Welcome to nginx
I developed anAngular 7application and now I'm going to deploy it on production server on an nginx server. I'm pretty new to frontend deployment onnginxserver, so probably I'm missing something easy to find. I decided to useDockerto manager the deployment.The application name isMyWalletFe.nginx server configuration fil...
you can add the command to remove the default nginx index page just before copyingCOPY ./conf/default.conf /etc/nginx/conf.d/default.conf RUN rm -rf /usr/share/nginx/html/* <--- add this COPY --from=builder /app/dist/ /usr/share/nginx/htmland change your nginx config to :try_files $uri $uri/ /index.html =404;
Send nginx logs to both syslog and stdout/stderr
By default, mynginxserver is plotting logs tostdoutandstderr.I want to forward logs to my syslog server, and I'm doing so successfully, fromnginx.conf:server { ... error_log syslog:server=localhost:5447,facility=local7,tag=nginx_client,severity=error; access_log syslog:server=localhost:5447,facility=local7,tag=ng...
Just have multiple error_log and access_log entries inside your blockerror_log syslog:server=localhost:5447,facility=local7,tag=nginx_client,severity=error; access_log syslog:server=localhost:5447,facility=local7,tag=nginx_client,severity=info; error_log stderr; access_log /dev/stdout;Should do the trick
Nginx returns 400 error in Safari
I'm trying send form withContent-type: multipart/form-data. All works fine in the Chrome, FF, Edge but not in Safari. It gets 400 from nginxUsed Laravel + Nuxtjs + AxiosAfter enabling error_log debug in the nginx conf I see[info] 11687#11687: *1 client prematurely closed stream: only 767 out of 907 bytes of request bod...
This is actually a bug on Safari. As ofWebKit build r230963this is fixed, but there hasn't been an update on Safari yet. In case you want to keep compatible behavior you need to remove file fields that are empty from form data sent in your axios request.Something like:$('#myForm').find("input[type='file']").each(functi...
How to enable CORS in nginx
I got stuck that I don't know how to enableCORSinnginx? Honestly, I've found so many solution to enableCORSin nginx and one of them ishttps://enable-cors.org/server_nginx.htmlbut I've added those code inside my/etc/nginx/nginx.confand restartnginxserver. But I've tried inside postman again and following error raised by...
This is in no way a secure solution... but this is what I have currently in my set up and it is working. Maybe you can modify it to your needs. Feel free everyone to tell me how wrong it is and maybe we can get a better solution for everyone.location / { dav_methods PUT DELETE MKCOL COPY MOVE; # Preflight...
proxy_pass based on headers without using if condition
I'm looking for a way to reroute all requests that have set an account-id in the HTTP headerAccount-IDwith the last two digits (of a ten digit number)00to05(to touch only 5% of the total traffic). In addition, if a request has set the HTTP headerServer-A, that request should be forwarded to that server regardless of th...
You can actually chainmapdirectives a which would make it cleaner. For example:map $http_server_a $server_a_check { default "http://server-b.company.com"; "" "http://server-a.company.com"; } map $http_account $account_check{ default $server_a_check; ...
What does this UWSGI output mean? > "(X switches on core 0)"
I'm running anginxwithuwsgiapplication withdjangothat used thesqlitestructure.When runninguwsgi, when aGETorPOSTrequest is made, it sends output such as:[pid: 29018|app: 0|req: 39/76] 136.61.69.96 () {52 vars in 1208 bytes} [Wed Jul 19 17:25:12 2017] POST /binaryQuestionApp/?participant=A3AJJHOAV7WIUQ&assignmentId=37QW...
Presumably you have found the answer, but for anyone that lands here looking for the answer I found this:"core" is the low-level concept for uWSGI concurrency context in a process (can be a thread or a greenlet or a fiber or a goroutine and so on...) while switches count is incremented whenever an app "yield" its...
nginx responding "301 moved permanently"
Consider the following nginx config file:server { listen 443; ssl on; ssl_certificate /etc/tls/cert.pem; ssl_certificate_key /etc/tls/key.pem; location / { proxy_pass http://api.default.svc.cluster.local; } }All incoming TCP requests on 443 should redirect to my server running ona...
As mentioned in the question, trailing slashes in URIs are important. I fixed this in the location, however, I didn't add it to the URI I pass usingproxy_pass.As for the nginx proxy I got it to work using the following config:server { listen 443; ssl on; ssl_certificate /etc/tls/cert.pem; ssl_cer...
403 Forbidden nginx/1.11.9 - Laravel 4
I kept getting403 Forbidden nginx/1.11.9I already run :sudo composer updateI think I set up proper permissions.-rwxrwxrwx 1 root root 149 Feb 24 03:45 .gitignore -rwxrwxrwx 1 root root 12 Feb 24 03:45 .gitattributes -rwxrwxrwx 1 root root 146 Feb 24 03:45 CONTRIBUTING.md drwxrwxrwx 15 root root 4096 Feb ...
I had it asroot /home/forge/distributor-application/laravel;I updated it toroot /home/forge/distributor-application/laravel/public;Final lookserver { listen 80 default_server; listen [::]:80 default_server; server_name default; root /home/forge/distributor-application/laravel/public; ... }My site is...
Laravel + AngularJS Nginx routing
I have the following issue, I need to configure Nginx, so on any URL user accesses, it will keep the uri (exampledomain.com/some/url/), but pass to laravel only/and let Angular handle the routing.Route::get('/', function(){ return view('index'); });And when accessing/api/{anything}Laravel will kick in.For now I retu...
You can't achieve you goal with simple rewrite. Laravel always knows about the realURI.The key point is that you need to handle all requests with just one route. Laravel uses$_SERVER['REQUEST_URI']variable to route and it is passed to Laravel fromfastcgi. The variableREQUEST_URIis set infastcgi_paramsfile from nginx's$...
meaning of nginx user directive
A nginx is installed on AWS EC2 running ubuntu 14.04. the/etc/nginx/nginx.conffirst line saysuser www-data;.Is there such a system user on my EC2 instance? if not. what value is given to this directive? Thanks
The "user" directive defines with which user Nginx will run the web server process. You may start Nginx with root, but it will launch sub processes owned by the specified user.If the www-data user does not exist, you can create it. Or, you can specify any other user. But it is better that a web server has a dedicated u...
Puma without nginx - multiple ruby applications on the same IP:PORT
Nginx importance in production was normally based on its ability to serve slow clients; In the setup of RESTful API it seems to be an unnecessary layer to the production stack, especially as Puma (unlike the widely used unicorn can handle nginx work).Puma can allow multiple slow clients to connect without requiring a w...
You can't, Puma is an application server.On the TCP/IP stack each application gets assigned to a port so that a received packet can be proxied to the application that's expecting it. Imagine that multiple applications live on the same port: There would be no way for an application to know if the receiving packet is rea...
Docker MySQL can't connect to socket
I'm learning Docker and I've a problem trying to connect a Rails app on thepassenger-fullcontainer and amysqlcontainer. Both are linked in a compose fileapp: build: ./rails ports: - "80:80" links: - database volumes: - ./rails:/home/app/webapp database: image: mysql environment: - MYSQL_DATA...
The problem here is with thelinksdirective in yourdocker-compose.ymlfile. You have:links: - databaseThat's basically saying that the linkname:aliasisdatabase:database, according to thedocker-compose.ymlreference.Also, if you read thelinking container docsyou can see that the environments exported to the source conta...
Nginx proxy with Google OAuth 2.0
I have an Ubuntu 14.04 server and I have a meteor application that runs atlocalhost:3000on this server. The public FQDN of my server issub.example.com. The meteor application uses Google OAuth 2.0, I have the following configured in the Google API Console:URI REDIRECTION http://sub.example.com/_oauth/google http://su...
You should rewrite theLocationheaders that your backend sends to Nginx described inhttp://wiki.nginx.org/HttpProxyModule#proxy_redirect, so:proxy_redirect http://localhost:3000/_oauth/google http://sub.example.com/_oauth/google;the other option, that would work for popup-style login as well is to set theROOT_URLenviron...
Serving static HTML files in Nginx without extension in url
root directory = /srv/myproject/xyz/main/in the "main" folder I have few *.html files and I want all of them to point at a url say/test/(which is quite different from the directory structure)this is my very basic nginx configurationserver { listen 80; error_log /var/log/testc.error.log; lo...
Try thislocation ~ ^/test/(.*)$ { alias /srv/myproject/xyz/main/; try_files $1.html =404; }
Nginx: Automatic sub-domain creation if a folder exists
I have this folder: /home/sites/dev/ Nginx serves the content of this folder if I visit "domain.com"But, let's say that if I create a folder inside this folder, for example "wp-test", I want nginx to serve this folder if I visit "wp-test.domain.com"It seems like "ianc" made it work on hisblog post, but I can't get it t...
I made it work! First thing first. I had an error in my config.The lineif (!-d /home/sites/dev/ilundev.no/public/$1) {was wrong, and should beif (!-d /home/sites/dev/$1) {And, I had to set up a wildcard entry to my domain, at my domain provider. The entry looked like "*.ilundev.no" and I used the "A" option - and it w...
Nginx node.js express download big files stop at 1.08GB
I have this node.js app proxied by Nginx (on production). A route is something like this:exports.download = function(req, res){ var id = req.params.id; if (id && id == 'latest') { res.download(config.items.release_directory+'/<1.6GB-file>.zip', function(err){ if (err) { ...
Herethe matter is nginx configuration, not nodejs code.nginx write temp files in disk before sending them to the client, it's often a good idea to disable this cache if the site is going to serve big static files, with something like:location / { proxy_max_temp_file_size 0; }(no limit)
nginx configuration for PlayFramework static files [closed]
Closed.This question does not meetStack Overflow guidelines. It is not currently accepting answers.Closed10 years ago.This question does not appear to be abouta specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic onanother St...
Assuming the play app is running on the same machine as Nginx - and is listening on port 9000upstream play_app { server 127.0.0.1:9000; } server { listen 80; location / { proxy_pass http://play_app; } }This will route all requests from port 80 via nginx - to the play app on the same machine on port 9000...
Getting part of nginx url as "variable"?
I currently have this rule in mynginxconfig:location /tun { proxy_pass http://url.domain.com/mp3.mp3; proxy_set_header X-Real-IP $remote_addr; }Which i use for tunneling in a private project. However, i want to make it dynamic.I am looking for something like this:location /tun/$URL$ { proxy_pass $UR...
Try this:resolver 8.8.8.8; location ~* ^/tun/(.+)$ { proxy_pass http://$1; proxy_set_header X-Real-IP $remote_addr; }
What's $0 in nginx? (mod_rewrite)
I'm trying convert my Apache rewrite rules for my new nginx webserver, but I'm having problems translating this particular line:RewriteRule ^(arin|barry|john|ross|danny).*$ /share/$0 [NC]As for my old Apache server, this rule causedhttp://example.com/danny/awesomeVideo.avito viewhttp://example.com/share/danny/aw...
Try use$urior$request_uriinstead$0
NGINX => serve several applications on a single host name with sub-uris
I'd like to serve several applications from the same server, reversed-proxied through nginx. I'd like these applications to be available through a single domain name with sub-uris.e.g.www.mydomain.com/nodejs=> caught by nginx listening to port 80 and served through to a node.js app running on port 3001www.mydomain.com/...
How about:upstream nodejs { server 127.0.0.1:3001; } upstream rails { server 127.0.0.1:3002; } server { listen 80; location /nodejs { proxy_pass http://nodejs; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP ...
How can I avoid getting a 502 Gateway Error while restarting php-fpm?
When restarting the php-fpm service on my Linux system, the PHP CGI process take a while to shutdown completely. Until it does, trying to start a new PHP CGI instance fails because port 9000 is still held by the terminating process. Accessing the site during this time results in a 502 Gateway Error, which I'd like to a...
Run two instances of php-fpm, describe it in oneupstreamsection.upstream fast_cgi { server localhost:9000; server localhost:9001 backup; }Change nginx.conf, to usefastcgi_pass fast_cgi;. After that, if you restart one instance, nginx will process request through second php-fpm instance.
uWSGI vhost problem
uWSGI config[uwsgi] socket = /tmp/uwsgi.sock chmod-socket = 666 processes = 1 master = true vhost = true no-site = trueNginx configserver { listen 80; server_name www.site1.com; location / { include uwsgi_params; uwsgi_pass unix:/tmp/uwsgi.sock; uwsgi_param UWSGI_PYHOME /var/...
The problem ending up being that using an INI config file results in uWSGI running in single interpreter mode. The exact same config in XML allows everything to work correctly. The uWSGI developer this would NOT be the case in future versions.
uwsgi + django via Nginx - uwsgi settings/spawn?
I am leaning towards uwsgi+nginx for my Django app, can anyone share the best method for starting up my uwsgi processes? Does anyone have experience tuning uwsgi?
Launchd on OSXUpstart/init on the unices.uwsgi also has its own process manager, so you can just run that as well.Tuning:Check themailing list, for advice on your particular requirements. Uwsgi is amazing, it is a complete deploy solution.Nginx above 0.8.40 will build the uwsgi bindings by default, Build nginx, build ...
missing http headers in web server
Am using BaseHTTPRequestHandler http server and copy/pasted the code from the interwebs. Here's the part where the response/header is setclass S(BaseHTTPRequestHandler): def _set_response(self): self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers()But w...
I am not familiar with BaseHTTPRequestHandler but I will try to help with the curl response as I had pretty similar issue few days ago.Did you try to run curl with http flag set to 0.9?curl 'http://your-domain.com' --http0.9Maybe your server does respond with HTTP/0.9. Since curl 7.66.0, HTTP/0.9 is disabled by default...
NET::ERR_CERT_AUTHORITY_INVALID in Chrome not incognito and Firefox locally with valid certs on nginx
A couple of weeks ago we implemented the SameSite cookie policy to our cookies. If I want to develop locally, I needed a certificate to get the cookies.We're running a Node express server and that is reversed proxied to an nginx configuration where we add the cert.# Server configuration # server { listen 443; s...
I have some great news!We're using the same cert on our cloud dev environments (however, they are in pfx form). Locally I run Linux as mentioned, and I had to convert the pfx to a RSA file and a CRT file.I entered our dev domain on this site:https://whatsmychaincert.com/and it downloaded a *.chain.crt file. Together wi...
Nexus3 + Nginx Reverse proxy
I am trying to get Nexus3 to run behind Nginx.Nginx is used as a reverse proxy and for SSL termination. When accessing the /nexus path through Nginx, I get multiple errors such as "Operation failed as server could not be reached" and "unable to detect which node you are connected to". Accessing the Nexus UI without g...
If you access the service usinghttp://localhost:8081/nexus, it works.Your current configuration is usingproxy_passto change the URI/nexusto/nexus/. Generally, it is advisable to have a trailing/on both thelocationandproxy_passURIs or on neither of them.For example:location /nexus { proxy_pass http://localhost:8081/...
How to build angular 4 apps in nginx or apache httpd?
Hi I am trying to build the Angular 4 app, steps followed is below -Buildng buildIn my amazon ec2 instance I am running apache. Steps followed -#!/bin/bash yum install httpd -y yum update -y cp dist/* /var/www/html/ service httpd start chkconfig httpd onEverything works but my app is usingauth0for authentication, I see...
Angular apps are perfect candidates for serving with a simple static HTML server. You don't need a server-side engine to dynamically compose application pages because Angular does that on the client-side.If the app uses the Angular router, you must configure the server to return the application's host page (index.html)...
Verify that Nginx is serving static files instead of Flask
I have a flask app runninggunicorn -w 1 -b 0.0.0.0:8000 flaskapp:appwith below nginx config. However, how can I tell if nginx is actually serving the static files or not? I tried changing thealias /home/pi/Public/flaskapp/static/;to.../static-testing/;and just put a placeholderstyle.cssthere but the page seems to load...
So I finally configured the nginx properly. I added root and removed hard path of static, also added log-files that clearly shows that static and css is being loaded from nginx! I also changed the listening port to be 80 (suprise).server { listen 80; server_name myapp.com; root /home/pi/Public/myapp; ...
How to dynamically add an upstream in Nginx?
I mean add anupstreambutnot a server in an upstream.That means I don't have an upstream block like:upstream backend { # ... }I want create an upstream block dynamically. That is something like:content_by_lua_block { upstream_block.add('backend'); upstream_block.add_server('backend', '127.0.0.1', 8080); ...
I found a nginx module calledngx_http_dyups_modulematches my question.
Docker Compose with PHP, MySQL, nginx connection issue
I have problem to connect to MySQL container.docker-compose.ymlversion: '2' services: mysql: image: mysql:latest environment: MYSQL_ROOT_PASSWORD: JoeyW#1999 MYSQL_DATABASE: wiput MYSQL_USER: web MYSQL_PASSWORD: Web#1234 volumes: -...
Change$servername = "localhost";to$servername = "mysql";. Your mysql service isn't on the localhost of your webserver container. You should use the name of the service instead
what does "elts" stands for in nginx source code
I'm reading nginx source code, and I foundeltsis in many data structure declaration, such as:struct ngx_array_s { void *elts; ngx_uint_t nelts; /* some members are omited */ }From the code, I knoweltsis the address of the array that is used to store elements. But I wonder whateltsstands for. After googling a bit. and f...
"elements". Your googling was accurate.
Is Nginx + Node.js + Socket.io + SSL possible?
I'm trying to run a socket.io chat app with nginx as proxy. It works fine when I connect to the server via http+port, but it doesn't work with https. I see user connected/disconnected events pass through, but no emit reach client or server.Here's my server .conf (nginx/1.4.6 Ubuntu)upstream websocket { server 127.0...
Ok, it turned out it was an issue with socket.io's namespaces in node.js code. More info here:http://socket.io/docs/rooms-and-namespacesHere's a working example of the servervar app = require( 'express' )(); var http = require( 'http' ).Server( app ); var io = require( 'socket.io' )( http ); var nsp = io.of('/chat'); ...
Tomcat behind Nginx: how to proxy both HTTP and HTTPS, possibly on non-standard ports?
DescriptionWe're installing some application running Tomcat 6 behind Nginx for different clients. Some of those installations are HTTP only, some HTTPS only, somewhere both. One of those installations has HTTP and HTTPS working on non-standard ports (8070 and 8071) due to lack of public IPs. Application at hand is disp...
Actually what I want really is not possible, so it's required to have two separateConnectortags and two upstreams in Nginx, like so:Tomcat'sserver.xml: Matching Nginx configuration:server { listen 80; listen 443 ssl spdy; location /saiku-ui { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; p...
nginx permission denied while reading upstream - even when run as root
I have a flask app running under uWSGI behind nginx.*1 readv() failed (13: Permission denied) while reading upstream, client: 10.0.3.1, server: , request: "GET /some/path/constants.js HTTP/1.1", upstream: "uwsgi://unix:/var/uwsgi.sock:", host: "dev.myhost.com"The permissions on the socket are okay (666, and set to the ...
Okay! So the problem was, I think, related tothis bug. It seems that even though apparmor wasn't configured to prevent access to sockets inside the containers it was actually doing something to prevent reading from them (though not creation...) so turning off apparmor for the container (following these instructions) wo...
"update-rc.d: /etc/init.d/unicorn_app: file does not exist" in ubuntu 10.04
I am trying configure unicorn + nginx in my ubunton 10.04 in linode for deploy my rails app and when I execute the command:sudo update-rc.d unicorn_app defaultsI get the next error:update-rc.d: /etc/init.d/unicorn_app: file does not existHowever I can see theunicorn_appfile ininit.dfolder. Theunicorn_appfile color is r...
I guess the "red" colour in LS means that unicorn_app is a broken symbolic link. Please tryls -l /etc/init.d/unicorn_app, see if the file it points to exist or not.In addition, you may runfile /etc/init.d/unicorn_appto see if it is a broken symbolic link or not.
Passenger with NginX not registered as service in Fedora
I am running Fedora 16 32bit and I installed passenger with nginx (option 1 during installation, everything was handled for me). Installation went ok, but nginx is not registered as service.The only way I can run it is directly through/opt/nginx/sbin/nginx. There is no possibility to run it via/etc/init.d/nginxIs there...
Create file/etc/systemd/system/nginx.servicewith the content:[Unit] Description=Nginx After=syslog.target network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload [Install] WantedBy=multi-user.targetAfter that you can control it with:sudo systemctl s...
after upgrade to php8.0, nginx still uses php7.2 for PHP-FPM
I'm running Ubuntu 18.04 with nginx/1.14.0. I have been running PHP 7.2 but some of my web applications require a newer php for security reasons.Since it is nginx, I use PHP-FPM.I used apt to upgrade to the latest version of PHP.# /usr/bin/php -v PHP 8.0.2 (cli) (built: Feb 14 2021 14:21:15) ( NTS ) Copyright (c) The ...
in each server, you can define which version of PHP, Nginx should use:location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; }or :location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.0-fpm.sock; }
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib when running nginx and mysql after macOS upgrade to Catalina
I have updated my development enviroment to the latest version of OSX Catalina. Then nginx and mysql server has stopped working. When I try to run any of these I get the same error:dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib Referenced from: /usr/local/bin/nginx Reason: image not foundI´...
I had the same issue, not for upgrading to Catalina but because of installing a program which upgrade my version of OpenSSL, so it brokes other apps which depended on OpenSSL. In my case Ruby (2.3.8 with RVM) and MySQL (MariaDb in fact). In the case of Ruby, it was incompatible with the new version of OpenSSL, so I ha...
Secure https with nginx for Private IP address
Problem :I want to run nginx with https, likehttps://192.168.100.110What I've tried :I've followed the quick guide athttps://www.humankode.com/ssl/create-a-selfsigned-certificate-for-nginx-in-5-minutes, I am able to openhttps://localhostproperly on chrome but i want the self signed certificate to work withhttps://192.1...
Update :So the solution was pretty simple. For IP addresses to work with the Subject Alternative Names we must provide the IP inside of the ext files that are used for creating certificatesubjectAltName = @alt_names extendedKeyUsage = serverAuth [alt_names] DNS.1 = localhost IP.1 = 192.168.98.18Now it's working prop...
Nginx try_files not working for default index.html
I am using $geoip_country_code module of nginx to redirect user based on IP. My config code is as given below-server { listen 80; gzip on; server_name example.com; root html/example; location / { index index.html; try_files /$geoip_country_code/index.html /index.html; ...
The last element of thetry_filesstatement is the default action, which is either a URI or a response code. The/index.htmlstarts a search for a newlocationto process the request, and ends up back at the start, so you have a redirection loop.You can fix the problem by making/index.htmlafileterm instead. For example:try_f...
Show only some files in directory listing with NGINX
I finally figured out how to show a directory listing of a folder using nginx. The problem is that it shows every file and directory in that folder. Is it possible to filter the results? Like show only files with a specific extension or something like that? Thanks
No, theauto-index featuredoes not support filtering. But you can change permissions of the files to not be visible/served, but that only works if you dont want them accessible at all.You could try to manuallymodify the body response with sub_moduleusing regexp that matches files to hide.
IPTables do not block IP with ipset immediately
I have the followingIPTableswithIPSetas rule source to block attackingIP, but when I add an attackingIPtoIPSet, in mynginxaccess log, I still see continuous access of the attackIP. After a while,maybe 3~5 minutes, theIPwas blocked.iptables~$ sudo iptables -nvL --line-numbers Chain INPUT (policy ACCEPT 317K packets, 230...
The reason that a firewall rule may have no immediate effect on blocking traffic may be due tostatefulinspection of packets.It may be inefficient for the firewall to analyse every single packet that arrives in the line, so, for performance reasons, what happens is that the rules the user creates often apply only to the...
Nginx content caching causing Docker memory spike
I'm trying to set up proxy content caching with Nginx inside of Docker, but am experiencing memory issues with my container. The actual Nginx implementation works fine (pages are being cached and served as expected), but as soon as pages start being cached, my container memory (measured with "docker stats") climbs extr...
Wow, I did pretty much the same (checking docker stats and then using graphana with cadvisor and influxDB to plot the increase) with my application(not nginx). And I agree with your conclusion that page cache is contributing to that increase in memory. After some digging into cgroups metrics for that container, I solv...
Enable SSL on Ruby on Rails app with Nginx and Puma
Here is my Nginx conf file:upstream app { server unix:/home/deploy/example_app/shared/tmp/sockets/puma.sock fail_timeout=0; } server { listen 80; listen 443 ssl; # ssl on; server_name localhost example.com www.example.com; root /home/deploy/example_app/current/public; ssl_certificate /etc/letsencrypt/...
TrySSL checkerto check whether the SSL is a problem or not.It will verify your server certificate and tell you where is the problem.
docker compose: rebuild of one linked container breaks nginx's upstream
I'm usingdocker-composewith "Docker for Mac" and I have two containers: one NGINX, one container serving a node-app on port 3000.docker-compose.ymllooks like this:version: "2" services: nginx: build: ./nginx ports: - "80:80" links: - api api: build: ./api volumes: - "./api:/op...
This is becauseNginx caches the DNS response for upstream servers- in your workflow you're only restarting the app container, so Nginx doesn't reload and always uses its cached IP address for theapicontainer.When you run a newapicontainer, as you've seen, it can have a different IP address so the cache in Nginx is not ...
nginx serve multi index files from location
I want to archive that serving variable html file through different uri, below is my config.server { listen 8888; server_name localhost; location / { root html/test index foo.html } location /another { root html/test index bar.html } }I want request forlocalhost:8888/anotherthen responseba...
The filename is constructed from the value of therootdirective and the URI. So in this case:location /another { root html/test; index bar.html; }The URI/another/bar.htmlwill be located athtml/test/another/bar.html.If you want the value of thelocationdirective to be deleted from the URI first, use thealiasdirect...
404 page not found when a url is hit but properly served when opened from the link on index page
I am usingnginx-luamodule withredisto serve static files ofember-app. Theindexfile content is stored inredisas avaluewhich is being properly served bynginxwhen the (root)domain/IPis hit.Ifloginpage is open from link, it gets opened properly. But when opened directly by hitting the url bar or refreshing the page the ngi...
Following nginx location block has to be added in order to serve the subroutes from index file being served from redis. A detailed explanation and full nginx config can be foundhere.# This block handles the subrequest. If any subroutes are requested than this rewrite the url to root and tries to render the subroute pag...
Setting up nginx to support custom domain name
I have a Django web application hosted on a VM with the Debian-based Ubuntu as the OS, and nginx reverse proxy + gunicorn as the webserver.The DNS of this web application ismyapp.cloudapp.net. I also have a ccTLDmydomain.pkI need to be configured as a custom domain name for this web application.My original registrar on...
Remove theserver_nameline, it's not needed in nginx unless you want to serve different content depending on the host name you receive.If you remove that line, nginx will answer any request that arrives to your server at the proper port (80 in this case), coming withmyapp.cloudapp.netormydomain.pkin theHostheader.This a...
Nginx variable for physical server name
I'm trying to setup response headers on my separate webservers that outputs the physical name of the machine that nginx is running on, so that I can tell which servers are serving the responses to our web clients.Is there a variable that exists to do this already? Or do I just have to hardcode it per-server :(
You're after the$hostnamecommon variable. Common variables are listed in thevariable index.Thenginx access log documentationonly shows variables that are specific to the access log:The log format can contain common variables, and variables that exist only at the time of a log write.
apache .htaccess to nginx rewrite rule
I need to change from apache to Nginx but the.htaccessdoesn' work on the Nginx server.I got following in my Apache.htaccess:RewriteEngine On # always run through the indexfile RewriteRule .$ index.php # don't let people peek into directories without an index file Options -IndexesWhen I put a.htaccesson the Nginx ser...
Nginx doesn't have htaccess files. The code needs to go into the nginx config file. Also, try adding the "last" flag to the rewrite:# nginx configuration autoindex off; location / { rewrite .* /index.php last; }
Nginx: Limit number of simultaneous connections per IP to backend
We use nginx with an application server as a backend.We need to limit number of simultaneous connections per IP to backend. We usedlimit_connnginx directive for this purpose. But it doesn't work well in all cases. If user generates a lot of connections from one IP and quickly closes them, then nginx passes this reques...
You may want to setproxy_ignore_client_abort off;Determines should the connection with a proxied server be closed if a client closes a connection without waiting for a response.from thedocumentationAnother suggestion is to uselimit_reqto limit the request rate.
What is a good strategy for accessing an API which is limited to a static IP Address from Heroku?
I need my app to be able access an third party API who limits access based on a single, static IP Address.Due to the dynamic nature of the Heroku dynos and routing mesh, this is not possible - I'll need something with a fixed IP Address to act as a proxy.An US East EC2 Linux/Nginx instance would seem the sensible choic...
Ok so after a bit of research I've discovered the best way to do this currently is indeed with an AWS US East EC2 instance running some sort of proxy. I've gone with linux/nginx.I've also learned there is a Heroku add-on currently in alpha stage of development that will handle exactly this requirement. If you'd like to...
nginx with flask and memcached returns some garbled characters
I'm trying to cache Python/flask responses with memcached. I then want to serve the cache using nginx. I'm using flask code that looks something like this:from flask import Flask, render_template from werkzeug.contrib.cache import MemcachedCache app = Flask(__name__) cache = MemcachedCache(['127.0.0.1:11211']) @app....
Yay, I fixed it! The nginx configuration was correct before I changed chunked, the python/flask code however should have been:@app.route('/') def index(): rv = cache.get('request:/') if rv == None: rv = render_template('index.html') cachable = make_response(rv).data cache.set('request:/'...
Deploying two different Play! applications on the same hostname
I have developed 2 applications with Play Framework, accessing different information, so it does not make sense to merge then as a single app.Now I need to deploy both apps on the same hostname, each one in a separate sub-folder (URI), for example: example.com/payment/ example.com/cms/And I am having problems with rout...
If you take a look atthis threadon the Google Groups, you will see that the preferred approach is to the the context path.The recommendation is to use a bootstrap job to set the context per application in the following wayPlay.ctxPath="/project1"; Router.detectChanges(Play.ctxPath);So your code would bePlay.ctxPath="/c...
Can't force Rails into production environment via Passenger/Nginx
I'm having trouble getting a Rails app to run in the production environment via Phusion Passenger on Nginx/Ubuntu. According to thedocs, the environment is controlled by the rails_env option in nginx.conf ... but it runs in development mode on our box regardless of whether we specify 'rails_env production;' or leave i...
Workaround found athttp://groups.google.com/group/phusion-passenger/browse_thread/thread/f91cd54bd379ad26/0a510133a080daacAdd to config.ru:ENV['RAILS_ENV'] = ENV['RACK_ENV'] if !ENV['RAILS_ENV'] && ENV['RACK_ENV']
How to fix 502 Bad Gateway Error in production(Nginx)?
When I tried to upload a big csv file of size about 600MB in my project which is hosted in the digital ocean, it tries to upload but shows 502 Bad Gateway Error (Nginx).The application is a data conversion application.This works fine while working locally.sudo tail -30 /var/log/nginx/error.logshows[error] 132235#132235...
This error can indicate multiple problems. The fact it works for you locally strengthen the probability the issue relies on the nginx side.You can try to solve it by increasing the timeout thresholds (as suggestedhere), and the buffers size. Add this to your server's nginx.conf:proxy_read_timeout 300s; proxy_connect_ti...
k8s reverse proxy secure upstream with self signed cert nginx
k8s ingress controller doesn't pass certificate to upstream https service.with nginx i could achive with something like thislocation /upstream { proxy_pass https://backend.example.com; proxy_ssl_certificate /etc/nginx/client.pem; proxy_ssl_certificate_key /etc/nginx/client.key; }Am i miss...
Issue in my case was indeed the cert as log says. documentation was not clear! I has to create generic secret for certs with ca because my certificate is self signed.kubectl create secret generic proxy-ca-secret --from-file=tls.crt=client.crt --from-file=tls.key=client.key --from-file=ca.crt=ca.crtmistake it did was ha...
HTTP response codes 500 vs 502 vs 503?
Gone throughHTTP response codes.. and understands the what these response codes(rcodes) stands forBut I am not sure what rcode will be sent to client/consumer(say browser) in below scenario. I am using NGINX as reverse proxy and Apache as HTTP server running web application(say app) behind the NGINX.Couple of scenario...
NGINX will not alter the 500 from the appas long asit doesn't step on a problem contacting / fetching data from Apache. E.g. it's a perfectly possible situation that your app will generate a 500, but a problem in NGINX communication against Apache will result in a different 50x, so that 50x is the one the client will s...
Nginx redirect rule has no affect
Trying to do a simple redirect:rewrite https://url.example.com(.*) https://example.com/plugins/url permanent;Anytimeurl.example.comis hit, I want it to redirect to that specific path.EDIT:Will try to explain this better, as I'm trying to redirect to a specific domain from another.server { server_name example.com pl...
Redirect from subdomain to subfolder on main siteDo you require a redirect from a subdomain to a subfolder on the main site?This would be best accomplished by a separateservercontext, with the appropriateserver_namespecification.Else, you could also do this with anifstatement testing against$host.As already pointed out...
How can I put basic auth on specific HTTP methods in ngnix ingress?
I can create ingress with basic auth. I followed the template from kubernetes/ingress-nginx:apiVersion: extensions/v1beta1 kind: Ingress metadata: name: ingress-with-auth annotations: # type of authentication nginx.ingress.kubernetes.io/auth-type: basic # name of the secret that contains the user/passwo...
I just encountered the same problem. I solved it by using a configuration-snippet.apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: my-cors-auth-ingress annotations: nginx.ingress.kubernetes.io/configuration-snippet: | # fix cors issues of ingress when using external auth service if ($r...
How to configure nginx to support signalr3 under cloudflare?
I am struggling with signalr3 and nginx reverse proxy configuration, my nginx cfg looks like this:server { listen 80; server_name my.customdomain.com; location / { root /pages/my.customdomain.com; index index.html index.htm; try_files $uri $uri/ /index.html =404; } ## send request back to kestrel ## loca...
This is a websocket based app so you need additional nginx configlocation / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; #proxy_set_header X-Forwarded-Proto https; proxy_pass 127.0.0.1:8080; pro...
HAProxy dynamic server addresses
We have Similar setup to this diagramWhere request arrives to HAProxy, it get's roundrobin balanced to any servers, backend server checks its cache and if resource is not on that server it issues redirect with header set to the correct server IP.Second time request arrives to HAProxy, it detects that the header with ba...
Assuming you're happy with trusting the IP in the header of the second request, then yes, you can do it withuse-server:backend bk_foo [...] server srv_0a_00_01_05 10.0.1.5:80 weight 100 server srv_0a_00_02_05 10.0.2.5:80 weight 100 use-server %[req.hdr(x-backend-ip),lower,map_str(/etc/haproxy/hdr2srv.map,srv_an...
Multi-host deployment of ASP.NET Core applications
I am quite confused as I haven't seen any blogs or instructions on how to host ASP.NET Core/.NET Core applications with HA and multi-host deployments. All examples are either:1) One NGINX reverse-proxy, one Kestrel 2) One IIS reverse-proxy, one KestrelAnd both components on same host. In real-life production environmen...
I have a setup with one VM using (IIS as LB) + several VMs with (IIS + Kestrel). It's working fine for my usage, but I'm curious to see if other people have different suggestions. Then it depends on what you are doing, if you use encryption, machine key needs to be shared between VMs, you might also needs to share sess...
Calling insecure endpoint from a website runs under HTTPS - nginx
My application is running under HTTPS with a valid certificate from one of the known authorities. Unfortunately I am using a third party API which doesn't support HTTPS.The result is the known message Mixed content: mydomain.com requested an insecure XMLHttpRequest endpoint.Is it possibleto add an exception to the we...
I too had this issue. Everything on a page should come and request https if you are using https and don't want warning/errors. You don't need to implement an api to proxy if you are using nginx. Whatever you implement will be performance hit as you correctly surmise. Just use proxy pass in nginx. In our configuration, ...
nodejs app accessible on port 3000 behind nginx reverse proxy
I am running a nodejs application with nodejs app an server listening on port 3000. I use nginx as a reverse proxy which also handles ssl. the configuration is listed below (and it seems to me after reading several tutorials and forum posts it is pretty standard). Everything works as expected except from the fact that ...
If you can reach the port 3000 from the outside of the computer this means that you program your Node.js application in a way that the HTTP server is listening on all interfaces. This is not bad per se and by default you should program your applications in this way, because you can't anticipate future changes of the fi...
Where do my Python prints got with Flask deployed under nginx with uWSGI?
Followingthis tutorialI've just setupnginxwithuWSGIto serve my website which I built inFlask, and things work fine for now.I sometimes want to debug something for which I normally use basicprintstatements in the code. Unfortunately I have no idea where the result of these print's go?I've tailed the following log files,...
normal print goes on stdout and Nginx log only stderr.You should use the app.logger module of flask instead. Have a look atthe flask documentation on error handling
Configuring a subdomain on nginx using namecheap
I bought a domain name using namecheap, for simplicities' sake lets' call it example.com. I am running nginx on a Debian based VPS.I want to set up the following configuration(www).example.com points : to var/www/blog(www).static.example.com : points to var/www/staticHowever I can't wrap my head around configuring the...
You have to keep in mind that setting up DNS and configuring nginx are entirely different tasks.The way I like to setup my DNS is to do aCNAMEfromwwwand other subdomains back to the original domain, if they are logically the same, and hosted on the same server. (However, technically, it's incorrect, because it means t...
How can I restrict access to an application that I do not control only via another referrer application?
Our client has a set of (5-6) intranet/internet applications either custom developed or 3d-party, located in various web servers, whichapplications we cannot modify/control.We have developed a web portal application (A) and the client wants that all itsother applications (B) are accessed only via A, meaning that if a u...
there are different approaches here:1. using firewall setup access to B http{s} port only from A IP address.2. set Directory restriction in httpd.conf for aps B directory like: AllowOverride None Order allow,deny Allow from in APS A create link (http://ip_A/accesstoB/somepath/script.php) that will Proxied to ...
Nginx Load Balancing
I want to load balance my website with nginx.The load balancing in nginx wiki is proxy, so the actual file being downloaded from the frontend server. (http://wiki.nginx.org/LoadBalanceExample)This is how I need the balancing:user request file:http:// site.com/image1.jpgnginx redirect user to one of the servers (with Lo...
http { split_clients "${remote_addr}" $server_id { 33.3% 1; 33.3% 2; 33.4% 3; } server { location ~* \.(gif|jpg|jpeg)$ { return 301 "${scheme}://s${server_id}.site.com${request_uri}"; } }
nginx django 502 bad gateway
I am using uWSGI and Nginx to server up my Django website (1.4 version). My file structure is django_mysite/django_mysite/ in which there is a wsgi.py file.I keep getting 502 Bad gateway errors. I have other servers running of nginx and they are working fine.My nginx config:server { listen 80; server_name be...
The solution I found was this: the uwsgi.ini file that I made to create the uwsgi workers didn't specify a socket. So I made another .ini file and made a socket for it. That same socket I placed into the nginx conf file under uwsgi_pass. Here is a link to django's webpages for configuring uwsgi.https://docs.django...
"websocket connection invalid" when using nginx on node.js server
I'm using Express.js to create a server to which I can connect using web sockets.Even though it eventually seems to work (that, is connects and passes an event to the client), I initially get an error in Chrome's console:Unexpected response code: 502On the backend, the socket.io only logswarn - websocket connection in...
nginx has some kind of Web Socket support in unstable 1.1 branch only. See Socket.IOwiki.Afaik there are currently only few stable Node.js based http proxies that support Web Sockets properly.Check out node-http-proxy (we use this):https://github.com/nodejitsu/node-http-proxyand bouncy:https://github.com/substack/bounc...
nginx/fastcgi 504 gateway error, increasing fastcgi_read_timeout isn't helping
I need the timeout to be high so I can use a debugger on my source code. It's getting passed to fastcgi from nginx correctly, butalwaystimes out after 60 seconds. I've changed as many timeout parameters as I could find, restarted nginx and fast-cgi after every change and nothing worked.I see most users point question...
Have you checked themax_execution_timevalue inphp.ini?That's the only other configurable value I can think of that might be causing a timeout.
Nginx: log the actual forwarded proxy_pass request URI to upstream
I've got the following nginx conf:http { log_format upstream_logging '[proxied request] ' '$server_name$request_uri -> $upstream_addr'; access_log /dev/stdout upstream_logging; server { listen 80; server_name localhost; location ~ /test/(.*)/foo { proxy_p...
If not production, you can test what is being sent by nginx after launching the simplest listening server on the desired local address and port (instead of a real one):$ nc -l 127.0.0.1 3000 POST /some/uri HTTP/1.0 Host: 127.0.0.1 Connection: close Content-Length: 14 some payloadResponse can be simulated by manually e...
How to have Nginx to proxy pass only on "/" location and serve index.html on the rest
I have a web app that uses Django for the backend and some frontend and ReactJS for stricly the frontend. I am setting up my Nginx configuration and I am trying to get Nginx to proxy_pass only on the "/" location and then on the rest of the locations I want it to serve the index.html file from React.Here is my current ...
Just change it to the following: (replacing the last three location blocks)location = / { include proxy_params; proxy_pass http://0.0.0.0:8000; } location / { try_files $uri $uri/ /index.html; }Thelocation = /only matches the exact domain, everything else will be matched bylocation /.
Run Ghost in a subdirectory of my main Node.js application
I am trying to run Ghost on a subdirectory of my main Node.js project. It is currently hosted in azure websites.Something like:http://randomurlforpost.azurewebsites.net/blogI followed the instructions here:https://github.com/TryGhost/Ghost/wiki/Using-Ghost-as-an-NPM-moduleWith the new addition of using Ghost as a npm m...
I've been having the same issue and first tried using Apache's ProxyPass to redirect/blogtoport 2368but found other issues doing this.Before trying my suggestions you should undo any changes made usinghttpproxy.What seems to have worked for me is placing the code you have inindex.jsdirectly into yourapp.jsfile instead ...
upstream prematurely closed connection while reading response header from upstream, client
I'm getting this error from/var/log/messageson my FreeBSD box. I'm usingnginxandspawn-fcgiwithmemcacheandapcmodules enabled.upstream prematurely closed connection while reading response header from upstream, client HTTP/1.1", upstream: "fastcgi://unix:/tmp/fcgi.sock:", host:
It was related to the version of PHP. I have used latest version of nginx and slightly old version of PHP. The issue has been fixed by updating PHP to latest version.
301 Redirect on nginx machine running non-standard port behind a proxy
I have an nginx server processing PHP requests, but it's configured to listen on a non-standard port (port 12345 or something). I can't change the listen port because corporate IT says, "No."There is a proxy in the data center that forwards requests from www.domain.com:80 to the nginx box on port 12345.I have some stat...
You can provide a more explicit rewrite. Try the following:rewrite ^/foo/ $scheme://www.domain.com:80/bar$request_uri permanent;I have assumed that you meant to use^/foo/instead of^/foo$, since^/foo$is a very specific case. Just revise as needed.
Omniauth and open_id with Google broken when running behind nginx in SSL mode
Rails 3.0.12, newest omniauth, I can connect to Google and get the user's email address just fine. But then I run that same rails app behind nginx in SSL mode, and it fails with the Google page:"The page you requested is invalid."Is it my nginx config? My omniauth setup?I know theX-Forwarded-Proto: httpsis the special ...
Found your problem, I am still trying to find something cleaner but here is the quick & dirty fix:add this in your config/initializers/omniauth.rb:class Rack::OpenID def realm_url(req) 'https://localhost:3000' end endAnd now for the explanation: when the rack-openid gem builds the request to send to the google ...
How to enable user custom domains in PHP
I'm having a system where users can input their purchased domain into their profile, so when accessing their domain, it should replace their custom domain, e.g.http://domain.com/custom-nametohttp://purchaseddomain.com.So when they access their purchase domain, it should take them to their profileincludingtheir navigati...
You won't merge their domain to your server.In fact, when they will register their domains, they will make it point to your server.On your server configuration, you'll have to dynamically create rules thatimplicitlyredirect the page to the one they created on your server.So, users will seehttp://purchaseddomain.com/on-...
Linux user scheme for a Django production server
I'm currently trying to set up nginx + uWSGI server for my Django homepage. Some tutorials advice me to create specific UNIX users for certain daemons. Likenginxuser for nginx daemon and so on. As I'm new to Linux administration, I thought just to create second user for running all the processes (nginx, uWSGI etc.), bu...
I like having regular users on a system:multiple admins show up in sudo logs -- there's nothing quite like asking a specific personwhythey made a specific change.not all tasks require admin privileges, but admin-level mistakes can be more costly to repairit is easier to manage the~/.ssh/authorized_keysif each file cont...