Наверное, вы этого не ждёте, но правильнее всего это было бы сделать в файле index.php: <?php .... if ($_REQUEST['do'] == 'register') { header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden'); printf("Access denied.\n"); exit; } .... ?> Андрейby locojohn - Nginx Mailing List - Russian
VoodoKobra, with your version location "/resources/images" will not be captured. Andrejsby locojohn - Ideas and Feature Requests
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. Andrejsby 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 Requests
Here'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://toby locojohn - Ideas and Feature Requests
I 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 - English
Johann, 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 inclby locojohn - Ideas and Feature Requests
You are welcome. :)by locojohn - Ideas and Feature Requests
Use negative regex assertion: location ~ ^/(?!(favicon\.ico|resources|robots\.txt)) { .... # your stuff } Andrejs loco (at) andrews.lvby locojohn - Ideas and Feature Requests
Hello, 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.lvby locojohn - Migration from Other Servers
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 phpby 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
Supernix, you forgot about memory_limit, too: memory_limit = 512M Andrejsby locojohn - Requests for Paid Services
Hello, Is this issue still not solved? Please contact loco (at) andrews.lv and we'll discuss the details. Andrejsby 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 dby locojohn - How to...
location ~ \.mp4$ { mp4; } Andrejs loco (at) andrews.lvby 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 } lby 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; } Andrejsby 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
Sure, for the money. Best regards, Andrejsby 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 wiby 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 aby 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 yoby locojohn - Php-fpm Mailing List - English
Yes, location is better and even faster in general. Andrejsby locojohn - Nginx Mailing List - English
I could do that. PM: loco{at}andrews.lv Andrejsby locojohn - Requests for Paid Services
location ~ ^(?<path>.*)\.html$ { include fasctgi_params; fastcgi_param SCRIPT_FILENAME $document_root/index.php; fastcgi_param QUERY_STRING "module=website&action=$path" fastcgi_pass ...; } Andrejsby 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; } Andrejsby 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/fby 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 rby locojohn - How to...
![]() | ![]() | ![]() | ![]() |
|