nginx-config

Guide on how to use regex in Nginx location block section?

风流意气都作罢 提交于 2021-02-17 08:28:56
问题 Nginx regex location syntaxe Regex expressions can be used with Nginx location block section, this is implemented with the PCRE engine. What does exactly this feature support as it is not fully documented? 回答1: Nginx location: Nginx location block section have a search order, a modifier, an implicit match type and an implicit switch to whether stop the search on match or not. the following array describe it for regex. # -------------------------------------------------------------------------

Error while using Nginx lua module: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-17 06:31:22
问题 I am receiving below error with Nginx: 2020-12-24 10:41:46 INFO XMLTooling.SecurityHelper : loading certificate(s) from file (/etc/shibboleth/sp-encrypt-cert.pem) 2020-12-24 10:41:46 DEBUG Shibboleth.ServiceProvider : registered remoted message endpoint (default::getHeaders::Application) 2020-12-24 10:41:46 INFO Shibboleth.Listener : listener service starting nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_lua_module.so" failed (libluajit-5.1.so.2: cannot open shared object file: No such

Error while using Nginx lua module: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

时光怂恿深爱的人放手 提交于 2021-02-17 06:31:11
问题 I am receiving below error with Nginx: 2020-12-24 10:41:46 INFO XMLTooling.SecurityHelper : loading certificate(s) from file (/etc/shibboleth/sp-encrypt-cert.pem) 2020-12-24 10:41:46 DEBUG Shibboleth.ServiceProvider : registered remoted message endpoint (default::getHeaders::Application) 2020-12-24 10:41:46 INFO Shibboleth.Listener : listener service starting nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_lua_module.so" failed (libluajit-5.1.so.2: cannot open shared object file: No such

Expose multiple api uri on the same nginx server block

情到浓时终转凉″ 提交于 2021-02-13 17:33:42
问题 Goal My goal is to setup multiple backend api container exposed on the same nginx server : http://localhost:80/api/account -> call http://account-service:9000/ http://localhost:80/api/cart -> call http://cart-service:9000/ http://localhost:80/api/order -> call http://order-service:9000/ http://localhost:80/api/product -> call http://product-service:9000/ ... My backend container are based on php:7.2-fpm (symfony hosted on every apache container) and they don't have any route called api/${NAME

NodeJS and react app deployment on AWS: not rendering react UI

独自空忆成欢 提交于 2021-02-11 15:54:54
问题 I've deployed a nodejs and react app to AWS EC2 following this tutorial. I can see the static html title but react views are not rendering. Looking at the network tab I notice some 404 for the get request but I'm not sure where the issue is. Here is my nginx setup: server { listen 80; location / { proxy_pass http://{{my ec2 ip}}:{{5000}}; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http

Strange Nginx behavior with trailing slashes

只愿长相守 提交于 2021-02-10 18:51:54
问题 I've got a quite interesting behavior. I want to avoid trailing slashes in URL's on my site. I've put rewrite ^/(.*)/$ /$1 permanent; rule into my server block, so https://example.com/something/ , https://example.com/something//// redirect to https://example.com/something ; and https://example.com/ redirects to https://example.com But https://example.com//// is redirected to ... https://enjoygifts.ru//// (actually don't redirected, it's 200 code). Why? Here is my server block: server { listen

No php extension and pretty url nginx config alternative

雨燕双飞 提交于 2021-02-08 11:37:54
问题 I just migrated my code from apache to nginx server. What would be the alternative nginx config to my apache .htaccess. What i use are rules for removing .php extension and pretty url rewrite. RewriteEngine On #remove .php RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^\.]+)$ $1.php [NC,L] #for pretty url RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ index.php?url=$1 [NC,L] 回答1: Try this map $uri $pretty_url { ~/(.*)$ $1; } server { ...

NGINX 301 redirect using query argument value

自古美人都是妖i 提交于 2021-02-08 11:17:29
问题 I want to redirect example.com/?lang=en to example.com/en/ . I am using Python Django and my server running Plesk / Nginx. I try to redirect on my webpage like this. But it's don't work; rewrite ^/?lang=en$ /en/ redirect; But if i remove question mark rewrite is worked. I tried many methods but I couldn't find a solution. Thank You. 回答1: The most simple is if ($arg_lang = en) { return 301 /en$uri; } However if you'd have any other query arguments, they would lost with this redirection rule.

NGINX 301 redirect using query argument value

ぃ、小莉子 提交于 2021-02-08 11:15:25
问题 I want to redirect example.com/?lang=en to example.com/en/ . I am using Python Django and my server running Plesk / Nginx. I try to redirect on my webpage like this. But it's don't work; rewrite ^/?lang=en$ /en/ redirect; But if i remove question mark rewrite is worked. I tried many methods but I couldn't find a solution. Thank You. 回答1: The most simple is if ($arg_lang = en) { return 301 /en$uri; } However if you'd have any other query arguments, they would lost with this redirection rule.

In nginx location block with regex match - the entire path including the location part is appended to the alias

别来无恙 提交于 2021-01-29 17:25:51
问题 I have a webapp with nginx (within a docker container: webserver_nginx_1 ) which I'm trying to configure. The file admin_view_groups.html loads main.js . I expect the following mapping, based on the location ~ /V1 block in nginx.conf : /V1/js/mlj/main.js -> /usr/src/app/web/V1/js/mlj/main.js # the file exists within the container docker exec -it webserver_nginx_1 bash root@90c800c4bd28:/# ls -l /usr/src/app/web/V1/js/mlj/main.js -rwxrwxrwx 1 1000 1000 1709 Jan 9 06:49 /usr/src/app/web/V1/js