Tag Info

New answers tagged

1

I would approach this by making a script that makes symlinks to all those files to the directory where you want the files to be visible. Then you could use something like lsyncd to monitor the directories and automatically generate symlinks whenever new files appear or existing files change.


0

Try location ^~ /phpMyAdmin/ { alias /home/phpmyadmin/; location ~ \.php$ { include fcgi.conf; fastcgi_index index.php; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_param SCRIPT_FILENAME /home$fastcgi_script_name; } }


2

Use a regex ? Something like this should make it : location ~ ^/(?<app>[^/]+)/public/(?<dir>[^/]+)/(?<file>[^/]+)$ { alias /var/srv/$app/public/$dir/$file; }


1

One issue here is at least that you are using the internal keyword inside the location. This means that it will match only requests coming from inside nginx, for example from other location blocks. You should remove that keyword. Your regexes need also other fixes. Try this location block: location ~ \.(gif|jpg|png)$ { rewrite ...


0

bind your services to loopback addresses. That way, noone will be able to access them from outside the computer.. use firewall to block all incoming connections to ports that are not supposed to be visible from outside do not try to make nginx listen on all ports. You will get into more trouble than it's worth. You'll get best results sticking to all ...


0

i was using a sqlalchemy pool of 5 without returning them correctly back to the pool. on the 5th request, the pool is depleted. the subsequent request waits for a connection until it hangs out. not a gunicorn/nginx problem.


1

add_header Content-Security-Policy "default-src 'self' http://www.just4bettors.mobi; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' http://placehold.it https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com ...


0

Add a trailing slash to your proxy_pass target. Update : The OP didn't precise the vhost was accepting https. As the scheme is forwarded to the backend server with additionnal headers, then an issue occurs since proxy_redirect default; orders nginx to expect http scheme by default when rewriting Location headers in upstream replies, instead of https. So, ...


1

How did you setup your assets path in this case? My assets path is <host>/assets/<asset_name>.css but the correct path is: <host>/<app_name>/assets/<asset_name>.css My config is mostly the same as the one above. upstream app1 { # Path to Unicorn SOCK file, as defined previously server ...


0

You need some type of service discovery for nginx to be able to "find" the containers running on the nodes. You could write a record into etcd when container starts and remove on exit and have nginx check those. For moving services around, you could take a look at fleet for simple scheduling.


0

Nginx is good enough for cache responses from S3, it also supports cache invalidation on demand, for example: curl -I 'https://domain/s3/file.jpg' -H 'Cache-Purge: 1' In case of caching proxy Nginx doesn't do subsequent HTTP request to S3 if the response is on disk already (file name based on proxy directory + md5 of response). See the full config there: ...


0

This was annoying. It was working a few weeks ago, and it failed on me when I tried today. I believed an upgrade of Ubuntu nginx package cause the default directory of where Ubuntu kept the standard index files changed, so the line: root /usr/share/nginx/www; Won't work anymore as the location of the files are at /usr/share/nginx/html. To fix, one can ...


1

Its now 2015 and I assume the kernel patch the Michael mentions has now made it's way into the stable kernel. I have a working example of 2 docker containers one with php-fpm and the other with nginx talking to each other via a unix socket. See: https://github.com/brad-jones/conductor/tree/master/example-project The key to it working though was to open up ...


1

There are issues when you use try_files and alias directives together. As a work around, remove alias and use root and rewrite.


0

you can proxy by using the rtmp module in the dmz and adding applications with the same name as another rtmp server application myVideos { live on; pull rtmp://<ip address>/myVideos; }


1

Basically nginx is proxy server. Its capabilities include proxy HTTP, HTTPS, IMAP, POP3, SMTP and other protocols. For HTTP(S) proxy, the backend can be either FastCGI server like PHP-FPM or another web server. For FastCGI backend like you need fastcgi module. For example, you need to define the backend with fastcgi_pass. For proxying another website, you ...


1

Your server_name directive doesn't match domain.com. The *.domain.com form is redundant with www.domain.com and doesn't match domain.com. Use server_name .domain.com instead. As a consequence, if you have an explicit default server block or a server block handling requests for other domains included before this one, then your requests are processed in it. ...


1

^~ The defined location url must begin with this syntax if that syntax is matched, then regular expressions will not be used. So in your case once the folder realestate is found, the search will stop. But if you know the folder you want to access & do not want to use regex location = /realestate/ { may be a faster rule


0

Maybe you need to re-read the doc as it's explained here : Syntax: rewrite regex replacement [flag]; Default: — Context: server, location, if [ ... ] An optional flag parameter can be one of: last stops processing the current set of ngx_http_rewrite_module directives and starts a search for a new location matching the changed URI; ...


0

Try something like: location ~* /staging/(.*) { rewrite ^/staging/(.*)/$ /staging/$1/index.php break; } or to limit to one level: location ~* /staging/(*) { rewrite ^/staging/([^/]*)/$ /staging/$1/index.php break; }


1

server { listen 80; server_name beta.example.com www.example.com example.com; location /admin { [ ... ] } location / { return 301 https://example.com$request_uri; } }


1

You have some options : Search into your upstream doc to find a proper reload signal/api instead of a stop & start sequence. If your pages can be cached, define a proxy cache and serve stale pages until the app goes up again. Scale the backend to 2 instances and restart one at a time, then tune proxy_next_upstream if necessary.


0

Your main Nginx should act as a reverse-proxy and forward HTTP requests to the respective web server of each app. If the main reverse-proxy has file-level access to the app's jails, you better use UNIX sockets to communicate with its web server, but in your case you have no choice but to use TCP. When using TCP, make sure to set the keepalive parameter to ...


0

Just put the files here. /etc/nginx/sites-available/site1/ And do soft link ln -s /etc/nginx/sites-available/site1/ /etc/nginx/sites-enabled/site1/


0

Put include /etc/nginx/conf.d/*.conf; after the cache declaration, not before.


0

This python script should help you to add Quicktime atom positioning for you video files. It allows rewind and seeking. Quicktime atom positioning in Python for fast streaming


0

I know it's been a while, but this usually has to do with SELinux. Try setting it to permissive and it'll probably work fine.


0

I would check the configuration of the virtualhost in /etc/nginx/sites-available and the corresponding symlink in /etc/nginx/sites-enabled. Also check out the configuration of /bin/gunicorn-start and make sure the parameters match your setup. There is more comprehensive information about configuring django with nginx and gunicorn following this link.


1

Nginx packaging changed : the conf.d folder was used in old packages, sites-enabled / sites-available is used now with sites-available directory containing actual vhosts configurations and sites-enabled the symlinks to sites-available vhosts you want to activate. So a typical structure would now be : nginx ├── nginx.conf ├── sites-available │   ├── mysite1 ...


2

You need to configure "root" directory of both servers to proper paths. both root set as below: root /var/opt/gitlab/git-data; your gitlab directory may contain a redirection based on your its production/development config yaml file look for "gitlab_url".


1

When viewing the directories containing allow/deny directives from any IP address, I get a 403 Forbidden error. That's exactly what you told nginx to do ... You are denying everything except IPs 10.1.1.28 and 10.0.1.38. I'm new to nginx... does anything in my configuration look incorrect? How can we know ? You don't even explain what you are ...


1

I've found the root cause of the problem. After the php update, the apc extension I have in my php.ini was no longer working, all its all right now after commenting this line: extension=apc.so Hope it helps.


1

So Google thinks you are sending enough mail to qualify as a bulk sender. So you need to setup a SPF record at least for the domain you are sending from and preferably also a DKIM record in DNS. Those pretty much allow Google to query your DNS zone file for the domain and ask.. is this sender valid to send email from this domain.


0

Ok I found a solution. It's better to use some location directives for this problem. So, now my config is : server { listen 80 default_server; server_name sub2.sub1.example.com; ##### Non HTTPS conf ##### location ~* ^/toto/[abc]/ { # This replace the "server_name ~^sub2\.sub1\.example\.com/toto/[abc]/.*$;" config block ... } ##### ...


1

I experimented with using sub_filter and nginx environment variables but concluded that it isn't possible. For example, this shows my experiments and shows using ENVs passed to nginx does not work within a server block: env TOMTEST1; # OK - makes $ENV{"TOMTEST1"} available but NOT in server block. http { server { # set $TOMTEST1 ...


1

Try to add proxy_set_header app_version $http_app_version; underscores_in_headers on; to the configuration. It might be that only the underscores_in_headers setting is enough here.


2

Use this: location = / { return 301 http://example.com/blog; } The key here is the =, which makes nginx apply this rule only to requests arriving to root folder, nowhere else.


2

/usr/share/nginx/... is where the default webroot is; you may have set something to be "on" and accidentally touched that file. Since your test works, it may also have been resolved, but when nginx crashes (or things like kill -9) it doesn't get rid of its pid file. I don't have experience with php-fpm, but it appears your nginx master process isn't ...


2

server { root /www/webroot; index index.html; location / { if ($request_uri ~ "^/blah\?abc=([a-z0-9]+)$") { return 301 /createpage.php?abc=$1; } } }


0

This once happened to me when I was configuring my VirtualHosts, your browsers (Firefox am sure of) saves site preferences. If you once loaded the site with https it saves it and keep loading with https once you load it. Clear site cache and preferences with CTRL+SHIFT+DEL and if it helps


1

I presumed that regex matches went most specific first, not order written first. The final regex shown in my log was matching and stopping.


0

Set up passenger_app_root to the correct value.


-1

sudo apt-get install libcurl4-openssl-dev


3

What is this? For what can it be used? It's IMAP/POP3/SMTP proxy. It is used as a bridge between outside connection and interal mail server. It's often placed when you only have one IP address and mail server was separated with nginx server. Could it replace my current simple Postfix/Dovecot combo? No Nginx mail module doesn't have postfix rich ...


3

You have typos in your server_name directives. You wrote coolthearth instead of cooltheearth in 3 places. Testing the current setup with a typo gives : curl -H "Host: coolthearth.org" "http://104.131.135.243" -I HTTP/1.1 301 Moved Permanently Server: nginx/1.6.2 Date: Fri, 20 Mar 2015 22:22:51 GMT Content-Type: text/html Content-Length: 184 Connection: ...


2

Look in /var/www/chat/public/tmp/sockets/ - does thin.0.sock actually exist? As far as I know, Thin only supports TCP sockets, not Unix sockets. If you copied the Unix socket thing from a Unicorn-specific example, that would explain it, since Unicorn does support them. I suggest changing the upstream definition block to say server http://127.0.0.1:4567 or ...


1

You should use a map for this since the auth_basic directive permits variables usage. For instance : map $arg_action $auth { default "Site Needs You to Authenticate"; "wordpress_social_authenticate" "off"; } server { [...] location ~* ^/wp-login.php { auth_basic $auth; auth_basic_user_file /etc/nginx/htpass-beta ; ...


0

For others looking on this replace: location ^~ /api { rewrite ^/(.*)$ public/index.php?_url=/$1; } with rewrite ^/api(/.*)$ /api/public/index.php?_url=$1 last;


0

Go to http://ipv4.wtfismyip.com/text to see the external IP of your server. Scan your external IP with nmap to determine which ports are available in the Internet: nmap -A $(curl http://ipv4.wtfismyip.com/text) If port 80 doesn't appear open then either your ISP blocks it, or the equipment you have there.


0

This means nginx couldn't connect to 127.0.0.1 port 9000 to forward the request. That's up to you to investigate on the reason why no service was bound to that socket by monitoring relevant metrics.



Top 50 recent answers are included