Show all posts by user
Discussions in Russian
server {
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 Servers
Maybe 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 Servers
Hello,
Is this issue still not solved?
Please contact loco (at) andrews.lv and we'll discuss the details.
Andrejs
by
locojohn
-
Requests for Paid Services
Hi,
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 Servers
location / {
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 Servers
Use 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 Servers
As 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 - English
mkn 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 - English
itpp2012 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 - English
location ~ ^(?<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 Servers
Hi,
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 - English
jelson41 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...
It's possible to use regex, such as:
location ~ ^/(?<type>[^/]+)/ {
proxy_pass http://127.0.0.1:8080/$type/;
}
BUT two static (non-regex) locations are faster.
Andrejs
by
locojohn
-
Nginx Mailing List - English
Hello,
1. You can use "open_basedir" php.ini directive per host.
2. You can create separate users and php-fpm pools with appropriate settings per site.
You can also use both.
Andrejs
by
locojohn
-
Php-fpm Mailing List - English
Спасибо, Максим.
Есть ли какое-то акутальное и понятное руководство к написанию модулей для nginx 1.3.x? Если я правильно понял, то функцию ngx_http_map_uri_to_path() нужно вызывать при обработке location, в таком случае интересуют пример
by
locojohn
-
Nginx Mailing List - Russian
*bump* ?
Максим, Игорь? Не поможете ли с ответом?
Очень благодарю заранее за любые наводки,
-андрей
by
locojohn
-
Nginx Mailing List - Russian
Привет,
существует конфиг:
[...]
root /opt/www/mysite;
location /jquery/ {
try_files $uri $uri/ @common;
}
location /resources/ {
try_files $uri $uri/ @common;
}
location @common {
root /opt/www/_common;
}
[...]
каким образом можно получить путь к файлу, находящимся в /opt/www/_common из собс
by
locojohn
-
Nginx Mailing List - Russian
Попробуйте следующее:
nginx.conf:
http {
...
map $uri $script_url {
~^(?<script_filename>.+\.php)(?<path_info>.+)$ $path_info;
~^(?<script_filename>.+\.php)$ $script_filename;
}
...
}
fastcgi_params:
#fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_php.conf:
includ
by
locojohn
-
Php-fpm Mailing List - Russian