Show all posts by user
Introduce yourselves
Page 1 of 7
Pages: 12345

Results 1 - 30 of 205
Hello,
Maybe you don't need PHP at all to resize images, as there is native nginx module that performs this job.
http://wiki.nginx.org/HttpImageFilterModule
It does all what you need and will put less strain on your server than the PHP backend mat have.
Andrejs
by
locojohn
-
How to...location ~ ^/(favicon\.ico$|resources/|robots\.txt$) {
include caching.conf;
}
location ~ ^/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://tomcat1;
proxy_pass_header server;
gzip_vary off;
}
by
locojohn
-
Ideas and Feature RequestsHere's the nginx version:
server {
location = /favicon.ico {
include caching.conf;
}
location /resources/ {
include caching.conf;
}
location = robots.txt {
include caching.conf;
}
location ~ ^/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://to
by
locojohn
-
Ideas and Feature RequestsI would suggest not to use any ready-to-use-conversion-tools but rather learn the differences and convert the hosts manually one by one. It took me a couple of days to convert all of our sites to nginx and two weeks more to realize the differences of Apache and Nginx handling very specific cases, such as PHP environment in particular scenario where old PHP scripts would rely on SCRIPT_URI/SCRIPT_
by
locojohn
-
Nginx Mailing List - EnglishJohann, you are very welcome and I am happy to open you the world of perl regex assertions, but in spite of your original question this should not be a problem because of the order locations are defined and processed. See http://nginx.org/en/docs/http/request_processing.html for the rules about location/request processing order.
So if you define:
location = /favicon.ico {
// need to incl
by
locojohn
-
Ideas and Feature RequestsUse negative regex assertion:
location ~ ^/(?!(favicon\.ico|resources|robots\.txt)) {
.... # your stuff
}
Andrejs
loco (at) andrews.lv
by
locojohn
-
Ideas and Feature RequestsHello,
Perhaps, late answer but I am trying to help anyway.
nginx does not support .htaccess files per directory, so you must configure expire on the server level, instead:
server {
...
location ~ \.gif$ {
expires 1M;
}
location ~ \.html?$ {
expires 1w;
}
...
}
Andrejs
loco (at) andrews.lv
by
locojohn
-
Migration from Other Serversserver {
listen 80;
root /usr/share/nginx/html/domain.com;
index index.php index.html index.htm;
server_name domain.com www.domain.com;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~ ~$ { access_log off; log_not_found off; deny all; }
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php
by
locojohn
-
Migration from Other ServersMaybe too late, but it's best to avoid rewrites at all. Use location captures, instead:
location ~ ^/blog/(?<id>.*)/$ {
include fastcgi_params;
fasctgi_param SCRIPT_FILENAME $document_root/blog_view.php;
fastcgi_param QUERY_STRING id=$id&$args;
fastcgi_pass ...; # path to your php-fpm socket
}
location ~ ^/blog/category/(?<id>.*)/$ {
include fastcgi_params;
by
locojohn
-
Migration from Other ServersHello,
Is this issue still not solved?
Please contact loco (at) andrews.lv and we'll discuss the details.
Andrejs
by
locojohn
-
Requests for Paid ServicesHi,
It should work as expected. Please check two things:
1) make sure you're connecting using HTTP/1.1 protocol and not HTTP/1.0 which does not support virtual hosts.
2) in your example on stackoverflow the "listen" directive was configured ambiguously -- you must not use colon after "listen":
listen 80; # not listen: 80
3) if the above doesn't work, create a d
by
locojohn
-
How to...location ~ \.mp4$ {
mp4;
}
Andrejs
loco (at) andrews.lv
by
locojohn
-
How to...Hello,
Remove your entire /classifields location and try location-based capture without any rewrite's:
location ~ ^.*/p(?<product>\d+)(-.*-page(?<page>\d+)|.*)\.html$
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/showproduct.php;
fastcgi_param QUERY_STRING product=$product&cpage=$page;
fastcgi_pass ...; # connect to to php-fpm socket
}
l
by
locojohn
-
Migration from Other Serverslocation / {
try_files $uri $uri/ =404;
}
location ~ ^/[^/]+/[^_]+_.*\.jpg$ {
return 301 /page.html;
# use "try_files" instead of "return 301" if page.html is a static page
# try_files /page.html $uri;
}
Andrejs
by
locojohn
-
Migration from Other ServersUse nginx map module: http://nginx.org/en/docs/http/ngx_http_map_module.html#map
The below example will work only when accessing the root location, e.g. http://yoursite/
http {
....
map $geoip_country_code $new_home_uri {
default /en/;
uk /en/;
us /en/;
de /de/;
ru /ru/
by
locojohn
-
Migration from Other ServersAs each virtual host uses its own php-fpm pool, the following is possible:
php-fpm.conf:
user php-username1;
group www;
.....
user php-username2;
group www;
.....
Then your php-fpm init script should start php-fpm with umask 0077. It means that php-fpm will create files owned by user defined in corresponding php-fpm pool, and new files will have 600 permissions (folders wi
by
locojohn
-
Php-fpm Mailing List - Englishmkn Wrote:
-------------------------------------------------------
> NEVER use domain/server specific
> fastcgi_param PHP_VALUE
> or
> fastcgi_param PHP_ADMIN_VALUE
Actually, there should be no problem passing either PHP_VALUE or PHP_ADMIN_VALUE per virtual host in nginx.conf. The reasons why the values are messed up can be various.
For example, in php-fpm.conf pools a
by
locojohn
-
Php-fpm Mailing List - Englishitpp2012 Wrote:
-------------------------------------------------------
> open_basedir should be set in php.ini and not be passed via nginx.
>
> ea.
>
>
> open_basedir = /webroot/www.testsite123.nl
> doc_root = /webroot/www.testsite123.nl
open_basedir can be passed via nginx without problem, bad advice.
To the original question: it should work. I suggest yo
by
locojohn
-
Php-fpm Mailing List - Englishlocation ~ ^(?<path>.*)\.html$ {
include fasctgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param QUERY_STRING "module=website&action=$path"
fastcgi_pass ...;
}
Andrejs
by
locojohn
-
Migration from Other ServersHi,
First you will need to compile the map module. Then, in the main configuration block you define the following:
http {
...
map $host $mage_run_code {
albany.mywebsite.com 'w2760';
alexandria.mywebsite.com 'w1472';
annarbor.mywebsite.com 'w2933';
}
map $host $mage_run_type {
albany.mywebsite.com 'website';
by
locojohn
-
Nginx Mailing List - Englishjelson41 Wrote:
-------------------------------------------------------
> Also, wont the example you posted redirect all pages at /tech/ to
> /tech even if we have 50 different files in that directory? We only
> want to redirect the one file index.shtml2
No problem:
location ~ ^(/tech/)index\.shtml$ {
return 301 http://www.site.com$1;
}
Andrejs
by
locojohn
-
How to...AFAIK (from my experience), just about ANY rewrite can be replaced with appropriate location block. Note that rewrites for static links, such as:
rewrite ^/static/folder$ http://www.mysite.com/static/folder permanent;
can be replaced with exact match location query (even slightly faster than regex location match) :
location = /static/folder {
return 301 http://www.mysite.com/static/f
by
locojohn
-
How to...Because if you replace all rewrites with "location" blocks, you will no longer require rewrite module at all, unless you also use "if"s (see "if is evil" page) or "return"s. According to developers, location directive is slightly faster, and if you have hundreds of them, then you may assume performance increase.
I offered you the solution that does not r
by
locojohn
-
How to...Avoid rewrites:
location ~ ^(/tech/.*)$ {
return 301 http://www.site.com$1;
}
by
locojohn
-
How to...Page 1 of 7
Pages: 12345
