w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can a server run Nginx for some sites and Apache Nginx Reverse Proxy for others?
server { server_name example.com; location / { # assuming apache is on port 81 for example proxy_pass http://127.0.0.1:81; # to make apache detect the host header proxy_set_header Host $host; } # if you have assets folders, you can let nginx serve them directly, # instead of passing them to apache location /images { # or /css or /js .. etc try_files $uri =404; } } Note: in the case of assets, sometimes some sites serve assets through rewrites, or even handled by the application it self, you can pass it to apache by adding that in the assets location as a fallback like this location /images { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:81; } In apache you create a virtual host <Virtua

Categories : Apache

Gitlab 5.3 behind nginx reverse proxy
Assuming that the git daemon and the nginx daemon are on the same box I believe that the location block should be like the following: location ^~ /git/ { proxy_pass http://127.0.0.1/git; proxy_redirect http://127.0.0.1/git/ /git; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }

Categories : Nginx

nginx websocket reverse proxy configuration
This issue is related with the nginx version. Pleas check nginx -v, to check your version. The followings params are supported after the 1.4 version. # WebSocket support (nginx 1.4) proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; If you are using ubuntu you can install a newer version with this steps: First remove the old version (http://askubuntu.com/questions/235347/what-is-the-best-way-to-uninstall-nginx): sudo apt-get remove nginx sudo apt-get purge nginx sudo apt-get autoremove Then install a new version (https://launchpad.net/~nginx/+archive/development): sudo add-apt-repository ppa:nginx/development sudo apt-get update sudo apt-get install nginx

Categories : Nginx

When using NginX as a reverse proxy, how can i fallback to a maintenance url?
are you using the free version ? I think what you are looking for is in the non-free version called NGINX Plus. Advanced Load Balancing Application Health Checks

Categories : Nginx

Find and Replace with Nginx Reverse Proxy setup
It's not ideal, as really the source should be rewritten, but you can use sub_filter to rewrite the content of responses for proxied requests. With your example this would be: location /something { ... sub_filter '(111) 123-4567' '(222) 765-321'; sub_filter_once off; } The default behaviour of this is to replace once (which I have disabled in the example) and to only apply the changes to html pages (this is based on the mime type of the response). This is suitable for using in a reverse proxy as it can replace the Location header with the default options, and links when you disable the sub_filter_once option. While this module is not available unless explicitly configured at compile time, it is my experience that any package manager installed nginx has this option enabled.

Categories : Search

Nginx as reverse-proxy: serving files without extension
The problem is, that you need something to identify the files without any extension. A sub-directory or something that’s always present within the request. Your regular expression only matched for requests that start end end with a dot (e.g. http://example.com/.). The following server configuration assumes that all URLs start with storage, as this would be the only possibility to identify those files. Please note that I’m using the try_files directive to rewrite the internal path where nginx should look for the file. The root directive is not meant for what you want to achieve. And last but not least, you should always nest location blocks with regular expressions. There is no limit in the nesting level. nginx will create some kind of tree data structure to search for the best matchi

Categories : Nginx

Extract port number from URL and reverse proxy with Nginx
This may be helpful: server { listen 80; server_name test1.test.com; location ~ ^/app/(.*)$ { proxy_pass http://192.168.154.102:$1; } } Notice: If you visit test1.test.com/app/8081, nginx will pass the request to http://192.168.154.102:8081/app/8081. More information about proxy_pass

Categories : Nginx

Nginx: Response handling and Reverse Proxy with Cache
Actually, location.capture is not designed to do things you doing, but, if I get you correct (you want to send headers that browser send you to subrequest) you, probably, can hack it around using ngx.ctx + set ;) But I'd say it is a very dirty kludgy way.

Categories : Nginx

NGINX Reverse Proxy for upstream Django/Gunicorn Backend
Proxy Buffering Generally proxy buffering is only going to help you if you're generating very big web pages, or sending large files. regardless, it's pretty easy to set up, but you will need to tune the buffer sizes to about the size of your largest pages +20% (Any page that doesnt fit in the buffer gets written to disk), or selectively enable proxy buffering on your largest pages. docs: http://wiki.nginx.org/HttpProxyModule#proxy_buffering Caching I don't know much about your app and how dynamic it's content is, but setting up correct Cache Control/ETAG header generation on your app will be the first thing you'll want to look at. This is what will let Nginx know what is safe to proxy. Also, you may wish to setup multiple cache zones to manage the amount of space your caches take on di

Categories : Django

nginx reverse proxy to access a backend webcam server that requires 2 ports for the URL
You can use this configuration file Proxy pass server for your first port server { listen 80; server_name localhost; #ssl configuration begin ssl on; ssl_certificate /usr/local/nginx/conf/cert.pem; ssl_certificate_key /usr/local/nginx/conf/cert.key; keepalive_timeout 70; #ssl configuration end #proxy pass proxy_pass http://192.168.1.7:70/url$request_uri;//70 is your first port proxy_set_header X-Real-IP $remote_addr; proxy_set_header Request_Uri_X $request_uri; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; } Proxy pass server for your second port server { listen 81; server_name localhost; #ssl configuration begin ssl on; ssl_certificate

Categories : Nginx

How to properly setup nginx as a reverse proxy for gunicorn and flask using subdomains, for both SSL and non-SSL configurations?
server { listen 80 default_server deferred; listen 443 default_server deferred ssl; listen [::]:80 ipv6only=on default_server deferred; listen [::]:443 ipv6only=on default_server deferred ssl; server_name example.com www.example.com testing.example.com; root /path/to/static/files # Include SSL stuff location / { location ~* .(css|gif|ico|jpe?g|js[on]?p?|png|svg|txt|xml)$ { access_log off; add_header Cache-Control "public"; add_header Pragma "public"; expires 365d; log_not_found off; tcp_nodelay off; open_file_cache max

Categories : Python

How to use nginx as reverse proxy to direct localhost:9292 to a sub domain foo.localhost/?
If foo.localhost is your sub domain name and you want to proxy pass sub-domain to main-domain, you can use proxy_pass and you can learn a little more about server directive if needed. An example: server { listem 8080; host sub.main.com; ... location / { proxy_pass http://main.com; break; } } server { listen 8081; host main.com; ... location / { //do something } } This is proxy pass, means when access sub.main.com, actually it finally dealt by main.com, but the client side still shows sub.main.com. If you want client side shows main.com, here should use redirect but not proxy_pass.

Categories : Nginx

Applet stopped working with a JNLP MissingFieldException
After nearly spending two days on that problem I figured it out, hopefully helping others with that. The explanation: My applet runs in the context of a protected web application where a user needs to login with a form login first. After doing so, a session cookie is created and sent back to the client/browser. Since I switched from tomcat 6 to tomcat 7 the useHttpOnly policy for cookies is enabled by default which was disabled for all tomcat versions prior tomcat 7. The HttpOnly flag instructs browsers to prevent access to those cookies from JavaScript/Plugins (security reasons e.g. cross site scripting etc). Now since the java plugin couldn't access the cookie it didn't sent it to the server when requesting the JNLP file. the server returns the loginpage for all unauthorized reques

Categories : Java

How to use reverse proxy on apache for a specific url?
Apache's ProxyPass directive seems to do what you're asking for. You could do something like this in server B configuration: ProxyPass /search http://server-A.example.com

Categories : Ruby On Rails

Reverse proxy with websocket mod_proxy_wstunnel
This line: ProxyPass /my_app/BasicWebsocketServlet ws://1X.X.X.1:8080/my_app/BasicWebsocketServlet retry=0 needs to come before this one: ProxyPass /my_app http://1X.X.X.1:8080/my_app Explanation (from https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass): Ordering ProxyPass Directives The configured ProxyPass and ProxyPassMatch rules are checked in the order of configuration. The first rule that matches wins. So usually you should sort conflicting ProxyPass rules starting with the longest URLs first. Otherwise later rules for longer URLS will be hidden by any earlier rule which uses a leading substring of the URL. Note that there is some relation with worker sharing. In contrast, only one ProxyPass directive can be placed in a Location block, and the most specifi

Categories : Apache

NGINX Proxy to Cloudant
I found the issue. The innocuous looking rewrite rule as the first line rewrites the $request_uri and changes the $uri variable as part of request fulfillment. $request_uri is not changed by rewrite. So when I included that variable in the proxy_pass location, I was not properly including the edited url with the /couchdb/ removed. Changing the proxy_pass line to: proxy_pass http://myusername.cloudant.com$uri; Now works without issue. This was not an SSL problem nor a problem with Basic Authentication nor other http header issue nor a problem with Cloudant. This was all related to the URI I was forwarding my request to.

Categories : Nginx

Is is possible to specify (fake) a User Agent using IIS Reverse Proxy?
The solution was simple enough. In IIS in the URL Rewrite configuration slick View Server Variables... in the right hand column. Click add and enter the name of the Server Variable - in this case HTTP_USER_AGENT. This will allow you to use and/or modify this specific server variable during the routing process. This is the step that I had missed, or gotten wrong before. To my knowledge this can't be done in the web.config file. I'm sure there's a command line to do it, but I don't know that. After adding HTTP_USER_AGENT to the allowed server variables list it is just a matter of setting that either through IIS or in the Web.config file add the desired value to the server variables section. <rule name="..." enabled="true" stopProcessing="true"> <match url="[pattern]" />

Categories : Dotnet

infinite timeout for reverse proxy in Apache
I experienced a similar issue with Nginx and solved it the same way as you did. But I changed the timeout to 1 day as it was sufficiently large in my case. I think you cannot do away with this. The rationale behind this is that Apache (or any proxy server for that matter) has to maintain its performance, which it clearly can't if it has to hold stale or inactive connections. You'd rather let your proxy server proxy more active connections than inactive connections. Therefore, there is no way to turn off the ProxyTimeout in Apache or even in Nginx (configured using proxy_read_timeout). So if your proxied server is not sending any response within the timeout, then either your application server is taking too long to respond or there is something wrong with your application server or the cl

Categories : Apache

Wordpress behind reverse proxy admin issues
$_SERVER['REQUEST_URI'] do not contains the full URL, so you should replace only /wp-admin/. Given your example: $_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/", $_SERVER['REQUEST_URI']);

Categories : Wordpress

Nginx proxy pass and url rewriting
The 1st way that I know of is using a regex against the $args parameter like so: if ($args ~ "^(w+)=") { Or the 2nd way is to use the convenient $is_args like so: if ($is_args != "") { Remember that in both styles you need to put a space between the if and the opening parenthesis; "if (" not "if(" as well as a space after the closing parenthesis and the opening brace; ") {" rather than "){". Full example using the 1st style above, nginx.conf: location ~^/static/photos/.* { include /etc/nginx/proxy.conf; if ($args ~ "^(w+)=") { rewrite ^/static/photos/(.*)$ /DynamicPhotoQualitySwitch/photos/$1 break; expires 7d; proxy_pass http://foofoofoo.com; } } Full example using the 2nd style above, nginx.conf: location ~^/

Categories : Nginx

How to test nginx proxy timeouts
According to the docs the connect timeout cannot be more than 75 seconds, which may explain why it's timing out sooner than you expected. Not positive, however. I've never really done work with the low-level python sockets library so it may be accepting the connection into the pool at a low level before you actually call s.accept() in your program. Send timeout works by measuring time between two chunks of data heading towards the upstream server. Since you're sending the entire response in one chunk I'm guessing in your implementation you're hitting the read timeout again, rather than a send timeout. If you send one chunk, then wait past the send timeout to send the rest of the response and close the connection, you should hit the send timeout.

Categories : Python

How to move redmine to a sub-URI with nginx as a proxy
This is a pretty complicated thing to do. You wouldn't think so but it is. Every single redmine version that comes out has a different set of correct and incorrect ways of accomplishing this. For example, I have a working configuration with (nginx-1.4.1, unicorn, redmine-2.2.1) but now that I'm using (nginx-1.4.2, unicorn, redmine-2.3.3) that doesn't seem to work anymore. Here's some links that may be of use: http://www.redmine.org/issues/11881 http://www.redmine.org/issues/12102

Categories : Ruby On Rails

Nginx proxy redirect without changing url
first you're using 8000 in proxy_pass, but you're mentioning your port is 8080. Second, remove the rewrite line should do the trick, because youre actually using the rewrite rule here and never get to the proxy_pass line. Something like the following should work: location /assets/ { include proxy_params; proxy_pass http://127.0.0.1:8080; } There are also proxy_rewrite and proxy_redirect commands which might help you in getting this upstream-redirect handled internally by nginx. Hope that helps!

Categories : Nginx

winnovative pdf https images broken, reverse proxy
Winnovative support helped me understanding I had to use http://localhost/myapp base url. Since pdf converter sits on server, it works locally. Second, I had to upgrade to v9 and it's ok.

Categories : Pdf

Reverse proxy to CouchDB hangs on POST and PUT in Node.js
request makes get requests by default. You need to set the method. app.all(/^/db(.*)$/, function(req, res){ var db_url = ["http://localhost:5984/db", req.params[0]].join('/'); req.pipe(request({ url: db_url, method: url.method })).pipe(res); }); (code untested, let me know if it doesn't work, but it should be close)

Categories : Node Js

Node reverse proxy basic routes issue
I don't know if you've found a workaround for this by now, but I had the exact same problem and think I've worked it out. When you hit the target endpoint directly localhost:9000 the path is sent through as /, ie just the root. Then when it requests the css etc, it resolves those as expected, from the root. When you call via the proxy localhost:8000/myapp it routes /myapp to the target and then passes the target service / as the path, at which point it behaves exactly as above. The problem here is actually at the browser. Because the path is specified as /myapp, it assumes that "myapp" is a filename. Then when it requests the css etc, it peels that back to the last slash and uses that as the base for all relative hrefs, which is why it then asks for /styles/blue.css and not /myapp/st

Categories : Node Js

Connecting a reverse proxy to a database mapping subdomains to IPs
I found the answer to my own question, it's called mod_proxy_express and it's available in Apache 2.4.

Categories : Database

My Apache Reverse Proxy is not returning the correct URL when using ProxyPass
Solved: #REDIRECT for http://sysaid.external.com <VirtualHost *:80> ServerName sysaid.external.com ProxyPreserveHost On Redirect / https://sysaid.external.com </VirtualHost> #https://sysaid.external.com <VirtualHost *:443> ServerAdmin webmaster@external.com ServerName sysaid.external.com SSLEngine on SSLCertificateFile /usr/local/etc/apache22/ssl/webmail.external.com.crt SSLCertificateKeyFile /usr/local/etc/apache22/ssl/webmail.external.com.key ProxyPreserveHost On ProxyPass / http://srv-01.internal.local/ ProxyPassReverse / http://srv-01.internal.local/ ProxyPassReverse / http://sysaid.external.com/ </VirtualHost>

Categories : Apache

ngixn conditionally reverse proxy or serve directly
The basic solution is, make nginx as a reverse-proxy with fail_timout, when it receives a request, it dispatch to the upstreams where Ubuntu has higher priority, and if Ubuntu is offline, RPi will handle the request by itself. This requires: mysql can be access by two clients with different ip, which is already supported; wordpress should be the same for RPi and Ubuntu, which can be done by nfs share; nginx should be correctly configured. Below is the details of configuration. Note, in my configureation: RPi's IP is 192.168.1.100, Ubuntu's IP is 192.168.1.101; The wordpress only allows https, all http requests are redirected to https; Server listens at port 80 and 443, upstreams listen on port 8000; Mysql Set bind-address = 192.168.1.100 in /etc/mysql/my.cnf, and make sure skip-

Categories : Wordpress

How to configure proxy servers with puppet nginx?
Use nginx::resource::vhost The source of the repo you are using gives a breakdown of the commands you will need to use: https://github.com/puppetlabs/puppetlabs-nginx/blob/master/manifests/resource/vhost.pp

Categories : Nginx

How can I optimize this nginx proxy cache configuration?
A nested location is the right way to create locations with regular expressions and it should do the trick for what you want to achieve. location / { proxy_pass http://192.168.12.12:91; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location ~* .html$ { proxy_cache cache_one; proxy_cache_key $host$uri$is_args$args; proxy_cache_valid any 1m; expires 1m; } } I’m not totally sure if the nested location is really using the options from the outer location block. If it doesn’t (I can’t test this right now) you could create separate files. location / { include proxy.conf; location ~* .html$ {

Categories : Linux

nginx and trailing slash with proxy pass
Did you already try playing with server_name_in_redirect? However, I found you question via google because I run the same issue with the trailing slash. Nginx forces a 301 to the same URL with an trailing slash.

Categories : Http

nginx proxy based on host when using https
according to http://www.informit.com/articles/article.aspx?p=1994795, you should indeed have two "server" sections, with two different server names. In each one, you should include your ssl_* directives.

Categories : Ssl

nginx proxy pass to sslv3 upstream
Have you tried "ssl_ciphers ALL;"? Although that's not recommended (because that allows weak ciphers), that shall narrow down the scope of the problem. If that doesn't work, most likely the cause of your problem is that the openssl you use doesn't have the suitable ciphers to complete the SSL handshake with your Go server. Note that Go's tls package is only "partially" implemented and the supported ciphers is very limited. There are two solutions: You'll have to upgrade your openssl version that supports what Go's tls package already implemented. And then, of course, recompile your nginx. You'll have to patch tls package to support whatever your current openssl ciphers provides by adding the appropriate suite ids to cipherSuites in tls/cipher_suites.go (I think)

Categories : Ssl

Node.JS reverse proxied with Nginx on diffrent machines
As I understand your question, you serve static content from your Node app. Better way is to move your static content from your Node app and let Nginx serve the static contents. Simply copy your static content (eg. /js, /css, /images) into your nginx www directory. In your case you will get also much better performance and you will save your raspberry resources. If it will interfere with your existing www content, move them to extra directory (eg. /assets/js, /assets/css, ...) and change your html accordingly.

Categories : Node Js

Handling authentication with Apache reverse proxy for plack/PSGI app
Apache's mod_session looks to be the component you are missing. Since the proxy is the gateway to the applications in the back-end, it can handle the authentication on the HTTP layer and pass back sessions as needed to the Perl script using the proxy entry. Exposing the user information to the Perl application can happen in a few ways. mod_session_dbd - is a module to store session information in a database. This could then be shared with the back-end server hosting the Perl application. mod_session_cookie - is a module to store session information in a cookie on the browser of the client. Session variables would be stored in the cookie and the Perl application would retrieve them. But, cookies or putting session variables in the URL open up security concerns. Cookies and headers

Categories : Perl

Apache Reverse Proxy and Google Authenticator as 2-Factor Auth
By "real two factor" you mean you want the username, password and token - not just username and token, right? So, here's one option - it's possible to configure PAM on linux to require a password which is the concatenation of password and code. See: http://google-authenticator.googlecode.com/git/libpam/README Then you can use apache auth via PAM (http://pam.sourceforge.net/mod_auth_pam/configure.html) as the authn for your apache reverse proxy and voila. Now, I have not actually tried this, and it's possible that it will attempt to verify the password every time (so you'll be logged in for exactly one request before the code becomes invalid!), so then you'll want to use mod_auth_pam combined with mod_auth_form which allows you to set a session cookie to bypass the password checking whil

Categories : Apache

502 Bad Gateway in node + nginx proxy setup on Heroku
I am not really familiar with Heroku, and pretty new to Nginx, but I'll give it a shot: To me it looks like the Nginx-config is saying that Nginx and the node.js app are using the same port (<%= ENV['PORT'] %>). What you want is Nginx to listen to incoming connections (usually port 80), and have it forward them to the node.js app. Here is an example Nginx config: # the IP(s) on which your node server is running. I chose port 4000. upstream xxx.xxx.xxx.xxx { #Your IP adress as seen from the internet server 127.0.0.1:4000; #Your local node.js process } # the nginx server instance server { listen 0.0.0.0:80; #Have Nginx listen for all incoming connections on port 80 server_name my-site; access_log /var/log/nginx/my-site.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_s

Categories : Node Js

Nginx(proxy) + Apache: two process listening same port
Your problem is simple, you seem to have both nginx and apache listening on port 80, so nginx finds the port already in use, you need to move apache to another port, like 81 for example, and make nginx listen on 80, because it's the one which is going to receive the http requests and proxy it.

Categories : Linux

Proxy a Flask app running on gunicorn to a subpath in nginx
I solved my problem: The snippet http://flask.pocoo.org/snippets/35/ does work, I was so stupid to have absolute URLs in my templates. I changed that to url_for() and now it works like charm.

Categories : Nginx



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.