w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Restarting nginx: nginx: [alert] Unable to start the Phusion Passenger watchdog because its executable
Passenger takes what you set in the file nginx.conf by passenger_ruby, for example: passenger_root /home/dev/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.5; passenger_ruby /home/dev/.rvm/wrappers/ruby-1.9.3-p448/ruby;

Categories : Ruby

Where is my nginx being configured? Changing nginx.conf still brings me to the 'Welcome to nginx' page
when you rewrited the nginx.conf in the folder of source code of nginx and installed it firstly, it will be copied to /usr/local/nginx/conf/nginx.conf (without specially modification of the configure in the folder of source code). But when you do this secondly, the nginx.conf in the folder of source code will be copied to /usr/local/nginx/conf/nginx.conf.defualt,and it usually don't work unless you use nginx -c /usr/local/nginx/conf/nginx.conf.defualt to assign its configure file evertime. There is a line NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" in your script above,which indicates the configure file clearly. To handle this, I suggest rewrite /usr/local/nginx/conf/nginx.conf (not the one in the folder of source code) instead.

Categories : Nginx

How to use sub uri to login in rails 3.2.12 with passenger/nginx
Try: namespace :nbhy do match '/signin', :to => 'authentify::sessions#new', :as => "signin" match '/signout', :to => 'authentify::sessions#destroy', :as => "signout" root :to => "signin" end And remove the base uri from passenger. Alternatively You can change the server root: server { listen 80; server_name mysite.com; root /var/www/nbhy; passenger_enabled on; rails_env production; } Which is very acceptable and thats what I do in all of my websites. bacuse it connectes between the domain and the root path. Than all of your rotes are normal.

Categories : Ruby On Rails

Running two applications on a VPS using nginx passenger
You cannot do it only by defining another DNS address. You should run the other app on different URL. Then do something like this: upstream rails { server 127.0.0.1:8000; } upstream sinatra { server 127.0.0.1:7000; } server { location /rails { proxy_pass http://rails; } location /sinatra { proxy_pass http://sinatra; } }

Categories : Ruby On Rails

nginx + passenger + rails - 403 forbidden
You cannot use the symlink that way. See How Phusion Passenger detects whether a virtual host is a web application

Categories : Ubuntu

nginx + passenger + rails: do I need to start the rails server or just start nginx?
Set nginx to forward to my rails server using this https://gist.github.com/jeffrafter/1229497 worker_processes 1; error_log /usr/local/var/log/nginx.error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream dev { server 127.0.0.1:3000; } server { listen 80; # You could put a server_name directive here (or multiple) if # you have not setup wildcard DNS for *.dev domains # See http://jessedearing.com/nodes/9-setting-up-wildcard-subdomains-on-os-x-10-6 # If we choose a root, then we can't switch things around easily # Using /dev/null means that static assets are served through

Categories : Ruby On Rails

Deploying Rails applications with Passenger and Nginx to VPS (EC2)
I believe to start servers there's a specific cap command to start servers, but i don't know much about capistrano, just played with it a little bit before. As for the second part, this is where nginx takes part, nginx will handle forwarding each domain to the specific port, using proxy_pass, take a look at this example server { server_name: example1.com; proxy_pass: http://127.0.0.1:3000; } server { server_name: example2.com; proxy_pass: http://127.0.0.1:3001; }

Categories : Ruby On Rails

Forbidden - Ruby 2.0.0 Rails 4.0.0 Nginx Passenger on Ubuntu 12.04
maybe it is because of the passenger_spawn_method smart-lv2? according to http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_instances_per_app_lt_integer_gt : As of Phusion Passenger 4.0, conservative spawning was renamed to direct and smart-lv2 was renamed to smart. The old smart spawning has been removed in favor of the new version. And as: The default value is smart. try just removing it.

Categories : Ruby On Rails

nginx / passenger configuration to allows access to custom header
If you are using nginx proxy module to forward request to passenger, you need to explicitly forward this customized header: proxy_set_header auth_token $http_auth_token; References: http://wiki.nginx.org/HttpProxyModule#proxy_set_header http://wiki.nginx.org/HttpCoreModule#.24http_HEADER

Categories : Ruby On Rails

Install Nginx Passenger Rails on Ubuntu Failed
Try following the advice in Debugging application startup problems on the Phusion Passenger wiki.

Categories : Ruby On Rails

Missing assets on production mode - passenger on nginx
Try using image-url instead of url. background: #fff image-url('wallpaper.jpg') top left; From the Asset Pipeline documentation: When using the asset pipeline, paths to assets must be re-written and sass-rails provides -url and -path helpers (hyphenated in Sass, underscored in Ruby) for the following asset classes: image, font, video, audio, JavaScript and stylesheet.

Categories : Ruby On Rails

error on installing passenger nginx module on ubuntu with ruby 2.0.0 via rvm
You have to install development tools first. Most likely you're missing some libraries just like the error is indicating. I ran into the same thing a couple weeks back. Here is a nice tutorial similar to the one that helped me out. http://alexpearce.me/2012/06/setting-up-a-vps/ With a little bit of luck, I believe that this line will solve your current issues, but be sure to look over the whole document. sudo apt-get -y install curl git-core python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev Also: I've also always had troubles when using rvm and have found that rbenv works with less hiccups, which is actually mentioned in this tutorial. For databases, if you aren't using postgres then you should be able to just swap out the

Categories : Ruby On Rails

Multiple Ruby apps (Rails and Sinatra) deployed using Passenger for Nginx?
I believe you need to define local servers, that only listen on local port and define your passenger apps there. Your actual server listening on port should only act as proxy. server { listen localhost:8181; server_name test_app; root /var/www/test/public; passenger_enabled on; } server { listen localhost:8182; server_name demo_app; root /var/www/demo/public; passenger_enabled on; rails_env production; } server { listen 80; server_name localhost; location / { proxy_pass http://localhost:8182/; } location /test/ { proxy_pass http://localhost:8181/; } } I didn't have chance to test this config, so it might have some minor flaws, but it should be correct in high-level

Categories : Ruby On Rails

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

How to get status of Nginx HttpCacheModule?
Finally I got an answer myself. Just logging and collecting logs. I wrote a post how to do that, thanks. http://bekkou68.hatenablog.com/entry/2013/06/26/220131

Categories : Caching

How to configure nginx + Unicorn to avoid timeout errors?
Is there a way to handle this kind of problems? Do the job in background. You should have a separate process that gets jobs from queue one by one and processes them. And since it doesn't work with user requests, it can do its job as long as needed. You don't need unicorn for this, just a separate daemon.

Categories : Ruby On Rails

How to track down a Python/Django/uwsgi/nginx timeout
You have a pretty "strange" setup: nginx -> uwsgi http router -> uwsgi instead of nginx -> uwsgi maybe you have some good reason for it, but in such a case you need to set the timeout between uwsgi http router and uwsgi via --http-timeout 1800 If the http router is not you want/need you can just let uwsgi speaks http with the --http-socket option

Categories : Python

Request is not redirected, when passes nginx
I fixed it, but not by nginx configuration. I'v added this code to login action of auth controller: HttpSession session = request.getSession(false); if (session!=null && !session.isNew()) { session.invalidate(); } I don't really know why this problem exist, when my request passes nginx. But this is hotfix for today.

Categories : Java

How do I allow a PUT file request on Nginx server?
To add HTTP and WebDAV methods like PUT, DELETE, MKCOL, COPY and MOVE you need to compile nginx with HttpDavModule (./configure --with-http_dav_module). Check nginx -V first, maybe you already have the HttpDavModule (I installed nginx from the Debian repository and I already have the module). Then change your nginx-config like that: location / { root /var/www; dav_methods PUT; } You can get more info on the nginx docs entry for the HttpDavModule.

Categories : Http

nodejs get request header from Nginx
by default, nginx's HttpProxyModule has proxy_pass_request_headers enabled, and thus will pass on the client request headers to the destination server. My first suggestions is to try renaming your header to "X-Client-Id" to utilize the extension namespace HTTP has reserved for non-standard headers such as yours and see if nginx will forward that. If not, have a look at the proxy_set_header directive. Side note: using a custom header at all, and specifically one called "client_id" is almost a sure sign you are reinventing the wheel or don't understand industry standards for using cookies and sessions. Unless you are really sure you need this, you may want to step back and rethink your underlying problem.

Categories : Node Js

Using Lua in nginx to pass a request to FastCGI
Use the ngx.location.capture() method to perform a subrequest to a predefined location block. Then, from within the location block, perform the external, FastCGI request. Because the subrequest itself isn't actually a network operation, but is performed purely within nginx C-based environment, there's very little overhead. Further, because the FastCGI request and other "proxy_pass"-type requests are event-based, nginx can operate as an efficient intermediary. As an example, you could have the following: location / { access_by_lua ' response = ngx.location.capture("/my-subrequest-handler") if response.status == 404 then return ngx.exit(401) -- can't find/authenticate user, refuse request end ngx.say(response.status) '; # other nginx config stuff here as

Categories : Nginx

Redirect request to two Upstream server in Nginx
Here's how i think your config could be, you can create multiple upstreams upstream main_upstream { server IP1 server IP2 server IP3 } upstream process_upstream { server IP2 server IP3 } server { location /process { proxy_pass http://process_upstream; } location / { proxy_pass http://main_upstream; }

Categories : Nginx

Really logging the POST request body (instead of "-") with nginx
Nginx doesn't parse the client request body unless it really needs to, so it usually does not fill the $request_body variable. The exceptions are when: it sends the request to a proxy, or a fastcgi server. So you really need to either add the proxy_pass or fastcgi_pass directives to your block. The easiest way is to send it to Nginx itself as a proxied server, for example with this configuration: location = /c.gif { access_log logs/uaa_access.log client; # add the proper port or IP address if Nginx is not on 127.0.0.1:80 proxy_pass http://127.0.0.1/post_gif; } location = /post_gif { # turn off logging here to avoid double logging access_log off; empty_gif; } If you only expect to receive some key-pair values, it might be a good idea to limit the reques

Categories : Http

Nginx+bottle+uwsgi Server returning 404 on every request
Are you sure that NGINX and UWSGI are working properly? Lot's of things could be wrong, I recommend you to follow this guide: https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html It's a step by step to setup NGINX and UWSGI with Django but I'm pretty sure you can apply it to any other web app than Django.

Categories : Python

How to configure nginx rules so that if one failed it serve the request using another
http://wiki.nginx.org/HttpCoreModule#try_files try_files is your friend, here you can do the order you want to try files and finaly have the proxypass upstream.

Categories : Nginx

How do I run background threads after the request has been respnded with nginx/flup?
Use multiprocessing As soon as you return a value, and complete the request, FastCGI is going to clean up after you, and that means all the threads you spawned. If you really NEED your task to go on ticking, you have to use multiprocessing so that the process you spawned can survive the end of the request. Otherwise, Celery is really easy to set up, and solves exactly this problem your having...

Categories : Python

Nginx proxy_cache_key $request_body is ingored for large request body
So it turns out that when $content_length > client_body_buffer_size, then the request body is written to a file and the variable $request_body == "". See also http://mailman.nginx.org/pipermail/nginx/2013-September/040442.html

Categories : Http

Redirecting all PHP Request to router in Nginx rewrite (Tonic Framework)
You can try something like location /v2 { root <absolute folder path>/v2; if (!-e $request_filename) { rewrite ^/(.*)$ /v2/router.php?/$1 last; break; } } Hope it helps.

Categories : PHP

Custom header or query string when proxying request from Nginx to HHVM?
Both will work for the foreseeable future. getallheaders() should work on all transport methods, even once we implement fastcgi, modhhvm, or our own libevent server. I personally dislike magic globals and prefer the function, but it is just personal preference. It could yield a perf improvement if we can analyze your code and see you never use a certain super global, we don't have to populate it.

Categories : PHP

How can I configure nginx and fcgi to call separate executables depending on request-uri
You can do it with nginx and fcgi. The simplest way to do this is, by using spawn-fcgi - First you will need to setup your nginx.conf. Add the following inside the server {} block - location /index { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; } location /contact { fastcgi_pass 127.0.0.1:9001; include fastcgi_params; } location /view_post { fastcgi_pass 127.0.0.1:9002; include fastcgi_params; } Restart nginx and then run your apps listening same ports as declared in the nginx.conf. Assuming your programs are in ~/bin/ folder - ~ $ cd bin ~/bin $ spawn-fcgi -p 9000 ./index ~/bin $ spawn-fcgi -p 9001 ./contact ~/bin $ spawn-fcgi -p 9002 ./view_post Now the requests to localhost/index will forward to your index program and its output will go back to ngi

Categories : Nginx

nginx rewrite code for ZenPHOTO 1.4.5
Right now, i am using the following rules it works for me. location ~ .(gif|jpg|png) { try_files $uri @img_proxy; } location @img_proxy { rewrite ^(.*)$ /index.php?$1; } location / { try_files $uri $uri/ /index.php?$uri; } Note: It works for latest ZenPHOTO 1.4.5 version and i didn't check old versions.

Categories : Nginx

The request failed with HTTP status 400: Bad Request ( The data is invalid. ): Code base Works on one machine but not another
It's an Internet Proxy issue. The suspect machine had be configured to manually use a proxy server. Turning this off: Control Panel -> Internet Options -> Connections Tab -> Lan Settings Button, and enabling "Automatically detect settings" has fixed the problem.

Categories : Asp Net

408 Request Timeout Server timeout waiting for the HTTP request from the client
I just fixed it now using the below links http://buddypress.org/support/topic/bp-default-sidebar-login-not-working/#post-166903 http://buddypress.trac.wordpress.org/ticket/5080 bp-default theme itself having this issue in current buddypress version 1.8.

Categories : Wordpress

Ajax Timeout Not Working and Not Showing "Timeout" Status
Guess this might be a bit late for you, but nevertheless... If you have specified async as 'false', the timeout property will be ignored. As for handling the errors, you can visit an earlier SO question: status of ajax or post request Hope this helps! :)

Categories : Javascript

Avoiding POST requests resulting in "400 - Bad Request" status code in Spring MVC
I think the best way to handle this is to add a 'required' parameter into RequestParam annotation. @RequestParam(value="name", required=false) http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/bind/annotation/RequestParam.html

Categories : Spring

Fatal error: Uncaught AwsGlacierExceptionGlacierException: AWS Error Code: , Status Code: 400, AWS Request
It seems you may be confused about the difference between vaults and archives. You should make sure to look through the Amazon Glacier Developer Guide to become familiar with the basic concepts of Glacier. You must first create a vault in order to upload archives to it. A vault in Glacier is similar to a bucket in S3. You should also check out these links which provide code samples for doing uploads with Glacier: Uploading Archives to Amazon Glacier from PHP blog post on the AWS PHP Developer Blog "Amazon Glacier SDK php" post on SO

Categories : PHP

Spring MVC - HTTP status code 400 (Bad Request) for missing field which is defined as being not required
I came across the same situation, and this happens when your parameter is present in the request with an empty value. That is, if your POST body contains "number=" (with empty value), then Spring throws this exception. However, if the parameter is not present at all in the request, it should work without any errors.

Categories : Spring

Differentiate between failed(no network) and cancelled request in ajax error(HTTP status code 0)
I think there is not a straightforward solution but there is a workaround. On http status code 0 you can check... if(navigator.onLine) which will return whether there is some network connected or not.

Categories : Javascript

PHP htaccess to nginx
@Harinder: There must be some RewriteCond based on which you're applying this RewiteRule The reason why i am saying this is that, according to your RewriteRule RewriteRule ^(.*)$ /all_drivers.php?id=$1 [QSA] whatever that comes as a request, you are sending it to all_drivers.php. And if this is the desired rule, then all the request, no matter what will be send to this file only. Also it will be nice if you give us the complete .htaccess code segment that you want to be translated. And please check if you have configured php execution block correctly with all the required fastcgi directives as this blank php's output comes in the case if you have not passed SCRIPT_FILENAME fastcgi directive.

Categories : PHP

Upgrading Nginx 1.1.9 to 1.4.x
This is what test environments or virtual machines are made for. Your question is quite general and hard to answer this way. Try it out in a test setup. If you don't have that option, read the Changelog. From my experience, I haven't encountered backwards compatibility issues with configurations since 1.0 (before that even, but that's when officially configuration syntax should be considered stable). That's not to say there aren't any.

Categories : Ubuntu



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