w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
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

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

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

Paperclip + S3 + Nginx issue on image upload
I had the same issue sometime ago and it worked for me just to restart my web server. I was using Passenger in my application. I forgot to mention that I created an interpolation with Paperclip method Interpolates, just like that: #config/initializers/paperclip.rb Paperclip.interpolates :class do |attachment, style| attachment.instance.class.model_name.downcase.pluralize end Now the files url at S3 will make use of .../users/..., not .../males/... or .../females/... anymore.

Categories : Ruby

Varnish with Nginx for a Rails application (issue with Devise authentication)
You are preventing your backend to delete your session cookie, so you can't log out unless you explicitly delete your browsers' cookies. Looking at your fetch VCL (Comment inline): sub vcl_fetch { # This prevents server from deleting the cookie in the browser when loging out if(req.url ~ "logout" || req.url ~ "sign_out"){ unset beresp.http.Set-Cookie; } if (req.request == "GET") { unset beresp.http.Set-Cookie; set beresp.ttl = 360m; } if (req.url ~ "images/" || req.url ~ "javascripts" || req.url ~ "stylesheets" || req.url ~ "assets"){ set beresp.ttl = 360m; } } So your backend can't delete client's cookie unless as result of a POST request. IMHO you shouldn't mess with backend's Set-Cookie headers unless you know (and test well) posible side effects

Categories : Ruby On Rails

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

Controlling Access to Official Repository in BitBucket
Did you try the settings in https://bitbucket.org/{user}/{repo}/admin/access? I'm pretty sure if you set the user to read they can fork and create pull requests and then your seniors with the write permission could do the merging.

Categories : GIT

How to comply official android Calendar app from downloaded source?
What am I doing wrong? Most of those apps are not designed to be built using solely the Android SDK. They are designed to be built as part of a full compile of the OS.

Categories : Android

Installable units are missing in p2 repository, so that tycho-p2-director fails when setting source=repository
When you create a product installation, the p2 director needs to resolve all transitve dependencies of the product. However by default, the p2 repository built in an eclipse-repository module (usually at target/repository/) only aggregates the included content. Since you are saying that the units created via the p2.inf are missing in the target/repository/ p2 repository, they are probably not included in the features but only referenced as dependency. Although you could also change the p2.inf to generate inclusions, this is probably not the easiest solution. Instead, simply configure the tycho-p2-repository-plugin to aggregate not only inclusions but all dependencies: <build> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> <art

Categories : Misc

Issue while installing gcc-4.8.1 in Fedora 19
I think there is an easiest way to install gcc on Fedora 19. Did you try with yum ? With something like sudo yum install gcc Your error means that the makefile which must be generated during the configure command doesn't exist because you don't have any c compiler. You can see details on the config.log file.

Categories : Gcc

Nginx add sites
well if you're going to use only 1 IP, then it's 1 server block ( 1 virtual host ) server { server_name [domain name or ip]; index index.html; # or php or whatever location /foo { root /var/www/foo/public_html; try_files $uri $uri/; } location /bar { root /srv/www/bar/public_html; try_files $uri $uri/; } } You haven't mentioned what kind of application this is, so it probably need some changes depending if its a php site or rails or any thing else, this would work for static content only like html and images.

Categories : Nginx

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

How to use nginx proxy_pass
Try the nginx HttpRewriteModule you dont need a proxy for these(tho). it follows this format: rewrite regex replacement flag | | | | rewrite ^/ http://www.example.com/image/file.aspx?img=1 permanent; Then: location / { rewrite ^/ http://www.example.com/image/file.aspx?img=1 permanent; }

Categories : Node Js

When do I need to restart nginx
Probably only when you change its configuration, if you are referring to when your django code changes you have to restart the uwsgi server, usually "touch"ing the wsgi.py file is enough to instruct the uwsgi server. Changes in static files don't require the uwsgi restart (because you usually serve them directly with nginx), and if you don't use cached template loaders, but only the default filesystem loader, you don't require the restart when changing a template either. Note that the cached template loader is usually suggested in production.

Categories : Django

htaccess to nginx (help)
Please try the following: server { listen 80; server_name www.website.com; return 301 $scheme://website.com; } server { listen 80; server_name website.com; root /path/to/root; location / { try_files $uri @rewrite; } location @rewrite { rewrite ^/([a-z]+)/?([0-9a-zA-Z]*)/?.*$ /index.php?a=$1&q=$2 last; } }

Categories : Apache

Regex for Nginx
The way you written it means that the / is the one that could appear multiple times, ie /home///////share, to fix it write soemthing like location ~ /home/[^/]+/share { }

Categories : Regex

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

nginx and ssl certificate
This is the .cer file, the .key is the key you used to produce this .cer file, try to remember how you got this .cer file, you probably generated a key file on your device, then created a certificate signing request out of it .csr and then uploaded it to get this certificate correct ? you should already have the key file.

Categories : Ssl

Nginx and Unicorn Set up Not sure what I am doing
I've never used knife... It might be worth checking out this this blog post about setting up Capistrano, Nginx, and Unicorn - I've always found Capistrano to be a good deployment app (and there's lots of support for it, especially on SO). On Heroku, you don't deploy as you would with Capistrano or any other deployment utility - you simply push to a branch on your Heroku server. See: https://devcenter.heroku.com/articles/git for how to deploy on Heroku using Git.

Categories : Ruby On Rails

Git on server with nginx
You need a web frontend for git. Have a look at https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools#Web_Interfaces for an overview

Categories : GIT

Redirecting to SSL using nginx
In order to use regular expressions for matching locations, you need to prefix the expression with either ~ or ~*: if ($server_port = 80) { location ~ (en|fr)/shop { rewrite ^ https://$host$request_uri permanent; } } From the documentation: To use regular expressions, you must use a prefix: "~" for case sensitive matching "~*" for case insensitive matching Since nginx does't allow location blocks to be nested inside of if blocks, try the following configuration: if ($server_port = 80) { rewrite ^/(en|fr)/shop https://$host$request_uri permanent; }

Categories : Nginx

Nginx Vhost Bandwidth?
You could try the Munin Byprojects for that! It does exactly what you described.

Categories : Nginx

rand not determined on nginx/php-fpm
You could try mt_srand() and mt_rand() instead. The rand() and srand() functions that you're using now make use of the random functions built into the host operating system. This means that when you move from one platform to another, you're potentially using an entirely different number generator. By contrast, the mt_rand() function uses a Mersenne Twister algorithm built into PHP itself to generate its random numbers. In theory this means that the sequence should be more predictable going from one platform to another. You may still find that the sequence changes if you move from a 32-bit to a 64-bit PHP build, but other than that I'd expect it to give the same sequence in all cases, given the same seed. Hope that helps.

Categories : PHP

NGINX AddHandler equivalent?
if your conf looks like: location ~ .php { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9001; } then you would do this: if your conf looks like: location ~ .(php|ws) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9001; } not the change from php to (php|ws)

Categories : Nginx

how to get real ip of server behind nginx
You can refer to nginx manual upstream section. $upstream_addr variable may be what you want. And another method is to add trace code to the request. You can refer to this 3-rd module.

Categories : Nginx

How to disable nginx cache
Solved my problem... Installed manually following this steps: http://eksith.wordpress.com/2008/12/08/nginx-php-on-windows/ with pure nginx i could disable cache on nginx.conf

Categories : Caching

FastCgi vs PHP-FPM using Nginx web server
PHP-FPM is much better than the old FastCGI handling of PHP. As of PHP 5.3.3 PHP-FPM is in core and the old FastCGI implementation isn’t available anymore. My answer was just down voted (after being online for quite some time) and I understand why, so here is a list why PHP-FPM is actually better than the old FastCGI implementation. First of all, it was known for quite some time that the FastCGI implementation is bad in the PHP community. A page that documents that can be found at https://wiki.php.net/ideas/fastcgiwork where it says: php-cgi is not useful in production environment without additional “crutches” (e.g. spawn-fcgi from lighttpd distribution or php-fpm patch). This project assumes integration of such “crutches” and extending php-cgi to support for different prot

Categories : Nginx

Separate Nginx Rewrites
Ok since you said it works let me explain what you did, I'll quote them from the wiki page: First the flag you used which is break break: completes processing of current rewrite directives and non-rewrite processing continues within the current location block only. by adding the keyword break to any rewrite rule, it tells nginx to stop the rewriting, so even if it matches another location which has a rewrite, it wont run it, that's why it didn't execute the rewrites inside the location location / { .. } Another keyword is last, last: completes processing of current rewrite directives and restarts the process (including rewriting) with a search for a match on the URI from all available locations. This one which tells nginx to stop the rewriting and restart rewriting again wi

Categories : Nginx

X-Sendfile, Rails & Nginx
got it: never use any rails route part in your location directive of nginx. with this one, it works: location / { proxy_set_header X-Sendfile-Type X-Accel-Redirect; # Maps a real path to the internal location proxy_set_header X-Accel-Mapping /var/www/cube_storage/uploads/=/downloads; } # end of location app location /downloads { alias /var/www/cube_storage/uploads/; internal; }

Categories : Ruby On Rails

Symfony2 and nginx web host
Clear your app/logs and app/cache directories and give your web server permissions to write to them (read the installation chapter). You left there some files from your development machine.

Categories : Symfony2

Codeigniter on Nginx, url segments
Then you say "Slash-separated URLs", you must understand, that it's just some URL, that is leads to non-existing file (for example, site.com/controller/action/param1/value1 leads to "folders" /controller/action/param1 and "file" value1), and tghis situation is solved by using mod_rewrite in apache - it just rewrites any URL, that points to non-existing file to a url, pointing to index.php. So, In nginx you need just the same. In your nginx configuration you have to add this locations: # for rewriting non-existing url-s to index.php location / { try_files $uri $uri/ /index.php?$args; } and #location, that enables to process *.php files thorugh php-fpm (fastcgi) #it's possible that you already have this block configured, and don't need to change it. location ~ .php$ { try_files

Categories : PHP

nginx doens't run php files
I'm no nginx expert(did not start using it yet) but I know that you need to configure nginx and link it to fast cgi to be able to compile the php code see link: http://www.sitepoint.com/setting-up-php-behind-nginx-with-fastcgi/

Categories : PHP

nginx.conf for url routing
You might want to try something like this, works like a charm for me: location / { try_files $uri $uri/ @rules; } location @rules { rewrite ^/(.*)$ /index.php?param=$1; } This looks for the location at / which is your web root. All of your web accessible files are found in this directory. If a file exists, it'll take you to that file. If not, then it'll throw you into the @rules block. You can use regexp matching to vary your url formatting. But in short, the (.*) matches any string in your url and takes you to your index. I modified what you had written slightly to feed the original input in to index.php as a parameter. If you don't do this, your script won't have any info about how to route the request. For example, then going to /blablabla will mask the url but pull u

Categories : PHP

get ip and url from ngx_http_request_t in nginx module
A ngx_http_request_t is a typedef for ngx_http_request_s. See http://lxr.nginx.org/source/src/http/ngx_http.h#0016. It looks as follows (from http://lxr.nginx.org/source/src/http/ngx_http_request.h#0358): 0358 struct ngx_http_request_s { 0359 uint32_t signature; /* "HTTP" */ 0360 0361 ngx_connection_t *connection; 0362 0363 void **ctx; 0364 void **main_conf; 0365 void **srv_conf; 0366 void **loc_conf; 0367 0368 ngx_http_event_handler_pt read_event_handler; 0369 ngx_http_event_handler_pt write_event_handler; ... 0394 ngx_str_t request_line; 0395 ngx_str

Categories : C

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

I'm trying to rewrite a sef url into a plain url using nginx
you probably need to add a break at the end of the line rewrite ^/tools/app/(.*)$ /tools/app?action=$1 break;

Categories : PHP

Installing Nginx server
You are getting a bunch of tar errors, which might mean that the archive is broken. Try to address those issues first before doing a make. I would start with replacing tar xvfz nginx-1.5.3.tar.gz with tar -xvzf nginx-1.5.3.tar.gz

Categories : Nginx

nginx behind haproxy behind varnish
Haproxy does not appear to really consume the x-forwarded-for header. It appears that it simply replaces it. If you are running on a later version of 1.5 (I think 17 or greater) then you can actually do variable concatenation which means that you can set the x-forwarded-for header yourself without using option forwardfor. I am doing this in a very large haproxy implementation and it is working very well. Another option is to change the haproxy option forwardfor header to use a different header. This means that on the nginx server you would have to look at two headers. The one from varnish would have the end user IP address, the one from haproxy would have the varnish servers IP address. To do this, the haproxy config looks like this: option forwardfor header varnish-x-forwarded-for

Categories : Nginx

Running python under nginx
All you need is to change start command to /usr/local/bin/uwsgi --http :9090 --wsgi-file restserver.fcgi --callable app or change the way you import your flask application in restserver.fcgi to #!/usr/bin/python from flup.server.fcgi import WSGIServer from api import app as application if __name__ == '__main__': WSGIServer(application, bindAddress='/var/run/fcgi.sock').run() Docs on using uWSGI with Flask PS: Actually your flask app is WSGI application.

Categories : Python

Is it possible to deny range of IPs on Nginx
You can block IP ranges using the CIDR notation. Have a look at the article 'Nginx Block And Deny IP Address OR Network Subnets' You can use IP range calculators like this one that do the math for you. For example your range '43.249.64.0-43.249.85.255' can be expressed as: 43.249.64.0/20 43.249.80.0/22 43.249.84.0/23

Categories : Nginx



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