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

nginx 403 forbidden under Debian 7
Your issue is that http://localhost/install passes by the second rule of the try_files which is $uri/ so it tries to access install as a folder, but you don't have autoindex on, so it fails with a forbidden error. try_files $uri $uri/ /index.php?$args; I suggest removing the $uri/ part. try_files $uri /index.php?$args;

Categories : Nginx

403 forbidden error at Nginx
You stated: ls -ld /home drwx------ 4 mysite mysite 4096 Jul 20 18:39 mysite If nginx is running as an ordinary user, presumably as something other than "mysite", then it cannot access /home as only the mysite and root users have this permission. To find out what user nginx is running as type: ps faxu .. and search for the nginx process. To get the nginx user just do ps faxu | grep nginx

Categories : Nginx

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

Rails nginx directory index is forbidden
Nginx needs to have read permissions for the file as well as execute permissions for every hierarchical parent directory of the file to chdir to it and also Sometimes, the index directive does not contain the desired directory index.

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 403 forbidden error in Rails 4 (with no index.html file)
You'll need to pass the request from Nginx to Unicorn. You can do this like so: server { listen *:80; root /vagrant/public; location / { # Serve static files if they exist, if not pass the request to rails try_files $uri $uri/index.html $uri.html @rails; } location @rails { proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:8080; } } You may have to change the proxy_pass url. By default, unicorn will listen on 127.0.0.1:8080 but, if you have changed that, then you will need to specify that port.

Categories : Ruby On Rails

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

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

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

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

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 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

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

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

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

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

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

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

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

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

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 + fastcgi multithreading
The problem is solved. Use FCGX_OpenSocket and umask(0) in order to let socket accept. This will give you real multithreaded application. #include <pthread.h> #include <sys/types.h> #include <stdio.h> #include "fcgi_config.h" #include "fcgiapp.h" #define THREAD_COUNT 8 #define SOCKET_PATH "/var/run/myfcgiserver.sock" // your unix socket file static int socketId; static void *doit(void *a) { int rc, i; FCGX_Request request; char *server_name; if(FCGX_InitRequest(&request, socketId, 0) != 0) { printf("Can not init request "); return NULL; } printf("Request is inited "); for(;;) { static pthread_mutex_t accept_mutex = PTHREAD_MUTEX_INITIALIZER; printf("Try to accept new requ

Categories : C++

nginx + php-fpm - php works except cannot use $_GET
If you want to pass the URI as a get parameter, do something like this: try_files $uri $uri/ /index.php?$request_uri; Your index.php will see as if you used index.php?/controller/view

Categories : PHP

Nginx configuration for trinidad-gem
just google for proxy-ing with nginx - it's likely the same is with other Ruby servers e.g. server { listen sample.com:80; server_name sample.com; root /home/trinidad/rails_app/current/; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:3000/; } } in Trinidad's configuration you might want to bind to 127.0.0.1 (just add address: 127.0.0.1)

Categories : Ruby On Rails

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

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

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

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

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

SabreDAV + Nginx Configuration
I'm also trying to get this work on nginx and even adding Kohana wrapped around it https://github.com/chrisgo/kohana-sabredav Theoretically, you don't need nginx to do much and I've gotten almost everything to work except for the PUT (it creates a 0 byte file) so I've been going around and deploying some of the modules per How do I allow a PUT file request on Nginx server? sudo nginx -V check to see if you have --with-http_dav_module on the output If you do, then edit your /etc/nginx/sites-available/default per the documentation above or the example here: http://wiki.nginx.org/NginxHttpDavModule I'm going to be posting another question regarding the ZERO byte file and update this post

Categories : PHP

How to enable xdebug with nginx?
Just in case there's someone reading this... I got it! The problem was nginx's configuration. I had just copied a template from somewhere, but now I read a little more and found out that my particular config was much simpler: location / { root /var/www/bresson/web/; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/dispatch.php; fastcgi_pass unix:/var/run/php5-fpm.sock; } In my case, every request has to be forwarded to my front-controller (which then analyzes the URI), so it was really simple.

Categories : Nginx

How can I hide if I was using nginx or apache2
There are 2 ways to do this. You can modify the source of nginx and changing the server signature in the source, recompiling and installing from there. Alternatively you can add a module called headers-more-nginx-module This then allows you to modify the headers without recompiling each time you wish to change the headers. http://wiki.nginx.org/NginxHttpHeadersMoreModule#more_set_headers Both of these do however require recompiling ngnx and reinstalling.

Categories : Nginx

nginx add_header not working
What does your nginx error log say? Do you know which add_header lines are breaking the configuration? If not, comment them all out then enable them 1 by 1, reloading nginx to see which one(s) is/are the problem. I would begin by commenting out the block: add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE'; add_header PS 1 The problem could be that you're setting headers not supported by the core httpHeaders module. Installing the NginxHttpHeadersMoreModule may be helpful. Also, try replacing the two add_header lines int the location ~*

Categories : PHP

Running CKAN behind Nginx
The default installation of CKAN (the one done via package install) sets up CKAN running on Apache with mod_wsgi with Nginx on top. Have at look at the Apache and Nginx configuration files for details on how it is done. Regarding using paster on a production environment, I'd imagine that sooner or later you will hit performance problems, so I would avoid it. You may find this answer useful: Can I use paster on production site?

Categories : Nginx

Nginx rewrite in subfolder
Try this, I changed my answer to try to imitate the same behaviour you are using in your rewrite. location ~ /blog(.*) { index index.php; try_files $uri /blog/index.php?$1&$args; }

Categories : Wordpress

Nginx can ping itself but cannot connect from anywhere else
To connect using the IP address add the IP to the server name server_name server.com 192.168.1.101; Then restart nginx and it should work if you access http://192.168.1.101 from inside the local network.

Categories : Nginx



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