proxy_hide_header X-Frame-Options;
add_header
. set $root_path /var/www/mysite_domain_ru_usr/data/www/mydomain.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
# не работает вариант
if ($arg_tag) {
rewrite ^/(.*)$ /$arg_tag/? permanent;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/mydomain.ru.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
set $root_path /var/www/mysite_domain_ru_usr/data/www/mydomain.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location /category/ {
if ($arg_tag) {
rewrite ^ /category/$arg_tag/? permanent;
}
rewrite ^/([^/]+/)([^/]+)/$ /index.php?q=$1&tag=$2 last;
rewrite ^/(.+)$ /index.php?q=$1 last;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/mydomain.ru.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
location ^~ /uploads/thumbs/ {
root /home/admin/web/site-b.com/public_html;
try_files $uri @proxy;
}
location @proxy {
proxy_pass http://11.22.33.44:80$uri;
proxy_set_header Host site-a.com;
}
location /_next/static/ {
alias /var/www/promo/nextjs-coupon/.next/static;
^~
и в alias добавить /
location ^~ /_next/static/ {
alias /var/www/promo/nextjs-coupon/.next/static/;
fastcgi_param APP_SETTINGS app-settings-12;
fastcgi_param API_ENDPOINT app-endpoint-outer;
fastcgi_param USE_SHOTLINKS false;
fastcgi_param PHP_VALUE auto_prepend_file=$document_root/file.php;
server_name site.ru; server_name www.site.ru; rewrite ^/(.*)/$ /$1 permanent;
if ($request_uri ~ "\.html\?selected_section=discussion") {
return 301 $uri;
}
location = /abcd/auth/sign-in {
proxy_pass http://198.12.123.42.23/auth/sign-in;
}
location ~ ^/abcd/auth/sign-in$ {
rewrite ^ /auth/sign-in break;
proxy_pass http://198.12.123.42.23;
}
location ~ ^/abcd(/auth/sign-in)$ {
proxy_pass http://198.12.123.42.23$1;
}
href="styles/impact/css/site.css"
./e-voting-ui-pl/console
/e-voting-ui-pl/console/
location ^~ /e-voting-ui-pl/console/ {
proxy_pass http://p01qr01.test.local:8161/;
}
location /foo/bar/ {
proxy_pass http://127.0.0.1:3000/;
}
location /foo/bar {
rewrite ^/foo/bar/?(.*) /$1 break;
proxy_pass http://127.0.0.1:3000;
}
/ja -> /jp
/ja/ -> /jp/
/ja/page -> /jp/page
server {
rewrite ^/ja($|/.*) /jp$1 permanent;
Если alias используется внутри location’а, заданного регулярным выражением, то регулярное выражение должно содержать выделения, а сам alias — ссылки на эти выделения
location ~* ^/static/\d+/(.+\.css)$ {
alias /path/to/static/$1;
}
location ~* ^/(static)/\d+/(.+\.css)$ {
alias %hostdir%/$1/$2;
}
location ~* ^.+\.(css...
. root /www/pcl.col;
location / {
try_files $uri /index.php$is_args$args;
}
location /project-1 {
try_files $uri /project-1/index.php;
}
location /project-2 {
try_files $uri /project-2/index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
/path?query
/path
, а GET параметры следует искать в $args.if ($request_uri ~ "/\?[a-z]{9}") {
return 403;
}